Book Image

Programming the BeagleBone

By : Yogesh Chavan, Amit Pandurang Karpe
Book Image

Programming the BeagleBone

By: Yogesh Chavan, Amit Pandurang Karpe

Overview of this book

The 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.
Table of Contents (21 chapters)
Programming the BeagleBone
Credits
About the Author
Acknowledgment
About the Reviewers
www.PacktPub.com
Preface
BeagleBone Capes
Index

BeagleBone hardware


The BeagleBoard foundation is a non-profit corporation promoting open source hardware and software. It has been releasing low power, hacker-friendly embedded boards since 2008. They have created a few powerful and educational single board computers. These boards are sold to the public under the Creative Commons share-alike license that encourages sharing. These boards are collectively called BeagleBoards. They have a GitHub page at https://github.com/beagleboard. Here you can find hardware information files and software related to released boards. Support for these boards comes from a very active developer community. The BeagleBoard group on Google has more than 10,000 members. You can view posts and join the group here: http://beagleboard.org/Community/Forums. Their IRC (Internet Relay Chat) channel #beagle on freenode is active. You can join the channel and ask questions at http://beagleboard.org/chat. There are more than 500 different projects registered with BeagleBoard at http://beagleboard.org/project.

There are two different series of released boards by beagleboard.org. First is the BeagleBoard series. This series has candidates—original BeagleBoard, BeagleBoard-xM and BeagleBoard-X15. These are comparatively big, square-sized boards. Their processors are slightly better in terms of performance and have an additional DSP (Digital Signal Processor) that can do better audio/video processing. These boards have many peripherals available onboard. They are more powerful and comparatively costly. These boards are perfect in scenarios where major audio/video processing is involved or performance is important.

Another series is called the BeagleBone series. This series has candidates—BeagleBone White, BeagleBone Black, BeagleBone Green. These boards are compact, lightweight and share the same physical size (3.4 inch × 2.1 inch). They all have the same Texas Instruments AM335x sitara ARM Cortex-A8 processor. These boards lack DSP and lag behind in scenarios with major audio/video processing. But these processors are fine in other scenarios. They come with fewer peripherals on board. You can attach many peripherals externally. They are far cheaper than boards in the BeagleBoard series. They provide many expansion i/o pins of type GPIO/I2C/SPI/PWM/UART/CAN/ADC. So you can connect lots of sensors, modules, electronic components, displays, and so on. to these boards. All these boards share the same expansion pins layout. This means if you study expansion of one board in the series, the knowledge applies to other boards in the series too. There are small differences in these boards. Please refer to the following table to learn the differences. All these characteristics make BeagleBone a popular choice among hardware hackers. Besides hardware, they can all boot up from the same firmware image. So all software stack is the same for them. These boards can be programmed using the same programming interface. All these boards come with preinstalled Cloud9 IDE, which allows you to write and deploy applications on that board in many programming languages remotely via web browser.

This book covers programming all boards in the BeagleBone series:

 

BeagleBone White

BeagleBone Black

BeagleBone Green

Processor

720MHzARM CortexA8

1GHz ARMCortex-A8

1GHz ARMCortex-A8

RAM

256MB DDR2

512MB DDR3

512MB DDR3

Storage

microSD slot only

2/4GB emmc, microSD slot

4GB emmc, microSD slot

Display/Audio

possible via external cape or USB port

onboard micoHDMI

possible via external cape or USB port

Power connector

via MiniUSB or 5.5mm DC jack(5V)

via MiniUSB or 5.5mm DC jack(5V)

Micro USB only

Boot debugging

onboard serial and JTAG via MiniUSB

via external USB-serial to header pins

via external USB-serial to header pins

Other connector

one standard 2.0 USB host port, one MiniUSB client port, one Ethernet port

One standard 2.0 USBhost port, one MiniUSB client port, one Ethernet port

one UART and one I2C grove connector, one standard 2.0 USB host, one Micro USB client port, one Ethernet port

Expansion

2x 46pin i/o expansion header

2x 46pin i/o expansion header

2x 46pin i/o expansion header

Comparison between different BeagleBones

BeagleBone White (BBW)

This is the first board released in the BeagleBone series. It was released at the end of 2011. At that time, it was just called BeagleBone. Now after more boards have been released in this series, it is called Original BeagleBone or BeagleBone White (BBW). BBW brought single cable development environment. One MiniUSB cable from PC to BBW gives power to BBW, access to storage of BBW and network-over-USB capabilities for communication. The same cable also gives serial access and JTAG access for debugging via FTDI chip. For more information about BeagleBone White, visit the following links:

The BeagleBone Black board is shown in the following image:

BeagleBone Black (BBB)

BeagleBone Black was released in April 2013. It arrived with more processor speed, more RAM, onboard storage and Micro HDMI connectivity for a lesser price than BBW. BeagleBone Black was very cost-effective and became a huge success. It ranked second consecutively for 2014 and 2015 in a survey of the most popular single board computers conducted by Linux gizmos. BeagleBone Black does not have JTAG access via USB like BBW. You can get serial access via a USB port by help of USB-serial driver in BeagleBone Black only after the board boots. It has a serial pins header. A special USB-serial cable is needed to get serial access via this header to get boot time serial access. Like BBW, single MiniUSB cable from the PC is sufficient to give power to BBB, access to storage of BBB and network-over-USB capabilities for communication. For more information about BeagleBone Black, visit the following links:

BeagleBone Green (BBG)

Because BeagleBone is an open-source hardware design, anyone can modify design and create a BeagleBone clone (similar to Arduino). BeagleBone Green is a modified version of BeagleBone Black released in October 2015 by SeeedStudio. BeagleBone Green is even cheaper than BeagleBone Black. They removed the Micro HDMI and DC barrel jack. They replaced MiniUSB port with a more common Micro USB port. Internally they are just the same. Two grove connectors are included, which makes it easier to connect a large family of grove sensors and grove modules. For more information about BeagleBone Green, visit the following links:

Note

It is important to note that throughout this book we will use the word BeagleBone to represent any board (BBW or BBB or BBG) in the BeagleBone series. So BeagleBone setup steps in the book should work for BeagleBone White as well as BeagleBone Black as well as BeagleBone Green.