Saturday, January 21, 2012

Arduino and the XO laptop

The Freetronics Leostick is a low cost Arduino board. (It is presumed to be low cost, it was cheap enough to place into the satchels of the attendees of LCA2012.) The XO-1.5 already has 2 channel analogue input, an Arduino board can add a lot of extra input and output channels.

This could facilitate a number of low cost science and robotics experiments in schools, experiments at a cost suitable for developed and even developing countries.

There are a number of ways such a board could be used:
  • from the Arduino IDE
  • from TurtleArt, Firmata running on the Arduino
The second version is probably the most practical for classroom use. Once the Leosticks are loaded with Firmata (and this could even be at the factory) all that is requited is TurtleArt drag and drop programming.

Installing the Arduino IDE onto a XO-1.5 laptop (OS880)
In terminal enter the following

sudo yum install arduino

This installs an older version (0021), more importantly it installs all the dependencies including Java and avr-gcc. It is a 60MB download which expands to 200MB of storage, be warned it uses up a lot of precious space.

The IDE can be started from the Gnome menu or with the command


but it does not have the permissions to see the Arduino board on the USB serial port so start it as root (maybe why)

sudo arduino

The IDE can then be upgraded to version 1.0. This is the version recommended for the Leostick. Download version1.0 from
The file arduino-1.0-linux.tgz uncompresses with the Gnome archive manager. Uncompress it to a convenient location, if for example if you uncompress it to Documents, you will find a directory arduino-1.0 in this directory.

You now have 2 versions of the program, 1.0 (at /home/olpc/Documents/arduino-1.0 ) and 0021 (with components at /usr/share/doc/arduino-0021 and /usr/bin). The later versions 1.0 uses the dependencies installed with the earlier one 0021.

As described at uncomment the following lines in /home/olpc/Documents/arduino-1.0/hardware/arduino/boards.txt

(or in version 0021 you would need to add them) Leonardo

Launch the Arduino IDE (sudo /home/olpc/Documents/arduino-1.0/arduino), and select Tools > Board > Arduino Leonardo.
to select the Leonardo hardware

select Tools > Serial Port
a new device appears with Leostick plugged in, dev/ttyACM0, select it.

You can now upload example programs, eg blink, to the Leostick.

NOTE: this will overwrite the program that came with your Leostick that plays a tune, watch
for the original program

Controlling the Arduino with Turtle Art
Load Firmata software into the Leostick, this can be done on an OLPC, another Linux PC or Windows. Once this is done the Leostick can be used as a I/O expander for Turtle Block drag and drop programming. No Terminal or Gnome work would be needed.

The version here works for older Arduino boards on Sugar 0.88 It needs patching at, line 834 as described in the link above. The baud rates of Turtle Art and Firmata need to be patched.

Sugar 0.88 (Fedora 11) recognises an older Arduino board as as serial device but not the Leostick. Later Arduino boards are dev/ttyACM0

This version is hard coded to dev/ttyACM0, that means it only works the first time the Leostick is plugged in and not at all for older Arduino boards. It is patched and works on Sugar 0.94.

The quick and dirty patches are:
Turtleartactivity line 835
line 868 commented out
# palette_toolbar_button.set_expanded(True) line 273
# self.fd =, os.O_RDWR|os.O_NOCTTY|os.O_NONBLOCK)
self.fd ='/dev/ttyACM0', os.O_RDWR|os.O_NOCTTY|os.O_NONBLOCK)

see also:

Labels: , , ,


Blogger Yama Ploskonka said...

At this moment I am following your directions on getting the XO to run the Arduino IDE, but it's for a vanilla Arduino clone, and the XO 1. So we'll see how that works. I did drop by Freetronics, but they do not have Leosticks for sale... Anyway, if I get the 'duino to run, I'll count myself lucky, though rather sad that this needs SO much space in the XO! AT least less overkill that having one extra step with Wine, as in, but hey, we'll see. Thank you. Not quite done with the download, I'll report back the experience.

Friday, February 03, 2012 9:14:00 AM  
Anonymous C. Scott Ananian said...

Would you be interested in trying out the "XOrduino"?

Sunday, July 15, 2012 8:39:00 AM  
Blogger South American Adventurers said...

yes please, see private mail

Sunday, July 15, 2012 9:30:00 AM  
Blogger Patricio said...

Well, since you have a arduino ide running in the xo, maybe you want to try scratch for arduino.

Pato Acevedo

Friday, September 28, 2012 3:08:00 AM  
Blogger Unknown said...

Thanks Pato, S4a or Scratch for Arduino is available as a Debian Linux *.deb installer. Looks like you can get rpm conversion utilities or manually unpack the archive

Friday, September 28, 2012 2:42:00 PM  
Blogger Unknown said...

The XOrduino is documented at

Wednesday, March 20, 2013 9:49:00 AM  

Post a Comment

<< Home