Introduction

This is the chapter web page to support the content in Chapter 10 of the book: Exploring BeagleBone – Tools and Techniques for Building with Embedded Linux. The summary introduction to the chapter is as follows:

In this chapter you are introduced to the concept of the Internet of Things (IoT). Two new sensors are discussed—a simple temperature sensor and a more complex Bluetooth low‐energy sensor. Using the BBB, these sensors are the example things that are connected to the Internet. Several different IoT communications architectures are described: The first architecture configures the BBB to be a web server that uses server‐side scripting to display sensor data. Next, custom C/C++ code is described that can push sensor data to the Internet and to platform as a service (PaaS) offerings, such as ThingSpeak and Xively. Finally, a client/server pair for high‐speed Transmission Control Protocol (TCP) socket communication is described. The latter part of the chapter introduces some techniques for managing distributed BBB sensors, and physical networking topics, including connecting the BBB to the Internet using Wi‐Fi; setting the BBB to have a static IP address; and using Power over Ethernet (PoE) with the BBB. By the end of this chapter you should appreciate the power of the BBB to leverage Linux software in order to build complex network‐attached devices, and you should be able to build your own IoT devices.

Learning Outcomes

After completing this chapter, you should be able to:

  • Interface to the Analog Devices TMP36 temperature sensor and to the Texas Instruments SensorTag using Bluetooth Smart.
  • Install and configure a web server on the BBB and use it to display static HTML content.
  • Enhance the web server to send dynamic web content that uses CGI scripts and PHP scripts to interface to BBB sensors.
  • Write the code for a C/C++ client application that can communicate using either HTTP or HTTPS.
  • Interface to platform as a service (PaaS) offerings, such as ThingSpeak and Xively, using HTTP and custom APIs.
  • Use the Linux cron scheduler to structure workflow on the BBB.
  • Send e‐mail messages directly from the BBB and utilize them as a trigger for web services such as IFTTT.
  • Build a C++ client/server application that can communicate at a high speed and a low overhead between any two TCP devices.
  • Manage remote BBB devices, using monitoring software and watchdog code, to ensure that deployed services are robust.
  • Configure the BBB to use Wi‐Fi adapters and static IP addresses, and wire the BBB to utilize Power over Ethernet (PoE).

Additional Materials

CGI using C++ on the BeagleBone (Ggicc)

In this chapter I describe how you can build web-based CGI applications that can interface with electronics hardware that is attached to the BeagleBone using Bash scripts that call C/C++ programs. The solution works well for very straightforward applications, but this linked discussion investigates more advanced solutions for applications where there are more complex interactions — for example, the use of web forms to pass data between your web browser and the application that is executing on the BeagleBone. In the linked blog discussion I begin by explaining how you can use a C/C++ program, rather than a CGI script, to display a web page. I then investigate the use of the GNU Cgicc library for more structured and complex interactions. All of the source code for this example is in the Exploring BeagleBone GitHub repository in the chp10/cgicc directory.

Products Described in the Chapter

A number of different Wi-Fi adapters are described in the chapter, such as those in the figure below. The widget on the left-hand side links to some of these adapters on Amazon (this should be localized to the Amazon in your region and not all adapters are available in all stores). However, not all of these adapters are confirmed to be working. The adapters that were evaluated in the book that are working well are:

  • The TP-LINK 300Mbps Wireless N Mini that uses the RTL8192CU chipset. Two alternatives are presented in this list: the Rosewill Wireless Adapter and the generic 300Mbps Realtek adapter, which both use the same chipset. The two alternatives have not been tested
  • The Edimax EW-7811Un that uses the RTL8188CUS chipset. It is listed along with two alternatives: the Wi-Pi Raspberry Pi adapter, and the Plugable USB 2.0 adapter, which both use the same chipset. The two alternatives have not been tested, but the Wi-Pi is known to work well.
  • The Asus USB-N10 adapter that uses the RTL8188SU chipset.

Digital Media Resources

Here the digital resources referred to in the chapter web page are provided. There are high-resolution versions of some of the important figures and links to videos, resources and websites that are described in the chapter.

Source Code

All of the source code that is described in this book is available in a public GitHub repository: Derek Molloy Exploring BeagleBone repository.

You can clone this repository on a Linux desktop computer or your BeagleBone using the command:

The code for this chapter can be accessed in the chp10 folder of the cloned repository. The formatted code for the client/server example is provided here for your convenience.

Some High-Resolution Figures from this Chapter

Here are high-resolution images of some of the more complex figures in this chapter, which may help you in wiring the circuits. Please note that you can close this pop-up window by pressing the Escape key.

External Resources

Important Documents

External Web Sites

The AM335x Technical Reference Manual (TRM)

The BeagleBone Black System Reference Manual (SRM)

Errata

  • Page 391. There should be a line echo “” after the line echo “Content-type: text/html” in the script that displayed in the center of the page. The code in the GitHub repository is correct.
  • Page 396. The title of code Listing 10-2 should be /exploringBB/chp10/WebBrowser/WebBrowser.c not WebClient/WebClient.c. The correct title is used in the description and elsewhere.

Recommended Books on the Content in this Chapter