Book Image

BeagleBone Home Automation Blueprints

By : Rodolfo Giometti
Book Image

BeagleBone Home Automation Blueprints

By: Rodolfo Giometti

Overview of this book

BeagleBone is a microboard PC that runs Linux. It can connect to the Internet and can run OSes such as Android and Ubuntu. BeagleBone is used for a variety of different purposes and projects, from simple projects such as building a thermostat to more advanced ones such as home security systems. Packed with real-world examples, this book will provide you with examples of how to connect several sensors and an actuator to the BeagleBone Black. You’ll learn how to give access to them, in order to realize simple-to-complex monitoring and controlling systems that will help you take control of the house. You will also find software examples of implementing web interfaces using the classical PHP/HTML pair with JavaScript, using complex APIs to interact with a Google Docs account, WhatsApp, or Facebook. This guide is an invaluable tutorial if you are planning to use a BeagleBone Black in a home automation project.
Table of Contents (18 chapters)
BeagleBone Home Automation Blueprints
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

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...