Forecasts Predict Deluge of Powerful IoT Sensors

Tech the Future: The Future of IoT Sensors
By Zach Wendt, Engineer, Arrow  Electronics

Nearly all predictions estimating how many IoT devices we’ll have in the near future number in the tens of billions. This includes devices monitoring everything from weather conditions to whether or not you need a new bottle of laundry detergent. Underneath all of these gadgets is an array of sensors that relay input back to the cloud, enabling humans—or other IoT devices—to make decisions based on real-world input. Here are a few of the sensors that, while you may not see them, will be working behind the scenes to make our increasingly connected world run smoothly:

Passive Infrared (PIR): This type of sensor will be familiar to many as part of automatic lighting and alarm systems that detect movement. They’re normally made as small components with two sensing elements inside. When they sense a change in radiation in the surrounding area, this information is passed to a security system or other device. While the sensing element is something of a commodity, what sets different devices apart are the lenses used to focus the surrounding area into different segments, allowing for a wide range of monitoring capabilities.

Inertial Measurement Unit (IMU): If you want to track how something is moving, IMUs fill this role quite well. In the case of the popular MPU-6050, it packages both a gyroscope and accelerometer in one unit, allowing devices to respond to movement. Some devices integrate magnetometer (compass) into the unit as well, providing absolute orientation with respect to the earth’s surface.

Temperature Sensor: Temperature is inextricably linked for human comfort and even storage of some foods and other goods. So, measuring this is an important IoT function. This can work via a thermocouple method where a voltage is generated by two dissimilar metals or via a thermistor. A thermistor is a resistor that changes properties based on temperature.

Magnetic Field Sensor: While instances where you need to sense a magnetic field simply for its own sake are rare, embedding a magnet in equipment to facilitate sensory input is quite common. Home uses include attaching magnets to windows and doors to sense when one has been opened, while they are used in industry to verify that manufacturing equipment has completed a task. Sensors can take the form of a reed switch where a magnetic force opens or closes a pair of contacts inside a specially designed component, or a hall effect sensor that measures a magnet’s effect on a semiconducting material. One advantage of a hall sensor is that it can output a digital on/off signal, or can be set up to output a voltage proportional to the magnetic flux density experienced.

Load Cell: These sensors can detect force applied on an area, and are especially useful in industrial applications, where force applied to a part can mean the difference between a good product and one that doesn’t work. The most common device in use is called a strain gauge, where specially designed equipment measures the resistance of a material under load. Another method is known as piezoelectric load cell, where a material generates a voltage when deformed. One challenge with piezoelectric cells is that they only generate voltage when deformed, meaning this effect can’t be measured after the initial deformation.

Microswitch: Though we might not think of a microswitch—or any switch—as a sensor, these small mechanical devices (also known as snap-action switches) have been around since the 1930s and operate in such diverse modern technologies as arcade game buttons to automatic stops on CNC equipment. These switches use spring force to snap back to an original position when not depressed, and allow current to flow from a common connector to one of two outputs depending on the actuator position. While newer sensors have their advantages, this tried-and-true sensing method will be employed well into the future.

Sound Sensor: Sound has been used to transmit information throughout human history, and with the invention of the electronic microphone in the late 1800s—converting sound energy to mechanical motion and finally to electrical signals—this information could be recorded and transmitted. Now using increasingly powerful computers, microphones can be used to accomplish everything from coordinating lights with sound volume, to answering queries via smart devices like Amazon’s Alexa or Google Home. As speech recognition technology continues to advance, we could see this sensing method become more and more common.

Machine Vision: When we observe the world around us, no sense gives us more immediate information than sight. While our eyes do an amazing job at focusing on objects and absorbing light, the real trick lies in our brain’s ability to translate these blobs of light into something meaningful in our lives. When Cognex, a leader in machine vision, first started in the early 1980s, they celebrated when their prototype system could read the number “6” in 90 seconds. Now the company claims equipment capable of millisecond character reads—an increase in capacity of nearly 100,000 times. While this technology has leaped forward in the last 35 years, recognizing shapes, faces, and doing dimensional measurement, being able to understand what a picture truly means is still in its infancy, and will be the subject of research and advancement well into the future.

It will be exciting to see where IoT sensing technology takes us in the near future. Using microfabrication techniques, systems like an IMU that would have taken up significant space in years past can now be fit onto a single chip, allowing them to be embedded in more and more devices. Processing power to interpret input from the chips has increased exponentially, and the wireless technologies like Wi-Fi, Bluetooth and cellular data transmission have also advanced, allowing them to relay information to “the cloud” from nearly anywhere. Clearly our world will become more and more connected, hopefully leading to a bright future…or at least one where your sensor network prompts you to bring your umbrella when needed!

Zach Wendt is an engineer who enjoys writing about new technology and its impact on applications. Zach has a background in consumer product development and writes about sensors and other electronic components for Arrow Electronics.

This appears in the March (332) issue of Circuit Cellar magazine

Not a Circuit Cellar subscriber?  Don’t be left out! Sign up today:

CC Magazine – Sign Up Now!


Raspberry Pi-Based Network Monitoring Device

In 2012, Al Anderson, IT director at Salish Kootenai College in Pablo, MT, and his team wired the dorms and student housing units at the small tribal college with fiber and outdoor CAT 5 cable to provide reliable Internet service to students. “Our prior setup was wireless and did not provide very good service,” Anderson says.

The 25 housing units, each with a small unmanaged Ethernet switch, were daisy chained in several different paths. Anderson needed a way to monitor the links from the system’s Simple Network Management Protocol (SNMP) network monitoring software, Help/Systems’s InterMapper. He also wanted to ensure the switches installed inside the sun-exposed utility boxes wouldn’t get too hot.

The Raspberry Pi is a small SBC based on an ARM processor. Its many I/O ports make it very useful for embedded devices that need a little more power than the typical 8-bit microcontroller.

Photo 1: The Raspberry Pi is a small SBC based on an ARM processor. Its many I/O ports make it very useful for embedded devices that need a little more power than the typical 8-bit microcontroller.

His Raspberry Pi-based solution is the subject of an article appearing in Circuit Cellar’s April issue. “We chose the Raspberry Pi because it was less expensive, we had several on hand, and I wanted to see what I could do with it,” Anderson says (see Photo 1).

The article walks readers through each phase of the project:

“I installed a Debian Linux distro, added an I2C TMP102 temperature sensor from SparkFun Electronics, wrote a small Python program to get the temperature via I2C and convert it to Fahrenheit, installed an SNMP server on Linux, added a custom SNMP rule to display the temperature from the script, and finally wrote a custom SNMP MIB to access the temperature information as a string and integer.”

Setting up the SBC and Linux was simple, Anderson says. “The prototype Raspberry Pi has now been running since September 2012 without any problems,” he says in his article. “It has been interesting to see how the temperature fluctuates with the time of day and the level of network activity. As budget and time permit, we will be installing more of these onto our network.”

In the following excerpt, Anderson discusses the project’s design, implementation, and OS installation and configuration. For more details on a project inspired, in part, by the desire to see what a low-cost SBC can do, read Anderson’s full article in the April issue.

Figure 1 shows the overall system design. The TMP102 is connected to the Raspberry Pi via I2C. The Raspberry Pi is connected to the network via its Ethernet port. The monitoring system uses TCP/IP over the Ethernet network to query the Raspberry Pi via SNMP. The system is encased in a small acrylic Adafruit Industries case, which we used because it is inexpensive and easy to customize for the sensor.

The system is designed around the Raspberry Pi SBC. The Raspberry Pi uses the I2C protocol to query the Texas Instruments TMP102 temperature sensor. The Raspberry Pi is queried via SNMP.

Figure 1: The system is designed around the Raspberry Pi SBC. The Raspberry Pi uses the I2C protocol to query the Texas Instruments TMP102 temperature sensor. The Raspberry Pi is queried via SNMP.

Our first step was to set up the Raspberry Pi. We started by installing the OS and the various software packages needed. Next, we wrote the Python script that queries the I2C temperature sensor. Then we configured the SNMP daemon to run the Python script when it is queried. With all that in place, we then set up the SNMP monitoring software that is configured with a custom MIB and a timed query. Finally, we modified the Raspberry Pi case to expose the temperature sensor to the air and installed the device in its permanent location.

The Raspberry Pi requires a Linux OS compiled to run on an ARM processor, which is the brain of the device, to be installed on an SD card. It does not have a hard drive. Setting up the SD card is straightforward, but you cannot simply copy the files onto the card. The OS has to be copied in such a way that the SD card has a boot sector and the Linux partitioning and file structure is properly maintained. Linux and Mac OS X users can use the dd command line utility to copy from the OS’s ISO image. Windows users can use a utility (e.g., Win32DiskImager) to accomplish the same thing. A couple of other utilities can be used to copy the OS onto the SD card, but I prefer using the command line.

A Debian-based distribution of Linux seems to be the most commonly used Linux distribution on the Raspberry Pi, with the Raspbian “wheezy” as the recommended distribution. However, for this project I chose Adafruit Learning Systems’s Occidentalis V0.2 Linux distribution because it had several hardware-hacker features rolled into the distribution, including the kernel modules for the temperature sensor. This saved me some work getting those installed and debugged.

Before you can copy the OS to the SD card, you need to download the ISO image. The Resources section of this article lists several sources including a link to the Adafruit Linux distribution. Once you have an ISO image downloaded, you can copy it to the SD card. The Resources section also includes a link to an Embedded Linux Wiki webpage, “RPi Easy SD Card Setup,” which details this copying process for several OSes.

The quick and dirty instructions are to somehow get the SD card hooked up to your computer, either using a built-in SD reader or a peripheral card reader. I used a USB attached reader. Then you need to format the card. The best format is FAT32, since it will get reformatted by the copy command anyway. Next, use your chosen method to copy the OS onto the card. On Linux or Mac OS X, the command:

dd bs=4M if=~/linux_distro.img of=/dev/sdd

will properly copy the OS onto the SD card.

You will need to change two important things in this command for your system. First, the
if parameter, which is the name the in file (i.e., your ISO image) needs to match the file you downloaded. Second, the of device (i.e., the out file or our SD drive in this case) needs to match the SD card. Everything, including devices, is a file in Linux, in case you are wondering why your SD drive is considered a file. We will see this again in a bit with the I2C device. You can toast your hard drive if you put the wrong device path in here. If you are unsure about this, you may want to use a GUI utility so you don’t overwrite your hard drive.

Once the OS is copied onto the SD card, it is time to boot up the Raspberry Pi. A default username and password are available from wherever you download the OS. With our OS, the defaults are “pi” and “raspberry.” Make it your first mission to change that password and maybe even add a new account if your project is going to be in production.

Another thing you may have to change is the IP address configuration on the Ethernet interface. By default, these distributions use DHCP to obtain an address. Unless you have a need otherwise, it is best to leave that be. If you need to use a static IP address, I have included a link in the Resources section with instructions on how to do this in Linux.

To access your Raspberry Pi, hook up a local keyboard and monitor to get to a command line. Once you have the network running and you know the IP address, you can use the SSH utility to gain access via the network.

To get SNMP working on the Raspberry Pi, you need to install two Debian packages: snmpd and snmp. The snmpd package is the actual SNMP server software that will enable other devices to query for SNMP on this device. The second package, snmp, is the client. It is nice to have this installed for local troubleshooting.

We used the Debian package manager, apt-get, to install these packages. The commands also must be run as the root or superuser.

The sudo apt-get install snmpd command installs the snmpd software. The sudo part runs the apt-get command as the superuser. The install and snmpd parts of the command are the arguments for the apt-get command.

Next we issued the
sudo apt-get install snmp command, which installed the SNMP client. Issue the ps -ax | grep snmpd command to see if the snmpd daemon is running after the install. You should see something like this:

1444 ? S 14:22 /usr/sbin/snmpd -Lsd -Lf /dev/null -u snmp -g snmp -I -smux -p /var/run/

If you do not see a line similar to this, you can issue the sudo /etc/init.d/snmpd command start to start the service. Once it is running, it is time to turn your attention to the Python script that reads the temperature sensor. Configure the SNMP daemon after you get the Python script running.

The Raspberry Pi’s final installation is shown. The clear acrylic case can be seen along with the Texas Instruments TMP102 temperature sensor, which is glued below the air hole drilled into the case. We used a modified ribbon cable to connect the various TMP102 pins to the Raspberry Pi.

The Raspberry Pi’s final installation is shown. The clear acrylic case can be seen along with the Texas Instruments TMP102 temperature sensor, which is glued below the air hole drilled into the case. We used a modified ribbon cable to connect the various TMP102 pins to the Raspberry Pi.