Forums

Sensors & Embedded Systems - The Basics

Started by stephaneb 1 year ago10 replieslatest reply 1 year ago711 views

I will be attending Sensors Expo at the end of June in San Jose and thought this would be a great opportunity to address in the #FAQ and for the first time the topic of Sensors for Embedded Systems.  

Sensing technologies play an important role in many (most?) embedded systems.  The topic is very broad though and I expect many more #FAQ threads about #Sensors to be created in the future.  

What I would like this first discussion thread to be is a basic introduction. I hesitate to give too many guidelines as I am convinced that most of you have a better idea than I do on what 'The Basics' should include.  Anyhow, here are a few pointers: 

  • The most common/popular types of sensors for Embedded Systems in term of what they measure (temperature, pressure, etc)
  • The differences between active and passive sensors
  • What is meant by 'Smart' sensor
  • Trends?
  • And any other info that you believe should belong in this introduction thread about sensors.

$150 will be shared between the most appreciated contributors to this discussion - the more thumbs-ups you receive from other members of the site, the bigger your share will be.

Thanks a lot!

[ - ]
Reply by mr_banditMay 29, 2018

To state the obvious: an embedded system exists to receive in some input(s), process it, and output some value(s). There are variations on this, for example I did a system that only had outputs: controlled two motors and a solenoid. But it took the values for each (rate, etc) from a human, then did those output functions until told to stop.

One of the keys to using sensors is rate of reading and the ranges. You need to understand the rate of the thing (pressure, temperature, etc) you need to input - Nyquist (https://en.wikipedia.org/wiki/Nyquist_rate) demands you can sample at least (put very simply) twice as fast as the signal changes (this can become a very complex subject very quickly). You may have some signal to read that is usually very steady or predictable, but will spike (up or down) very fast very infrequently. 

Point is: take the time to really understand what it is you need to measure, *then* pick the sensor set needed for the task. 

HOWTO: See below.

You may have a very large temperature range with very high levels of accuracy over the entire range or portions of ranges (like the high and low, but not the middle). This gets into the area of "smart sensors", meaning possibly multiple sensors in one package, or a fair amount of processing of its sensor inputs. Google the term. One reasonable explanation is (https://www.controleng.com/single-article/what-is-...) - keep in mind you may be the design engineer for the smart sensor.

The article has a good line: "For a [machine vision] sensor to really be 'smart,' it should not require the user to understand machine vision" - meaning the sensor does the heavy lifting. In this case, the user might only be interested in something moving, and wants to the sensor to only notify when it detects movement, the number of moving object, their centroids, rate and direction of moving, etc.

"active and passive sensors" - here, again, Mr Google can help. The fundamental difference is a "passive" sensor just looks at some phenomena; pressure, temperature, light level, etc. An "active" sensor produces some signal and looks at the return - RADAR, LIDAR, Sonar, etc. GPS is included, because the *system* itself is in two parts; the satellites sending their time stamps, and the other part (GPS receiver) listens to the various time stamps and computes its location.

NASA is one of the leading experts on sensors and sensor design. They have extremes in types of sensors, ranges, environments, longevity, etc. Take a look at https://www.nasa.gov/directorates/heo/scan/communi...

TRENDS: The big one I see is driven by networks and the cost of sensor units that vary in cost as a function of resolution.

For example, I had a client that does relative humidity sensors - some of the best in the biz. His high-end ones can easily cost $20k to $40K. However, we developed a low-cost ($2-3K) that could be distributed around a facility and were networked together. The low-cost ones had low resolution, but they could easily detect the beginning of a problem. When one would alert, the single high-end sensor could be used to diagnose the issue.

This gets into the whole "internet of things". Personally, I am not convinced my toaster and refrigerator need to know each other. However, it is obvious industrial facilities are the prime application area for IOT. This is also an area for the mix of passive, active, and smart sensors. The form of networking is application specific: Ethernet, RS422, WiFi, etc.


HOWTO: I always start with the signal. In most cases it's pretty obvious on what to measure and what range. IF NOT: you need access to the "thing to measure" OR you need to do a *very* careful analysis (NASA has this type of problem).

LET'S TAKE THE OBVIOUS: You know you need to take the temperature of a boiler. You know the high and low range. You know it should rise and fall pretty slow and predictably. You know the danger/fault/bad cases. Best of all worlds, you have access to a working unit or a good-enough simulator (eg environment chamber). This allows you to reduce the types of sensors down to 2..3 types. Mr Google suggests Wikipedia: https://en.wikipedia.org/wiki/List_of_temperature_... You pick an RTD https://en.wikipedia.org/wiki/Resistance_thermomet... and one of the IC versions.

Now is the time to get one that fits your range and rate. Make an interface circuit. Put the sensor in the environmental chamber/simulator. Hook up your o-scope. Start experimenting with the temperature. The goals are to (1) make sure your interface circuit is working correctly, (2) you can measure to the rate and range you need, and (3) you understand how this beasty *really* works. Keep in mind *datasheets can lie to you*. Test the range. Test the error cases (force rapid cooling or heating).

Rinse/repeat with all of your possible choices. Once you understand the interface and how each beasty works, you can make your selection based in the rest of your requirements - cost, MTBF, vibration, etc. The vibration might reject the RTD because it is too fragile, but one of the IC sensors will give you "good enough" (meets all the requirements).

IIOT (Industrial IOT): The first thing is take an inventory of the types of things to measure (eg the actual equipment). ASK THE WORKERS and shop foremen about future cases. Figure out what *kind and rate* of measurements you need to do. This first cut can tell you wired is a must, or you might be able to do wireless. However, not all wireless is created equal. Your analysis should narrow it down to a couple of choices. If none will work, you know you need wired.

Assuming you have at least one wireless choice: get whatever *wireless* sensors that can return "something". You don't care what - you are trying to select the networking. Put them in your factory and try to create a mesh network. The goal is to see if that form of wireless networking can work. Look at both response time (might be OK for a given single node, but not for an entire mesh). What you want to know is: are you going to be forced into a wired network?

If you have at least two choices, repeat with the next best choice. What looks good on paper might need the best.

POINT IS: at some point, a paper analysis is a Really Good Thing, but you should VERIFY the results with some simple experiments. If you are going to fail, FAIL CHEAP.

[ - ]
Reply by analog.wzrdMay 29, 2018

When I interface with embedded sensors, it's usually to monitor voltage, current, and temperature. I do power and control electronics for antenna systems - so DC/DC buck-boost converters for power, microcontroller or FPGA for control, and I power/control RF amplifiers and other electronics.

DC/DC converters and RF electronics have varying levels of "smartness" when it comes to monitoring how the device is operating. Depending on the part, the sensors can be built-in - I just need to hook up an I2C bus and ping it for data. Other times, I need to add external current sense resistors, dedicated temp sense ICs, or ADCs to collect the data.

I may chicken out on where the line between passive and active sensors should be drawn and see what other people think. I wrote and deleted a couple of answers. I want to say that active sensors require a DC bias. I'm thinking of current sense resistors for passive sensors. What about a resolver where you need to provide an AC input and measure the output and compare to the input? By my definition, it'd be a passive sensor because it's just variable transformer. I guess using a diode for temperature sensoring would be considered "active" because you need to bias it and then monitor the voltage as the temperature varies.

I think a "Smart" sensor would be any modularized sensor package - i.e. an IC that has a sensor integrated with an ADC, digital communications bus, and power. I thinking of TI's TMP100 as a good example. I might also include the ability for any kind of fault detection, or the ability to react or process what it's measuring. 

[ - ]
Reply by roh89_2016May 29, 2018

There is a wide variety of sensors available for an embedded application to choose from. Selection of an appropriate sensor for your application in consideration is very important. Keeping in mind the scope of the thread "basics", I'll not got much into details. As per my opinion, factors that may affect your choice might be : 

a) obviously the intended application - is the sensor right for my application?, for example, you would choose either a temperature sensor or temp&humidity sensor for an environmental sensing app. 

b) accuracy - how accurate are your measurements? e.g., in a positioning application, you would choose an IMU with more ppm accuracy. Even you can go for encoders, e.g. N-bit rotary encoders which are used to readout angular position of a stepper motor. 

c) measurement acquisition timing or measurement protocol (SPI or I2C or MODBUS) - how fast am I able to read from the sensors? , e.g., in a time critical application where you require readings more often, say every 100 us, then you would definitely go for a high speed SPI based "smart sensor" rather than a standard 400 kHz I2C based sensors. 

d) smaller footprint ! e.g., this is a definite thought that might run into your mind when you have space crunch. This would mean you either go for a small package SMD types. This would again mean where you want to put the sensor, on the PCB or outside the application circuit.

e) ruggedness - you might want to go for industry grade packages or seal the sensor in a proper casing before exposing it to the application.

f) COST ! why would you go for a high price sensor if your application is not that critical. For example, HIH6120 T&H sensor (costly) and DHT11 T&H does the same job. Then which one would you choose? Well, (a) to (e) is your guide !.

g) Low power - am I(sensor) consuming a lot of power? 

h) sensitivity - is the sensor sensitive enough to record fast changing events?

In fact (a) to (h) are all interdependent. So choose wisely and effectively. 

There might be more such factors. 

Now once you have chosen the sensor, it's time to calibrate it !! I am wondering "sensor calibration is the most important factor as far as performance is concerned". Calibration should be another aspect of the discussion.

There's not much of a difference between a "passive" and "active" sensors. For example, would you call a thermistor (say NTC type) a passive or active? It still requires a bias voltage (considering voltage divider configuration). In fact all kinds of sensor require some kind of biasing (please correct me if I am wrong). 

Smart sensors would comprise of sensing element, signal conditioning circuitry, ADC, protocol bus (I2C, SPI, or none), biasing circuitry. E.g BMP280 or say HIH9120. 

There's a lot to discuss and write about, but I guess I will end at this for now. This thread will soon be a good source of knowledge. Looking forward to reading posts.

[ - ]
Reply by SolderdotMay 30, 2018

The most important thing with sensors is: Know your application.

You can spend zillions of dollars for the most sophisticated and fanciest sensors out there but it won't do you any good if it does not fit your application.

In case the constraints demand it you might even go for "abusing" a sensor for an application: E.g. use a thermal sensor to roughly guess the filling level, in case the liquid is normally cooler or hotter than the container, might be a good choice, if accuracy and acquisition speed is not of utmost importance. In a high-volume application this might save you a few cents which sums up.

Also consider the properties of a device. An analogue sensor connected to an (external) discrete ADC (analogue-digital-converter) might show a very fancy curve, and calibrating a twisted and bent curve might exceed the computation power of your microcontroller.

Also consider using "dumb" sensors, i.e. that kind which does not have a digital bus interface, flushing the content directly into your microcontroller's memory, but which needs to be converted from the analogue to the digital world first. Of course you need to spend some effort on analogue circuitry here, and this is surely not the easiest to engineer, especially if your a digital affine person, but you can do great things with such applications, e.g. measuring voltages of different ranges on the same input clamp with a single ADC.

So in the end the overall image, the whole system must match your application, the sensor is just one part of it.

[ - ]
Reply by atomqMay 30, 2018

. Since 'embedded' means (more-or-less) 'digital' the most popular sensors are those which are equipped in digital interface or can be (almost) directly hooked up to an ADC. Price is the other definition of popularity..

. Passive sensors are those which do not require any bias/ supply voltage. These are for example termocoulpes or electro-chemical transducers which output parameter could be a resistance or voltage - you do not need to power them to get the data. Active ones require some bias/ supply voltage. Usualy they contain more or less complex circuitry that gains the signal.

. Smart sensors are plug-and-play like devices, which store their unique calibration coefficients, process the data (and output measured parameters with their units).

. trends: recently I have came across laser based measurements (air polution sensors, CO2 sensors, etc), the other destinguidhing group are MEMS based devices (RH, pressure, acceleration sensors).

. The sensor is put in series with the signal of interest. The signal (or a process) itself has its own bandwidth / transfer_function but how about sensor's bandwidth / transfer_function? Sometimes it is realy difficult to get this kind of data out of the datasheet. The best way is to measure it. Then you are ready to have a discussion with Mr Bode, Mr Nyquist, Mr Kotielnikov and Mr Shannon simultaneously while designing a whole data acquisition system.

[ - ]
Reply by ZeynepurJune 7, 2018
Hello.
For me, when working with sensors, the most important things to have in mind are:
- Variables to be sensed and its characteristics: first, identify the variables to take information from. The most common variables for me have been (current, temperature, voltage and pressure).Once you have the variable you want to measure, you have to take notice of which is going to be the range of measurement  (the maximum and minimun values of the varible), and also the presition that you need (for example, being able to measure changes of 0,1 [°C], or 1°[C], etc..). And the dynamics of the variable being sensed (how fast does it behave, to stablish the samplig ratio).
- Interpretation of the signal: Once you have your sensing equipment, you have to contidion the signal, to get meaninfull data. For example a current sensor may give you a 0-5[V] output signal. This signal must be interpreted in order to make desitions with it.
-Physical characteristics of the sensor: Depending of the environment that you need to sense from, you may need different types of sensors. For example when measuring pressure, you may need a sesor that can resist acid gases in the environment, or may not, so this is another important thing to have in account with the sensor option.
-Input: whether the sensor is active or passive (one only collects information, the otherone sends a signal and then collects the information), its important to send an apropiate signal from the sensor to resive apropiate data from the response to this signal.
-Conditioning of signals: If the sensor you are working with is "smart", all the conditioning of signals has allready been made by a break out circuit, included in the sensor module, so there is no need to conditionate the signal, and then get its analog value (from a analog to digital converte). If the sensor used is not a smart sensor, you need to conditionate the signal obtained by the sensor, which means amplifying (or attenuating) the signals to some required level, maybe filtrating it, and then make it digital so it can be read by an MCU.
- Power: what is the sensors power needs so it can work properly, and to bee able to provide this power.
- Price: What is the price of the sensors in the market for the aplication you need it, and what options are there so to adjust to the budget.
[ - ]
Reply by antedeluvianMay 29, 2018

I think there should also be some discussion on sensor buses which may in fact overlap the cogtations on "smart" sensors. There are the basics like SPI and I2C/SMB and even 4-20mA current loop, but would had have to include something like the network approach of IEEE P1451.

At the risk of causing the whole discussion to explode in scope- there would have to be mention of the IoT and the prolifieration of different approaches in that field.

I am only involved on the periphery of this, so it is quite likely that I have missed a few, to say nothing of misunderstanding the application of P1451.

[ - ]
Reply by stephanebMay 29, 2018

Thanks for your input.

Ideally, this thread would end up being the equivalent to the first chapter (introduction) of a long book.  Maybe buses/interfacing could be part of a future 'chapter'.  

I agree with IoT though, let's see what the community comes up with.  

[ - ]
Reply by CustomSargeMay 30, 2018

I can't add much to what's here, all Very well expressed. So, I'll throw a bone from the opposite end.

Cheap precise medium range (5-40VDC) voltage measurement. Voltage regulators of the same polarity as the source being regulated, work by "pushing off" the excess of the regulator rated value. A 7805 outputs 5V when fed 7V or more, up to its' limit (~35V). Now, each polarity of regulator has 3 voltages associated: most positive, least positive and somewhere between (yes, it can be described in negatives too).

By adhering to the most, least, btw, scheme, a negative regulator on a positive voltage source will Subtract it's rated value. A 13V input through a 7908 yields an 8V-13V range as a 0-5V value. The 2 terminals of most & least just swap ends: for a 79xx series "ground" is most positive, input is least.

If this gets a lot of "DUH", shoot, I felt real clever when I thought it up...  <<<)))

[ - ]
Reply by mr_banditMay 29, 2018

Pro tip: If you are in the area of these types of shows (you live nearby or are going to visit), sign up for the exhibits-only. Usually free. (If you wait until you get there, they typically charge $20-$50 as a way of keeping out the "riff-raff" out.)

I used to go to every one that looked interesting when I lived in the bay area. All of the convention centers have what is coming on their websites, with contact info for the people putting on the particular shows.

We also ended up homeschooling our son. If I called ahead, I always got permission to bring him as part of his homeschooling - be explicit. Get the name of the person.. Register the child their own exhibit badge when you get yours.

And, of course, the child must behave - this is a professional event.