MySQL for the Internet of Things

(Steven Felgate) #1

ChApTEr 2 ■ hArdwArE for IoT SoluTIonS


Most digital sensors are actually small circuits of several components designed to generate digital data.
Unlike analog sensors, reading their data is easy because the values can be used directly without conversion
(except to other scales or units of measure). Some may suggest this is more difficult than using analog
sensors, but that depends on your point of view. An electronics enthusiast would see working with analog
sensors as easier, whereas a programmer would think digital sensors are simpler to use.
So, what do you do with the data once it’s measured? The following section briefly describes some
aspects of sensor data and considerations for storing that data.


Storing Sensor Data


Storing sensor data depends on how the data is interpreted and ultimately how it will be used. If you plan to
use a computer—or, better, a database—to store the data, you should store it in a way that makes sense.
For example, storing a sequence of voltages from an analog signal may be considered preserving the
data in its purest form, but without context or an A/D converter, the data may be meaningless. Storing
the digital conversion of the voltage may not be wise either, because you have to remember the scale and
range in order to derive the values intended to be represented. Thus, it makes much more sense to store
the resulting conversion to scale. Fortunately, when you’re using digital sensors, the only thing you need to
remember is what unit of measure is being used (Celsius, Fahrenheit, feet, meters, and so on). Therefore, it’s
best to save the final form of the measurement.
But where do you store this information? Commercial sensor networks store the data in an embedded
database or file-storage device, transmit it to another system for storage, or store it on removable digital
media. Older sensor networks (like a polygraph or EKG machine) store the data as hard copy using graphs
(making them very obsolete).
There are a number of simple storage devices and technologies you can use to build your own sensor
networks, ranging from local devices for the Arduino to modern hard drives on the Raspberry Pi. These
storage mechanisms are listed here and discussed in more detail in Chapter 3.
Let’s take a look at some of the sensors available and the types of phenomena they measure.


Examples of Sensors


All sensor networks begin with one sensor and a means to read and interpret the data. This chapter has
presented a lot of information about sensors. You may be thinking of all manner of useful things you
can measure in your home or office or even in your yard or surroundings. You may want to measure the
temperature changes in your new sun room, detect when the mail carrier has tossed the latest circular in
your mailbox, or perhaps keep a log of how many times your dog uses his doggy door. I hope that by now
you can see these are just the beginning when it comes to imagining what you can measure. You should be
thinking about what kind of sensor network you want to build; you can use this book as a means to learn
how to build it.
What types of sensors are available? The following list describes some of the more popular sensors and
what they measure. This is just a sampling of what is available. Perusing the catalogs of online electronics
vendors such as Mouser Electronics (http://mouser.com), SparkFun Electronics (sparkfun.com), and
Adafruit Industries (http://adafruit.com/) will reveal many more examples.



  • Accelerometers: These sensors measure motion or movement of the sensor or
    whatever it’s attached to. They’re designed to sense motion (velocity, inclination,
    vibration, and so on) on several axes. Some include gyroscopic features. Most
    are digital sensors. A Wii Nunchuck (or WiiChuck) contains a sophisticated
    accelerometer for tracking movement. Aha: now you know the secret of those funny
    little thingamabobs that came with your Wii.

Free download pdf