The Raspberry Pi has made a significant contribution to the electronics industry over the past year since its launch. Originally positioned as a low-cost computer designed for educational use, it has quickly broadened its appeal into the mainstream electronics market as a prototyping and evaluation platform for professional engineers. In addition to being used for teaching computing, the Pi has a large following of electronics enthusiasts and hobbyists, the like of which has not been seen for a very long time. Given the “buzz” that the Pi has generated, it would be easy to think that nothing similar has been available in the past. However, boards like Arduino have been around for a long time and have a huge user following with a strong community of web-based programming resources to aid development. There are, of course, some fundamental differences between the two boards. The Arduino uses an 8-bit Atmel AVR microcontroller and provides adequate IO to connect with real world applications in addition to an extremely simple-to-use integrated development environment (IDE). Arduino provides an ideal base from which to learn, not only embedded microcontroller programming using a C-like language, but basic electronics. By contrast, the Raspberry Pi uses a 32-bit ARM®-based SoC and has been focused more at teaching the basics of high-level computing languages and operating systems such as Linux in schools and other higher educational establishments. Linux support is available on a plethora of embedded development boards and provides many advantages over less powerful 8-bit boards. It also brings the ability to share the processor between multiple running programs and tasks. One Linux-based example is the BeagleBoard-XM, a truly open-source development board with the support of Texas Instruments. However, it is the latest Linux development board to come out of Texas Instruments that is creating significant interest. The BeagleBone Black, launched in April 2013, is seen as a serious competitor to the Raspberry Pi. It combines not only an ideal platform from which to learn Linux computing, but also to learn basic electronics by interfacing and interacting with real-world applications. The BeagleBone format, initially launched in late 2011, not only manages to squeeze in most of the capabilities of the BeagleBoard-XM into a smaller credit card-sized package, but also has established a standard footprint of two dual-row 46-pin connectors for a series of daughter-board expansion modules called “Capes”. Similar to the “Shields” used with Arduino, they provide for a variety of plug-in boards to add even more advanced I/O.
Figure 1: BeagleBone Black – layout of major components.
The BeagleBone Black features a TI Sitara™ AM3359 ARM Cortex™-A8 microprocessor running at 1 GHz (2000 DMIPS), compared to a 720 MHz device on the Raspberry Pi. Most notable is that the Black has 2 GB of on-board flash memory in addition to 512 MB of DDR3 at 400 MHz. A micro D-type HDMI connector, Ethernet and USB ports are included and the board is powered by a single 5 VDC supply. The board can also be USB-powered since it only consumes up to 250 mA.
From the software perspective, the Black comes pre-loaded with a host of software and is ready to boot. Just connect power, HDMI, Ethernet, and a USB keyboard/mouse and the board boots the Angstrom Linux distribution after which the Gnome desktop appears. During the boot process the set of 4 user LEDs (USR0 – 3) will reassuringly flash to indicate activity. With a choice of three supplied browsers, Chromium, Firefox, and Epiphany, you can be surfing the Internet within seconds. There is no need to add a flash SD card and juggle with downloading the distribution before you can run up the board for the first time as required by the Raspberry Pi. While for most developers and enthusiasts Angstrom Linux will suit, the Black can also run Ubuntu or Android thanks to the ARM v7 architecture used in the Cortex-A8-based device. Another aspect of using Linux on a development board is the additional connectivity offered with an Ethernet interface. So the use of FTP, SSH, Telnet, and other remote access services provide flexibility of connections in addition to the ability to connect to the Black’s own web server.
Figure 2: BeagleBone Black block diagram.
In terms of development tools, the Black is also well appointed. A Python interpreter and C/C++ complier are preloaded along with a local replica of the Cloud9 IDE preconfigured to run Node.js. Also included is the Bonescript library, based on Node.js, which provides a number of Arduino-like functions for interfacing with the hardware. Readers familiar with Arduino’s ‘digitalWrite’ function will feel immediately at home with this and similar functions included within Bonescript. The beagleboard.org community resource also serves as a useful repository of example projects, helpful forums, and hardware/software documentation.
Figure 3: BeagleBone Black GPIO pinout.
It is with these tools, and the capability to use its extensive GPIO, that the Black clearly becomes an ideal platform for use in IT education and learning basic electronics. The BeagleBone Black has a total of 92 accessible pins via the two dual-row headers P8 and P9. Far in excess of the GPIO available on Arduino or Raspberry Pi, these headers also form the connections to the expansion capes. The pins can have many different possible functions, from controlling IO, reading sensors, operating relays, and driving LEDs. Available from a variety of third party suppliers, capes provide everything from a simple bread-boarding area, an LCD screen, through to a comprehensive cape used to control underwater vehicle projects. The community site beagebonecapes.com, provided by CircuitCo, the manufacturer of the BeagleBone Black, maintains a list of compatible capes that have been tested and found to be fully compliant. Technically, up to 4 capes can be stacked on top of each other so long as there are no conflicts in GPIO usage. Also, it should be noted that the GPIO has several ways of being set up, or multiplexed. Different operating systems may operate the GPIO using a different mode. The default multiplex mode using Angstrom Linux is mode 7. The Linux signal name for a specific pin is not the same as the pin number marked on the board.
By far the easiest way of experimenting with this GPIO is to use the Cloud9 IDE. Cloud9 automatically starts at boot time and is accessed using the Black’s own web server. The Epiphany browser appears to find the IDE automatically on start, but any browser can be pointed to port 3000 of the BeagleBone Black's IP address. While similar to using Arduino’s IDE, the difference is that there is no need to upload the code to the board; it is automatically stored within the file system. The Black’s own web server provides a convenient set of pages that also gives you access to the Cloud9 IDE and some simple Bonescript code examples that can be run interactively with the board.
Figure 4: Cloud9 integrated development environment.
Figure 5: ‘blinked.js’ code example.
The GPIO can also be directly addressed from within the Linux operating system. This could be done directly on the board or by remotely connecting over SSH. Firstly, this requires the correct Linux signal name to be identified with a specific GPIO pin, and secondly, to have a reasonable knowledge of working at a Linux command-line level. Each GPIO pin will have a directory named with the Linux signal name within the /sys/class parent when it is in use. It is in this way that potential signal/GPIO conflicts can be spotted when one or more capes are being used. Connector P8 - pin 16 is identified as GPIO46 (see Figure 6). In the screen grab you can see that a gpio46 directory does not exist, so the signal is available for use. When driving an LED connected to the pin, by writing a 1-to-Linux value file you can turn it on or off with a 0. After use, do not forget to ‘unexport’ the directory to clear the use of the pin. These shell commands can also be incorporated into Python instructions.
Figure 6: Example commands over SSH to control a GPIO pin.
Whether you are an experienced embedded developer looking to speed your new project by using a well-documented and open-source platform, or an electronics enthusiast looking to have some fun, the BeagleBone Black provides an excellent choice on which to base your designs.