The Beagle robot can be now controlled with a Joystick remotely from a PC via a wireless connection (either Wifi or 3G) and stream a live video from the camera:

This slideshow requires JavaScript.

here a live video :

I succeed in getting Arduino controlled from a PC using a Joystick ūüôā

I used python game module for that. The code right now is dirty so I’ll have first to clean it up then I’ll share it.

The next step will be to control the Beagleboard + Arduino Robot via a wireless connection.

Arduino-Beagle Robot

I’m building a robot by using the Beagleboard-xm as a control unit running software for¬† high-level functionalities such as:

  • Artificial intelligence
  • Image and video processing
  • Wireless connectivity
  • USB/Serial communication

On the other hand, Arduino implements low-level functions such as:

  • Motor control
  • Sensor interface

Here are the first pictures:

Details coming soon …

In this post I’ll show how to establish a¬†serial communication (over USB) between the BeagleBoard and Arduino using a Java program. The Program will¬† send commands from BB-XM to toggle a LED on the Arduino.

Hardware components:

Arduino Set Up
Before begin interfacing BeagleBoard with Arduino, you must have the Arduino IDE installed and configured. Once it is done, upload the following sketch from your PC:

void setup(){

pinMode(13, OUTPUT);


void loop (){

if (Serial.available()) {

//read serial as ascii integer
int ser = Serial.read();

//The ascii equivalent of numbers 0-9 are 48-57
if(ser >= 48 && ser <= 57) {
   int xTimes = ser - 48;
   Serial.print("Blink LED x");


void TooglePin(int pin,int n){

   for (int i = 0; i < n; i++) {
   digitalWrite(pin, HIGH);
   digitalWrite(pin, LOW);

This sketch will basically set Arduino to read incoming serial data as ascii
integer, if it’s between 0-9 then the pin 13 (LED) is toogled xTimes (incoming command).

BeagleBoard Set Up
For the Software Angstrom Linux will be used, the default kernel has support for tty ACM devices (Arduino) if not you can use opkg to install the kernel module:

opkg install kernel-module-cdc-acm

when Arduino is attached to the Beagleboard, something like that should be displayed:

[ 7963.286163] usb 2-2.4: new full speed USB device using ehci-omap and address 16
[ 7963.417602] usb 2-2.4: New USB device found, idVendor=2341, idProduct=0043
[ 7963.425354] usb 2-2.4: New USB device strings: Mfr=1, Product=2, SerialNumber=220
[ 7963.433959] usb 2-2.4: Manufacturer: Arduino (www.arduino.cc)
[ 7963.439788] usb 2-2.4: SerialNumber: 7493430303035111E150
[ 7963.459197] cdc_acm 2-2.4:1.0: ttyACM0: USB ACM device

Not so well known but the full Java Standard Edition can run on the BeagleBoard, luckily it is available in the Angstrom package feed.
you need to install for that the openjdk-6 java runtime environment on the BeagleBoard:

opkg install openjdk-6-jre

For Java serial communication the RxTx library is needed:

opkg install librxtx-java librxtx-jni

Now the BeagleBoard is ready to talk to Arduino using Java:


import gnu.io.CommPort;
import gnu.io.CommPortIdentifier;
import gnu.io.SerialPort;

import java.io.FileDescriptor;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

public class SerialComm
/** Milliseconds to block while waiting for port open */
private static final int TIME_OUT = 2000;

/** Default bits per second for COM port. */
private static final int DATA_RATE = 9600;

public SerialComm()

void connect ( String portName ) throws Exception
CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(portName);
if ( portIdentifier.isCurrentlyOwned() )
System.out.println("Error: Port is currently in use");
CommPort commPort = portIdentifier.open(this.getClass().getName(),TIME_OUT);

if ( commPort instanceof SerialPort )
SerialPort serialPort = (SerialPort) commPort;

InputStream in = serialPort.getInputStream();
OutputStream out = serialPort.getOutputStream();

(new Thread(new SerialReader(in))).start();
(new Thread(new SerialWriter(out))).start();

System.out.println("Error: Only serial ports are handled by this example.");

/** */
public static class SerialReader implements Runnable
InputStream in;

public SerialReader ( InputStream in )
this.in = in;

public void run ()
byte[] buffer = new byte[1024];
int len = -1;
while ( ( len = this.in.read(buffer)) > -1 )
System.out.print(new String(buffer,0,len));
catch ( IOException e )

/** */
public static class SerialWriter implements Runnable
OutputStream out;

public SerialWriter ( OutputStream out )
this.out = out;

public void run ()
int c = 0;
while ( ( c = System.in.read()) > -1 )
catch ( IOException e )

public static void main ( String[] args )
(new SerialComm()).connect(args[0]);
catch ( Exception e )
// TODO Auto-generated catch block

This simple code open a serial connection and then interact with it (receiving and sending data).
To be compiled on a Host PC (with an installed JDK) using:

javac SerialComm.java

The compiled classes need to be transferred on the BeagleBoard file system then can be started with:

root@beagleboard:~# java -cp .:/usr/share/java/RXTXcomm.jar \
-Djava.library.path=/lib:/usr/lib/jni \
-Dgnu.io.rxtx.SerialPorts=/dev/ttyACM0 \
SerialComm /dev/ttyACM0

The Java program need to be supplied with the Serial port name /dev/ttyACM0 as an argument. Now you can blink the LED from the Beagle by simply writing on the console numbers between 0-9 :

In this post , I’ll describe¬† a practical use of the Beagleboard :¬† It’s about building a Wireless IP camera for Home surveillance.

Hardware components:

This slideshow requires JavaScript.

The Set-up of the Wi-Fi dongle and the camera were described in previous posts on this blog.

For the Software I used Angstrom Linux and  MJPG-Streamer which is not available as an Angstrom package but I had to build it manually for the Beagleboard:

First checkout the source from the Subversion repository :

svn co https://mjpg-streamer.svn.sourceforge.net/svnroot/mjpg-streamer mjpg-streamer

then cross compile it by issuing :

cd  mjpg-streamer/mjpg-streamer &&
make CC=arm-angstrom-linux-gnueabi-gcc

If the build is successful it will generate “mjpg_streamer” binary and¬† plugins : a set of shared libraries (*.so)
that you need to transfert to the¬† filesystem of the SDCard¬† plus the “www” folder.

Finally  you can lunch the mjpg-streamer webserver with :

./mjpg_streamer -i "./input_uvc.so -d /dev/video0 -y" -o "./output_http.so -w ./www"

(or put it in a script that start automatically)

The mjpg-streamer is listening on the TCP PORT 8080 so you’ll able to view the video stream by pointing any¬† browser on the beagleboard IP address:


you can also configure your router to allow external access from the Internet on your video stream by enable 8080 port  forwarding.

Here is a live demo video (view from my balcony):

and here is a nightly stream demo:

I just made the first steps to make Android ICS working with the ULCD7 ūüôā

I’ll write a how-to and publish the patches as soon as I have finished.

here are the first pictures:

Recently I bought a LI-LBCM3M1 camera from Leopard Imaging, a module specially designed to work with BeagleBoard.

The module main features are :

  • CMOS Sensor MT9T111 from Aptina
  • 2048 x 1536 (3M) pixels resolution
  • Output Data Format: YUV ( YCbCr)
  • Focal Length: f=3.78+ /-0.1 mm, F2.8+ /-5%
  • Vertical View Angle : 61.40
  • Focus Distance : 120cm +/-2cm
  • Focus Range : 60cm to Infinity

Here are some pictures:

The advantage of using this kind of cameras compared to a USB Web-cam is the speed:

The Camera module from LI is directly connected to the Camera Image Signal Processing (ISP) interface on DM3730 (Beagle Board CPU) and thus, data from camera module can be processed much  faster than an USB camera.

The other good news is that this camera is supported in the Angstrom Linux Kernel, however only in the 2.6.32 version. The camera patches can be found here.

To enable the camera support you need an U-Boot¬† that contains I2C lines initialisation pull-ups (I’m using u-boot version 2011.09-r4)¬† and include the camera name in the U-Boot environment variables (uEnv.txt) :

dvimode="hd720 omapfb.vram=0:8M,1:4M,2:4M"

For the kernel (omap-psp-2.6.32) make sure that the mt9t112 driver module is enabled :

Device Drivers ->

Mutimedia support ->

Video capture adapters ->

Encoders/decoders and other helper chips ->

<M> mt9t112 support

If everything went ok you should see something like that in your kernel traces (dmesg):

mt9t112 2-003c: mt9t111 chip ID 2680

and the  /dev/video0 node should also be  available.

To get some infos about the camera I’m using :

root@beagleboard:~# v4l2-ctl --all
Driver Info:
Driver name   : omap3
Card type     : omap3/mt9t112//
Bus info      :
Driver version: 0
Capabilities  : 0x04000001
Video Capture
Format Video Capture:
Width/Height  : 640/480
Pixel Format  : 'YUYV'
Field         : None
Bytes per Line: 1280
Size Image    : 614400
Colorspace    : JPEG (JFIF/ITU601)
Crop Capability Video Capture:
Bounds      : Left 0, Top 0, Width 640, Height 480
Default     : Left 0, Top 0, Width 640, Height 480
Pixel Aspect: 1/1
Crop Capability Video Capture:
Bounds      : Left 0, Top 0, Width 640, Height 480
Default     : Left 0, Top 0, Width 640, Height 480
Pixel Aspect: 1/1
Crop: Left 0, Top 0, Width 640, Height 480
Video input : 0 (camera: ok)
Streaming Parameters Video Capture:
Capabilities     : timeperframe
Frames per second: 30.000 (30/1)
Read buffers     : 0

To take the first pictures, I used MPlayer:

mplayer -vf screenshot -fps 15 tv:// -tv  driver=v4l2:device=/dev/video0
(and press 'S' to take a snapshot)

To record a video using Mencoder:

mencoder tv:// -tv driver=v4l2:width=320:height=240:device=/dev/video0 -nosound  -ovc lavc -o video.avi
(and press 'CTRL-C'  to stop recording)