MySQL for the Internet of Things

(Steven Felgate) #1

Chapter 6


Building Low-Cost MySQL


Data Nodes


Data nodes are a key component in IOT solutions. Your solution could use one or more data aggregators to
send data to a database server in the cloud or one or more database servers in the solution itself. If your IOT
solution uses custom-designed hardware, you may even incorporate a database server on an embedded
computing component. Whichever the choice, you need to know more about using a database server in
your solution.
At a minimum, you need to know how to get those nodes or components in your solution to send data to
the database server. This could be a sensor node with a microcontroller that sends data to a data aggregator, a
sensor node that sends data to a data aggregator, or the data aggregator that sends data to the database server.
While there are several choices for a database server including a desktop or server computer, IOT
solutions tend to use smaller computing devices like those you saw in Chapter 3 such as a single-board
computer. For example, you could use a mini-PC like the pcDuino, a single board computer like the
Raspberry Pi, Beaglebone Black, or Intel Galileo.
Since the Raspberry Pi is one of the more popular choices, I will focus on the Raspberry Pi in this
chapter, but I include notes about other platforms in case you’d like to use those. Just keep in mind some
of these platforms are still evolving and may require more work than the Raspberry Pi. Following the
discussion about the Raspberry Pi should give you the background needed for other platforms.
This chapter presents information about how to use data nodes in an IOT solution from a sensor
networking point of view, that is, a solution that uses a network of nodes to distribute the processing either for
cost or for physical distribution (such as reading sensors around a large agricultural or industrial complex).
You will learn how to create a data node (database server) in this chapter, which features a short
introduction to the Raspberry Pi followed by a walk-through of how to set up a MySQL server using a Raspberry
Pi. You will also learn how to connect to your database server from your sensor or data aggregation nodes.
Let’s begin with a look into the Raspberry Pi.


Introducing the Raspberry Pi


The Raspberry Pi is a small, inexpensive personal computer. Although it lacks the capacity for memory
expansion and can’t accommodate on-board devices such as CD, DVD, and hard drives,^1 it has everything
a simple personal computer requires. There have been several iterations of the Raspberry Pi. The newest
version, the Raspberry Pi 2B (http://raspberrypi.org/products/raspberry-pi-2-model-b/), has four
USB ports, an Ethernet port, HDMI video, and even an audio connector for sound.


(^1) But can accept USB-based memory sticks and hard drives.

Free download pdf