This Development Board based on a 32-bit ARM processor has some very interesting features for the electronic developer and is the next step after being limited in many respects with the use of 8 bits microcontrollers such those commonly used in the Arduino environment.
One of the aspects that I will try to develop is real-time video processing, with the idea of implementing robotic systems that make use of possibilities provided by computer vision for interacting with the environment.
The board features a 32-bit processor ARM Cortex-A8 developed by Texas Instruments, specifically the Sitara AM3358BZCZ100 1GHz whose specifications can be found here.
It's a very complete chip that includes among other features:
- NEON floating-point coprocessor.
- SGX530 3D graphics acceleration hardware.
- PRUs 2 (programmable real - time units) of 32 bit/200 MHz (independent microcontrollers).
- Driver LCD / touch screen of 24-bit.
- DDR, DDR2, DDR3 memory interface.
- Serial: 6 x UART, 2 x SPI, 3 x I2C, 2 x CAN, 2 x USB 2.0, 2 x Ethernet 10/100/1000 Mbps.
- audio ports: 2 x McASP (multi-channel audio serial ports).
- 8x 12-bit analog inputs.
- parallel ports: MMC and SD.
- 3 high-resolution PWM modules.
- 3 inputs optionally capture 32-bit configurable as additional PWM outputs.
- multitude of general purpose Input/Ouput (GPIOs).
There are versions in 298-pin and 324-pin PBGA packages.
On one hand we have the RAM as in PCs, where it is temporarily stored data and executable code, being the speed of access one of the most important parameter. The Beaglebone Black incorporates 512MB of DDR3 memory at 800MHz.
On the other side, analogously to the hard drive of the PC, we have 4 GB permanent storage in the form of flash memory under the MMC standard (multimedia card), what is known as eMMCs or embedded MMC. In other words, we have a 4GB "solid state hard drive". In addition, as according to stuff 4 GB may not be enough, the board incorporates microSD card reader, being able to use higher-capacity cards, high speed being recommended. I use a 32GB class 10 card.
Communication with the outside world takes place through:
-One USB 2.0 Host port, similar to the one of the PCs. To connect keyboard, mouse, webcam..., being necessary the use of a Hub or concentrator to dispose of more than one port.
-One port USB 2.0 client. To connect to a PC as a storage unit, having access to the contents of the file system, but it is also possible to set an IP connection via USB to access via html or even ssh.
-RJ-45 Ethernet connector to connect the Beaglebone to our home network and thus access via ssh, ftp, etc.
-MicroHDMI connector.The HDMI frammer installed on board allows you to use any monitor, LCD or plasma .
-2 x 46 pins expansion connectors (2 x 23 pins each), with access to all the functions of the Board. There are on the market different expansion cards or "capes" (because of its similarity to the clothes) which are inserted into these conectors. We will use this way to connect sensors and actuators or other hardware systems.
Unlike the classic Arduino, running a single program in the absence of operating system (although the Bootloader allowing programming via USB also is executable code to take into account...), the Beagleone is perfectly capable of running a full OS, for example Linux (Debian, Ubuntu...) under which will run applications compiled for that particular system , being the most used programming languages the traditional C / C++, associated with the UNIX environment since ancient times (computationally speaking), as well as the more modern and simplified Python.
Board comes from factory with a Linux distribution already installed on the embedded flash memory (eMMC). Depending on the revision of this (currently C review) the distro of Linux will be Angstrom or Debian on more recent boards. Mine brought Debian 7 (Wheezy), although Debian 8.2 (Jessie) is now available.
It is not difficult to download from the internet and install a Linux distribution on the external microSD from "pre-built" images and can be performed from a PC or Mac or, better still, from the Beaglebone itself. Not all the Linux flavors are available for the ARM architecture, although Yes it is, for example, the popular Ubuntu (currently Ubuntu 14.04).
If the image that we have installed does not have graphic interface or "Desktop", which is normal, we can install (via apt-get) a low-weight one as lxde and we will have a machine running Linux better than some PCs...
There are different ways to access and control the different input/output lines available in expansion connectors. We have general purpose input/outputs or GPIOs and a series of pins assigned to devices such as ports, i2c, spi, uart, PWM and analog inputs, as well as the lines of the hdmi interface to control a LCD.
One of the difficulties arising, as you can see in the documentation available at elinux.org, is that the same pins are used for different purposes, since, otherwise, the expansion connectors should have a huge number of lines. It's known as multiplexed I/O lines and is using software as determines the function that will have a particular pin. We can write and compile an overlay that update at run time the device tree or Device Tree Overlay, using dtc to generate a .dtbo file that we will export with capemgr creating a new slot, if it sounds rather complicated, although not so much.
With the use of the AdafruitBBIO library for python we do not have to worry at all of the above, although in order to properly working we must have a kernel that supports cape manager, since the library makes use of this feature to assign the PIN you want to use. The installation process is pretty well documented on the Adafruit website. Once installed it allows access from python to different I/O such as uart, i2c, spi, pwm, adc devices, as well as to the different pins configured as GPIOs.
OpenCV and Python
OpenCV libraries are a collection of functions written to allow the manipulation of images and videos in real time in a simple way. There is an old version "cv" and a more current "cv2" with versions for c/c++ and Python, as powerful as the previous but with a much more developer-friendly language syntax.
We can install these libraries using "sudo apt-get install" for the following packages:
build-essential libavformat-dev ffmpeg libcv2.3 libcvaux2.3 libhighgui2.3 python-opencv opencv-doc libcv-dev libcvaux-dev libhighgui-dev python-numpy
rgb-hsv.py: Although the more common way to save a digital color image is the RGB format, where each pixel is encoded in 3 bytes which keep the quantified amount of each primary color (red, green and blue) in a value between zero (Nothing) and 255 (maximum), what is known as RGB color space, is difficult to detect a particular color by working in this way Since, for example, a high value of Green does not necessarily imply that the color is green, but that depends largely on the amounts of blue and Red (if both are very small color will be green).
So to detect objects by their color, it is much more practical work in the HSV (Hue, Saturation, Volume) color space. The value of Hue or tone is what determines the color (just knowing this value we know what color it is), saturation is the intensity of color and volume gives us its luminosity.
Rgb-hsv.py program allows us to choose a color by moving the RGB bars and automatically see which position of the HSV bars corresponds to the selected color. We can also modify the HSV values and see the effect in RGB space. This program has been one of the first things I've written in python with opencv and seems very practical to help understand the relationship between two color spaces.
Copyright © All Rights Reserved