Reader small image

You're reading from  BeagleBone Home Automation Blueprints

Product typeBook
Published inFeb 2016
Publisher
ISBN-139781783986026
Edition1st Edition
Right arrow
Author (1)
Rodolfo Giometti
Rodolfo Giometti
author image
Rodolfo Giometti

Rodolfo Giometti is an engineer, IT specialist, GNU/Linux expert and software libre evangelist. He is the author of the books BeagleBone Essentials, BeagleBone Home Automation Blueprints and GNU/Linux Rapid Embedded Programming by Packt Publishing and maintainer of the LinuxPPS projects. He still actively contributes to the Linux source code with several patches and new device drivers for industrial applications devices. During his 20+ years of experience, he has worked on the x86, ARM, MIPS, and PowerPC-based platforms. Now, he is the co-chief at HCE Engineering S.r.l., where he designs new hardware and software systems for the quick prototyping in industry environment, control automation, and remote monitoring.
Read more about Rodolfo Giometti

Right arrow

Chapter 6. Baby Room Sentinel

In this chapter, we're going to show a possible implementation of a baby room sentinel capable of monitoring the room by detecting whether our baby is crying or if the baby is breathing during sleep. Also, as a special feature, the system will be able to measure the baby's temperature with a contactless temperature sensor.

We'll see several kinds of sensor, such as pressure, sound, and temperature. Also, regarding the temperature sensors, we'll see an interesting infrared version that is useful to measure surface temperature without touching it. Additionally, we'll provide our prototype of a nice, tiny LCD screen in order to see what's going on in the baby's room.

The basics of functioning


When we have a baby, it's quite normal to buy different devices to check when the baby cries or has a fever, or if the baby is still breathing during sleep. So, in this chapter, we'll try to implement several smart sensors to detect these states of danger using our BeagleBone Black and some special sensors.

Tip

Warning! Let me remind that this project is a prototype and it cannot be used as a personal safety application! It's simply a study of a possible implementation of a baby room sentinel device.

Neither the author of this book nor Packt Publishing recommends or endorses that this product be used alone or as a component in any personal safety applications. The reader is warned about the fact that these sensors and controls do not include the self-checking redundant circuitry needed for such use.

Neither the author of this book nor Packt Publishing will be held liable for unauthorized use of this prototype. The users can use this device at their own risk!

To detect...

Setting up the hardware


In this project, we are going to use two analog sensors, a digital sensor, and a tiny LCD to implement a little GUI. The analog sensors are connected to two different ADCs, while the digital sensor (the contactless temperature sensor) uses an I2C bus to communicate with the BeagleBone Black. Lastly, the tiny LCD is connected to our BeagleBone Black board by an SPI bus and some GPIOs.

Regarding the alarm devices to alert the parents, we can use a normal buzzer or a more sophisticated SMS gateway, or both. But in any case, the connections of these devices can be retrieved from the preceding chapters, so, due to lack of space, I'm not going to add any of them in this chapter. The reader can try to implement both the hardware and software by themselves as an exercise.

Setting up the contactless temperature sensor

The contactless temperature sensor used in this prototype is shown in the following screenshot:

Note

The devices can be purchased from http://www.cosino.io/product...

Setting up the software


In this project, we're going to show a trick to exchange data between two processes in a very simple manner. At the beginning of the chapter, it was mentioned that the ADCs must be sampled at 100Hz, but we don't need to be so fast to render a simple interface on the external LCD. In fact, a reasonable updating frequency for the user interface can be 1Hz (once per second.) So, to keep the code simple, we implement our device by using two different processes running at different frequencies that exchange data with each other instead of using a single process.

Simply speaking, if we realize a program called adc that reads the data from the ADCs at 100Hz and then prints its output on the stdout stream (standard output) at 1Hz, we can redirect such output to another program called lcd.sh that reads the data from its stdin stream (standard input) at 1Hz and then draws the user interface accordingly.

The data flow is unidirectional. Program adc reads data from the ADC and...

Final test


To test the prototype, I used some tricks to simulate the baby: I got the crying sound on the Internet and simply reproduced it with an audio player. Regarding the breath, I used doll, manually pressurizing its chest in time with my breathing. I admit it's not the best test, but my children are too big to help me in these experiments!

To set up all peripherals and drivers, we can use SYSINIT.sh, as in the following command:

root@beaglebone:~# ./SYSINIT.sh
done!

Note

This command can be found in the chapter_06/SYSINIT.sh file in the book's example code repository.

Then, I executed both the adc and lcd.sh programs by using the following command line in order to send all outputs to the terminal that runs on the tiny LCD:

root@beaglebone:~# ./adc | ./lcd.sh > /dev/tty0

Tip

Note that on the first framebuffer device, we have at least one terminal defined by default, which is referred to by the /dev/tty0 device.

Summary


In this chapter, we discovered a more reliable and precise way to get access to the BeagleBone Black's ADCs and learned how we can get access to an I2C device by using a raw access to the bus. This was done in order to be able to manage a pressure sensor and a contactless temperature sensor. Also, we discovered how to connect a tiny LCD via the SPI bus to our BeagleBone Black board to add a little user interface.

In the next chapter, we'll try to implement a plant monitor to measure what happens to our beloved plants! Also, we will discover how we can periodically take some pictures and then publish them on a Facebook account.

lock icon
The rest of the chapter is locked
You have been reading a chapter from
BeagleBone Home Automation Blueprints
Published in: Feb 2016Publisher: ISBN-13: 9781783986026
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime

Author (1)

author image
Rodolfo Giometti

Rodolfo Giometti is an engineer, IT specialist, GNU/Linux expert and software libre evangelist. He is the author of the books BeagleBone Essentials, BeagleBone Home Automation Blueprints and GNU/Linux Rapid Embedded Programming by Packt Publishing and maintainer of the LinuxPPS projects. He still actively contributes to the Linux source code with several patches and new device drivers for industrial applications devices. During his 20+ years of experience, he has worked on the x86, ARM, MIPS, and PowerPC-based platforms. Now, he is the co-chief at HCE Engineering S.r.l., where he designs new hardware and software systems for the quick prototyping in industry environment, control automation, and remote monitoring.
Read more about Rodolfo Giometti