IoT 101: Sensors

[ IoT 101: Sensors ]

Our previous tutorial on building a weather station with ARTIK, Temboo and SAMI showed the entire process of connecting a temperature sensor to an IoT node and streaming the resulting data to an Internet page. In this installment of our IoT 101 series we’ll dig into the sensor portion of that stack. We’ll discuss sensor types, how to connect sensors to ARTIK modules, and how to condition sensor signals so we can reliably monitor them.


Sensors connect to IoT nodes through analog, serial and digital interfaces. Most analog and some digital signals will require conditioning for reliability and accuracy.

There’s a sensor for that

If you can think of a physical property, you can probably buy a sensor to measure it. HBO recently received a patent for boxing glove sensors it’ll use for broadcasts; the NFL will have football pad sensors on all players this season and stream live data for real-time broadcast stats. Microsoft will also use the data in its Xbox One NFL app.

At its most abstract, a sensor is nothing more than a black box that transduces a physical state we want to monitor into an electrical property we can measure. It can be as simple as a set of contacts that switches between open and short circuit when we press a button or open a window. It can be a potentiometer that changes resistance when a human turns a dial or a robot extends an arm.

It can also be as complicated as an integrated circuit that senses acceleration and magnetism along three axes to determine orientation, acceleration, and compass heading for your IoT device. The Kionix KMX62 chip includes accelerometers and magnetometers each with 3-axes and 16-bit resolutions, an embedded temperature sensor, and low power consumption between 1 uW (standby) and 295 uW (all sensors active).

Gas sensors from companies like Spec Sensors offer chips that sense common household dangers like CO, industrial dangers like H2S, and driving dangers like breath alcohol. The sensors are 20 mm square and less than 4 mm thick. Developer kits cost $250.

Tip: Gas sensors are available with individual calibration traceable to NIST standards.

Just because we think of them as black boxes doesn’t mean sensors need to come in rigid boxes. Search online for “flexible sensors” and you’ll find an array of flexible sensors you can embed in devices or clothing. Tekscan produces a line of force sensors that can be embedded in the heel of a running shoe or the arm of a robot.Developer kits cost $25.

 

Tip: Flexible sensors can even be embedded in clothing.

Interfaces

Most sensors will connect to IoT nodes powered by ARTIK 5 or ARTIK 10 modules via a digital, serial, or analog interface. The easiest way to monitor a sensor on an ARTIK 1 module is to connect it to an IoT node powered by ARTIK 5 and then access the sensor over BLE.

Digital inputs work for sensors like the buttons and proximity sensors I mentioned. By default GPIO pins are configured as digital inputs. Use a pullup resistor to drive the voltage of a pin high, then connect one side of the contact to the input, the other side of the contact to ground, and when the contact closes you’ll pull the voltage down.

Serial interfaces are typically used for complex sensors like accelerometers. The Kionix chip I mentioned supports the Inter IC bus (I2C) available on ARTIK 5 and ARTIK 10 modules. The I2C bus is a two-wire synchronous serial bus; ARTIK 5 and ARTIK 10 modules also support the similar four-wire Serial Peripheral Interface (SPI). Both the I2C and SPI busses are best suited for communication among chips within a system; a USB connection is preferred if you need to connect a sensor to your IoT device over a cable. Audio sensors may connect using the Inter IC Sound (I2S) bus designed for PCM digital audio streams.

Analog inputs work for sensors like the Flexiforce line. ARTIK 5 offers 2 analog inputs; ARTIK 10 offers 6. Each input accepts a signal of 0 – 1.8 V and includes internal analog-to-digital converters with 10-bit resolution. Output from each ADC will be a digital value of 0 – 4095.

Signal conditioning

Analog sensors typically don’t offer nice 0 – 1.8 V signals; you’ll need a signal conditioning circuit for them. Let’s consider a slide potentiometer used to sense the extension of a robot arm. Each sensor consists of a long resistor, a movable wiper, and three output pins: T1, T2 , and W. You can configure one of the ARTIK power supply outputs (Buck or LDO) to produce 1.8V and connect it across T1 and T2; W will now vary from 0 – 1.8 V.

If a sensor requires more complicated signal conditioning, the supplier will usually offer a reference circuit you can modify for your needs. For example, the FlexiForce pressure sensors use piezoresistive elements and require a single voltage source circuit; modify V(t) and R(f) to produce V(out) Max = 1.8 V given the full-scale force you expect. You’ll also have to include protection circuitry to insure V(out) does not exceed the maximum allowable analog input for the ARTIK modules.


Circuit diagram by Tekscan.

Tip: If a sensor requires complicated signal conditioning, the supplier probably offers reference designs.

You may even want to provide some software signal conditioning between the raw input and the value you report or store. For example, mechanical contacts may bounce as they make or break contact, which will corrupt data if you’re trying to count transitions. A simple “software debounce” routine can solve the problem. Contact bouncing rarely persists longer than about 50 ms, while most properties we’re trying to measure with a contact closure don’t occur faster than a few times a second. Just write a filter routine that only records a transition if the previous transition occurred more than 100 ms ago.

Imagination time

So what sensors do you want in your IoT network? Maybe you could expand the weather station to include a humidity sensor. If the weather station lives in your garden you could add a soil moisture sensor, a rain gauge, or even a leaf moisture sensor. Or maybe you have something more radical in mind and are thinking about radiation sensors, or traffic counters, or… Well, if you can think of a property, you can probably find a sensor for it, connect it to your IoT, and monitor it from anywhere.

Explore the IoT 101 series: Connectivity and Networks

About the author: Kevin Sharp has been an engineer since long before he got his engineering degree, and has extensive experience in data acquisition and control networks in industrial, retail, and supply chain environments. He’s currently a freelance writer based in Tucson, Arizona.

Advertisements

Author: iotmaker

I am interested in IoT, robot, figures & leadership. Also, I have spent almost every day of the past 15 years making robots or electronic inventions or computer programs.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s