12 March 2012
By Jon Gabay
It’s an analog word. Real-world processes and events happen in the analog domain. Temperature for example isn’t just On or Off. It has a magnitude. But a heating system will rely on a thermostat to tell it to turn on or off, basically a digital function.
Our control systems are also digital. At the heart of every microprocessor and microcontroller are digital logic elements representing On and Off states. Control functions, monitoring conditions, algorithms, and even user interfaces are built from logic concepts that ride over these digital states.
Sensors can be analog or digital. The Hall Effect sensors we discussed in section one measures an analog field and turns this into a digital function. It basically detects a threshold level as to when to change an output state. Like a temperature thermostat, it basically indicates ON – there is a magnetic field strong enough – or OFF – there is no magnetic field strong enough to trip the switch.
Sensors come in a variety of flavors to detect and measure many phenomena. Typical sensors are temperature, pressure, light level, shock, vibration, acceleration, field strength, sound level, ph, salinity, humidity, and more. This is good for us Gizmologists, but comes with a problem to solve. Different types of sensors output different types of signals. And, to be useful, we need to have some way to calibrate to standards.
This article describes a project that you can build which results in a fast and effective way of interfacing a variety of linear sensors to a microcontroller’s A/D section. This provides protection to the microcontroller and lets us easily interface virtually any type of sensor we want, getting the most accuracy and being able to calibrate it.
We invite you to dive into the technology, implement the design and share your innovations with us in video segments. Make sure you read the rules* below, but here is how it works:
*Limit of 1 (one) gift card per person. Offer limited to the first 50 (fifty) participants who fulfill the four guidelines stated above. Offer ends April 30, 2012.
All parts referenced here are available at the Avnet-Express website. Schematics, prototype layout pictures, and design information is freely available here to encourage students, hobbyists, engineers, inventors, and gizmologists to be creative and focus on creating systems and circuits to solve problems, reduce energy and greenhouse gasses, improve life, and make the world a better place.
On the Level
Mostly, discrete sensors are two terminal devices. This means that they will exhibit a change in voltage, current, or resistance based on the conditions to which they are sensitive and exposed. A good example of this type of sensor is a thermistor like the B57863S 103F 40 (see Fig. 1).
A thermistor exhibits a change in resistance as temperature changes. This part is a Negative Temperature Coefficient (NTC), which means that its resistance decreases as temperature increases. Conversely, PTC types of thermistors feature increased resistance as temperature rises.
|Fig. 1 – A thermistor is an example of a passive transducer that exhibits a change in resistance as temperature changes.||xx||Fig. 2A – Some linear sensors really do have linear characteristics like this ambient light sensor.
|Fig. 2B – Some linear sensors exhibit a curved transfer function that can use curve fitting algorithms or lookup tables to correct.||Fig. 3A – This 2 terminal temperature sensor uses internal circuitry to generate a current based on temperature.|
Fig. 3B – This 3 terminal temperature sensor uses power to linearize the response and provide higher accuracy.
|Fig. 4 – Some sensors eliminate linear output stages and communicate directly with a microcontroller in digital format. These are typically more costly than the simple transducer based linear sensor.|
Another thing to keep in mind with sensors is that not all linear sensors are truly linear. For example, an ambient light sensor like the ALS-PDIC243-3B exhibits a very linear response with current compared to light level (See Fig. 2A). Conversely, an air mass flow rate sensor like the D6F-P0010A has a curved output voltage response as flow rate varies (See Fig. 2B). Here software techniques like curve fitting algorithms or lookup tables can be the easiest methods for improving accuracy.
There are single-ended and differential types of sensor amplifiers. A single-ended sensor is usually referenced to ground. A differential sensor amplifier amplifies the difference between two terminals. Both have their place, and both have their advantages and disadvantages. In this design, we will use single-ended sensor interface techniques because it is simpler at the start. (Keep an eye on future installments when we delve into differential sensors and sensors that can operate well beyond the voltage limits of the Op-Amps and power supplies we use.)
Important is the fact that some sensors can create voltage levels that can damage electronics. For example, we can bias the thermistor or ambient light level sensors to operate only in a safe voltage range that cannot damage the circuitry. But sensors like the AB3529BF or the APS2509S-T-R are piezo electric. They will play nicely when used in a controlled range. It is not uncommon, however, for shock sensors to put out a 100-volt spike, for example.
This means that some sort of protections will be built in to protect the sensitive electronics. We also want to protect from negative voltages that can also damage sensitive circuits.
We also want to get as much range and accuracy from our sensors as possible. This means clever biasing, offsetting, and amplifying the often weak signals that come from our sensors. In the case of the high-voltage piezo, it can also mean attenuating and current limiting.
Finally, we want a way that we can calibrate our sensors. This means we can build more than one and they will behave the same way. It also means that we can conform to standards. A resistance meter would not be very useful if each resistance meter gave you a different reading.
Integrated vs. Discrete
Our design can use two classes of analog sensors – discrete or integrated. The discrete types of sensing elements like photo cells have characteristic transfer curves of their performance. They are just sensor materials that exhibit a linear electrical response that we need to adapt to our applications. The other types are active sensors that incorporate circuits inside the sensor to improve performance or linearity.
An example of this type of sensor is the 5962-8757103YA, which is more than just a transducer. It contains active circuitry (See Fig. 3A) that helps to linearize and improve the accuracy. Active sensors may also carry with them the need to supply power and ground.
A good example of a powered sensor is the AD22100KRZ active temperatures sensor (See Fig. 3B). This is a monolithic temperatures sensor with on-chip signal conditioning, which performs linearization to better than + / – 1% across the full scale range. Its output is an analog voltage and, as such, can take advantage of our board.
A third type of active sensor does not need our board. An example of this sensor is the TMP006AIYZFR – an integrated contact-less thermo-pile infrared temperature sensor. This absorbs infrared energy emitted from an object based on its temperature. Note the SCL and SDA outputs. This is accessible directly over a SMBus serial data link so that no analog interfacing is needed (See Fig. 4).
Since the non active sensors are usually very low cost compared with the higher priced active sensors, our board will let us interface to and build boards with the lower cost passive types of linear sensors. This also allows us to develop and create our own sensors for things like liquid level detection, which can have different characteristics depending on the types of liquids we are measuring.