Programming the BeagleBone
eBook - ePub

Programming the BeagleBone

  1. 180 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Programming the BeagleBone

Book details
Book preview
Table of contents
Citations

About This Book

Master BeagleBone programming by doing simple electronics and Internet of Things projectsAbout This Book• Quickly develop electronics projects that interact with Internet applications using JavaScript and Python• Learn about electronics components such as sensors and motors, and how to communicate with them by writing programs• A step-by-step guide to explore the exciting world of BeagleBone—from connecting BeagleBone to doing electronics projects and creating IoT applicationsWho This Book Is ForIf you want to learn programming on embedded systems with BeagleBone by doing simple electronics projects, this book is for you. This book is also helpful to BeagleBone owners who want to quickly implement small-scale home automation solutions. It is assumed that you have familiarity with C and Python programming. Some familiarity with electronics is helpful but not essential.What You Will Learn• Connect your BeagleBone to a computer in different ways and get the Cloud9 IDE running to quick-start programming on the BeagleBone• Get to know about BeagleBone extension pins such as GPIO and how to connect various electronics components with BeagleBone• Read and write to various electronics components such as LED, Push-button, sensors, and motors• Grasp in-depth theory on Analog, PWM, and BUS programming and the electronics components used in programs• Handle data to and from various BUS supporting modules such as UART, I2C, and SPI using the Adafruit BBIO Python library• Write real-life IoT applications in JavaScript and Python such as shooting an e-mail on overheat and controlling a servo motor remotely• Make use of online free cloud services to store and analyze sensor data collected on the BeagleBone• Discover what else can be done using the BeagleBone• Get to grips with embedded system BUS communicationIn DetailThe whole world is moving from desktop computers to smartphones and embedded systems. We are moving towards utilizing Internet of Things (IoT). An exponential rise in the demand for embedded systems and programming in the last few years is driving programmers to use embedded development boards such as Beaglebone.BeagleBone is an ultra-small, cost-effective computer that comes with a powerful hardware. It runs a full-fledged Debian Linux OS and provides numerous electronics solutions. BeagleBone is open source and comes with an Ethernet port, which allows you to deploy IoT projects without any additions to the board. It provides plenty of GPIO, Anlaog pins, and UART, I2C, SPI pins which makes it the right choice to perform electronics projects. This gives you all the benefits of Linux kernel such as multitasking, multiusers, and extensive device driver support. This allows you to do programming in many languages including high-level languages such as JavaScript and Python.This book aims to exploit the hardware and software capabilities of BeagleBone to create real-life electronics and IoT applications quickly. It is divided into two parts. The first part covers JavaScript programs. The second part provides electronics projects and IoT applications in Python.First, you will learn to use BeagleBone as tool to write useful applications on embedded systems. Starting with the basics needed to set up BeagleBone and the Cloud9 IDE, this book covers interfacing with various electronics components via simple programs. The electronics theory related to these components is then explained in depth before you use them in a program. Finally, the book helps you create some real-life IoT applications.Style and approachAn easy-to-follow guide full of real-world electronics programs and quick troubleshooting tips using BeagleBone. All the required electronics concepts are explained in detail before using them in a program and all programs are explained in depth. Most of the theory is covered in the first part; while the second part gives you some quick programs.

Frequently asked questions

Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Yes, you can access Programming the BeagleBone by Yogesh Chavan in PDF and/or ePUB format, as well as other popular books in Computer Science & Hardware. We have over one million books available in our catalogue for you to explore.

Information

Year
2016
ISBN
9781784399030
Edition
1

Programming the BeagleBone


Table of Contents

Programming the BeagleBone
Credits
About the Author
Acknowledgment
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Downloading the color images of this book
Errata
Piracy
Questions
1. Cloud9 IDE
BeagleBone hardware
BeagleBone White (BBW)
BeagleBone Black (BBB)
BeagleBone Green (BBG)
Installing Debian image on SD card
Setting up BeagleBone
Direct connection to monitor and keyboard
Ethernet over USB
Troubleshooting
Ethernet port or USB Wi-Fi adapter
Troubleshooting
VNC
Troubleshooting
Serial Connection
The bone101 page
Cloud9 IDE
Hello World program
Explanation
Summary
2. Blinking Onboard LEDs
Digital I/O
Digital I/O functions - pinMode() and digitalWrite()
Program to turn onboard LED ON and OFF
Program explanation
Quick program to blink onboard LED
Program explanation
Program execution
Make our program better
Program explanation
Dancing LEDs
Program explanation
Dancing LEDs in both directions
Program explanation
Summary
3. Blinking External LEDs
What is GPIO?
BeagleBone GPIO map
Blinking external LED circuit setup
Circuit analysis
Program to blink external LED
Explanation
Troubleshooting
Dancing external LEDs circuit setup
Circuit analysis
Program to dance external LEDs in both directions
Explanation
Summary
4. Controlling LED Using a Push Button
Reading from digital components
Push button circuit setup
Circuit analysis
Program to read from push button
Explanation
Reading via interrupts
Push button LED circuit setup
Circuit analysis
Program to control LED by push button
Explanation
Summary
5. Reading from Analog Sensors
Analog I/O
Reading from analog components
TMP36 temperature sensor circuit setup
Circuit analysis
Program to print temperature
Explanation
LDR circuit setup
Circuit analysis
Program to check light intensity
Explanation
Summary
6. PWM – Writing Analog Information
What is PWM?
BeagleBone's PWM
Writing on analog components
Fading LED circuit setup
Program to fade in and fade out LED
Explanation
Micro servo motor circuit setup
Program to control a micro servo motor
Explanation
Summary
7. Internet of Things with BeagleBone
Why the Internet of Things?
What is the Internet of Things?
Program for creating new Node.js HTTP server
HTML code
JavaScript code
Explanation
Troubleshooting
Program to control an LED through web browser
HTML code
Explanation
JavaScript code
Explanation
Controlling a servo motor through LAN
HTML code
JavaScript code
Sending an e-mail on over-temperature
Explanation
Troubleshooting
What's next?
Summary
8. Physical Computing in Python
Python programming in BeagleBone
Adafruit BBIO library
Program to blink external LEDs
Explanation
Program to dance external LEDs
Explanation
Program to read from push button
Explanation
Detecting button state using interrupt
Explanation
Program to print temperature
Explanation
A Program to check light intensity
Explanation
Program to fade in and fade out LED
Explanation
Program to control micro servo motor
Explanation
Summary
9. UART, I2C, and SPI Programming
Bus and bus protocols
What is UART?
Program to read/write on UART
Explanation
Troubleshooting
I2C protocol
Program to read from ADXL345 sensor
Explanation
Troubleshooting
SPI protocol
Program to write display text on Nokia 5110 LCD
Explanation
Summary
10. Internet of Things using Python
Flask web application framework
Installation
A program to display temperature remotely
Explanation
Troubleshooting
A program to control an LED through a web browser
Explanation
A RESTful web app to control servo motor
Explanation
A program to trigger an e-mail alert on over-temperature
Explanation
Troubleshooting
Upload server data on cloud and visualize
Explanation
What's next?
Security
Summary
A. GPIO Control in Bash
Explanation
Troubleshooting
B. BeagleBone Capes
C. Pinmux and the Device Tree
What is Pinmux?
What is the device tree?
Index

Programming the BeagleBone

Copyright © 2016 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: January 2016
Production reference: 1220116
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78439-001-3
www.packtpub.com
Cover image by Mr. Vipin Vikam (Silver photo studio, near Kasba Ganpati, Pune)

Credits

Author
Yogesh Chavan
Reviewers
Juan Cortez
Chris Desjardins
Michael Hirsch
Pavel Mamontov
Commissioning Editor
Amarabha Banerjee
Acquisition Editor
Kevin Colaco
Content Development Editor
Susmita Sabat
Technical Editor
Pranil Pathare
Copy Editor
Ting Baker
Project Coordinator
Milton Dsouza
Proofreader
Safis Editing
Indexer
Mariammal Chettiyar
Production Coordinator
Arvindkumar Gupta
Cover Work
Arvindkumar Gupta

About the Author

Yogesh Chavan is a Linux enthusiast and open source promoter, living in Pune, India. He has now been teaching operating systems, device drivers, and embedded systems in colleges and institutes for more than three years. These include the computer science department of Pune University, Symbiosis Institute of Computer Studies and Research (SICSR) college, and the Centre for Development of Advanced Computing (C-DAC) institute. He has about six years of experience in the software industry. His previous industrial role was of a software maintenance engineer at Red Hat Software Services.
Yogesh has overseen many engineering projects under GEEP (http://www.geeksofpune.in). He has given many talks at the annual open source event, GNUnify (http://gnunify.in).
Yogesh enjoys cutting edge technologies. He is a hardware hobbyist who likes playing with smartphones, tablets, routers, and Arduino. He is big fan of Android and various Linux distributions. He has compiled and modified kernel and firmwares for many phones and routers. He wishes to be a humble contributor to the open source world.

Acknowledgment

I would like to thank my wife fo...

Table of contents

  1. Programming the BeagleBone