Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
BeagleBone Home Automation Blueprints
BeagleBone Home Automation Blueprints

BeagleBone Home Automation Blueprints: Automate and control your home using the power of the BeagleBone Black with practical home automation projects

Arrow left icon
Profile Icon Rodolfo Giometti
Arrow right icon
€20.98 €29.99
eBook Feb 2016 378 pages 1st Edition
eBook
€20.98 €29.99
Paperback
€36.99
Subscription
Free Trial
Renews at €18.99p/m
Arrow left icon
Profile Icon Rodolfo Giometti
Arrow right icon
€20.98 €29.99
eBook Feb 2016 378 pages 1st Edition
eBook
€20.98 €29.99
Paperback
€36.99
Subscription
Free Trial
Renews at €18.99p/m
eBook
€20.98 €29.99
Paperback
€36.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

BeagleBone Home Automation Blueprints

Chapter 2. Ultrasonic Parking Assistant

In this chapter, we'll learn how to use the BeagleBone Black to implement a park assistant. We're going to use an ultrasonic sensor to detect the distance between our car and the garage wall, and some LEDs to give a feedback of the car position to the driver in order to avoid collisions.

We'll see how to set up the ultrasonic range sensor in two different manners, using different interfaces to get the data in order to resolve a problem in two different ways and obtain two different system configurations.

The basic of functioning

The project is really simple, even if it needs some electronic skills in order to manage the sensor output. Basically, our BeagleBone Black just needs to periodically poll the ultrasonic sensor output and then turn on the LEDs according to the distance from the wall: as level indicator lower is the distance and more LEDs are turned on.

Setting up the hardware

As just stated, in this project we're trying to implement two different setups: the first one uses the analog output of the ultrasonic sensor and implements a circuitry, where all the devices are directly connected with the BeagleBone Black (all peripherals are near the board); on the other hand, the second setup allows us to remotely manage the ultrasonic sensor by using an USB connection, so we can mount the sensor far from the BeagleBone Black board.

Simply speaking, we can put the sensor in one place while the LEDs are in a different location, maybe in a more visible position, as shown in the following image:

Setting up the hardware

As you can see, the dotted arrow, which represents the driver's point of view, is more clear if the LEDs are in a upper position with respect to the distance sensor that should be located near to the floor to better catch the car frontal.

First setup – all devices near the BeagleBone Black

In this setup, we're going to use an ADC pin of...

Setting up the software

In this project, the software is really simple, since we just need a procedure that periodically reads the distance and then turn on and off the LEDs accordingly; however, some issues must be pointed out, especially about how to manage the LEDs and the differences between the two setups of the ultrasonic sensor.

Managing the LEDs

Despite of what was presented in the previous chapter about the GPIO's management, it's important to point out that the Linux kernel has several kinds of devices, each one dedicated to a well-defined usage, and one of these special devices are the led devices, which is a particular type of devices that can be used to manage an LED with different triggers. A trigger is a sort of manager of the LED that can be programmed to work in a specific manner. Ok, it's better doing an example instead of trying to explain it!

First of all, we have to define the led devices by using a dedicated device tree as reported in the chapter_02/BB...

The distance monitor

Now it's time to see how our park assistant can work in practice. A possible implementation of the code is reported in the chapter_02/distance_mon.sh script in the book's example code repository. The following code snippet shows the main code:

# Ok, do the job
while sleep .1 ; do
   # Read the current distance from the sensor
   d=$($d_fun)
   dbg "d=$d"

   # Manage the LEDs
   leds_man $d
done

The functioning is simple—the code periodically reads the distance from the sensor by using the function pointed by the d_fun variable, and then turns the LEDs on and off, according to the value of the distance d (in cm) by using the leds_man function.

The d_fun variable holds the name of the function that should read the distance by using the ADC, that is, read_adc, or the name of the function that uses the serial port, that is, read_tty. The following are the two functions:

function read_adc () {
   n=$(cat $ADC_DEV)

   d=$(bc -l <<< &quot...

Final test

To test the prototype, we must first select one setup and perform the needed connections, as stated before. Then we have to turn on the board.

After the login, we must setup the system by using the commands discussed before, or simply by using the chapter_02/SYSINIT.sh command in the book's example code repository. Then, we must execute the distance_mon.sh command accordingly.

Note

Note that looking into the SYSINIT.sh file, you can read:

# Uncomment the following in case of buggy kernel in USB host management
# cat /dev/bus/usb/001/001 > /dev/null ; sleep 1

This is if after plugging in the USB cable, you get an error in recognizing the /dev/ttyUSB0 device.

To test my prototype using the first setup, I used the following command:

root@beaglebone:~# ./distance_mon.sh -d -k 1.38 adc
distance_mon.sh: d_fun=read_adc k=1.38
distance_mon.sh: d=176
distance_mon.sh: d=175
distance_mon.sh: d=175
distance_mon.sh: d=175
distance_mon.sh: d=175
...

On the other hand, to test the second one...

The basic of functioning


The project is really simple, even if it needs some electronic skills in order to manage the sensor output. Basically, our BeagleBone Black just needs to periodically poll the ultrasonic sensor output and then turn on the LEDs according to the distance from the wall: as level indicator lower is the distance and more LEDs are turned on.

Left arrow icon Right arrow icon

Key benefits

  • Build, set up, and develop your circuits via step-by-step tutorial of practical examples, from initial board setup to device driver management
  • Get access to several kinds of computer peripherals to monitor and control your domestic environment using this guide
  • This book is spread across 10 chapters all focused on one practical home automation project

Description

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.

Who is this book for?

This book is for developers who know how to use BeagleBone and are just above the “beginner” level. If you want to learn to use embedded machine learning capabilities, you should have some experience of creating simple home automation projects.

What you will learn

  • Build a CO (and other gas) sensor with a buzzer/LED alarm to signal high concentrations
  • Log environment data and plot it in a fancy manner
  • Develop a simple web interface with a LAMP platform
  • Prepare complex web interfaces in JavaScript and get to know how to stream video data from a webcam
  • Use APIs to get access to a Google Docs account or a WhatsApp/Facebook account to manage a home automation system
  • Add custom device drivers to manage an LED with different blinking frequencies
  • Discover how to work with electronic components to build small circuits
  • Use an NFS, temperature sensor, relays, and other peripherals to monitor and control your surroundings

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Feb 03, 2016
Length: 378 pages
Edition : 1st
Language : English
ISBN-13 : 9781783986033
Vendor :
BeagleBoard.org
Category :
Tools :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Feb 03, 2016
Length: 378 pages
Edition : 1st
Language : English
ISBN-13 : 9781783986033
Vendor :
BeagleBoard.org
Category :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
€189.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts
€264.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 66.98
Building a Home Security System with Raspberry Pi
€29.99
BeagleBone Home Automation Blueprints
€36.99
Total 66.98 Stars icon

Table of Contents

12 Chapters
1. Dangerous Gas Sensors Chevron down icon Chevron up icon
2. Ultrasonic Parking Assistant Chevron down icon Chevron up icon
3. Aquarium Monitor Chevron down icon Chevron up icon
4. Google Docs Weather Station Chevron down icon Chevron up icon
5. WhatsApp Laundry Room Monitor Chevron down icon Chevron up icon
6. Baby Room Sentinel Chevron down icon Chevron up icon
7. Facebook Plant Monitor Chevron down icon Chevron up icon
8. Intrusion Detection System Chevron down icon Chevron up icon
9. Twitter Access Control System with Smart Card and RFID Chevron down icon Chevron up icon
10. A Lights Manager with a TV Remote Controller Chevron down icon Chevron up icon
11. A Wireless Home Controller with Z-Wave Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.