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
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
arduino
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 http://www.arduino.cc/en/Main/Software
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 http://www.freetronics.com/pages/leostick-quickstart-guide 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.name=Arduino Leonardo
leonardo.upload.protocol=arduino
leonardo.upload.maximum_size=28672
leonardo.upload.speed=1200
leonardo.bootloader.low_fuses=0xde
leonardo.bootloader.high_fuses=0xd8
leonardo.bootloader.extended_fuses=0xcb
leonardo.bootloader.path=diskloader
leonardo.bootloader.file=DiskLoader-Leonardo.hex
leonardo.bootloader.unlock_bits=0x3F
leonardo.bootloader.lock_bits=0x2F
leonardo.build.mcu=atmega32u4
leonardo.build.f_cpu=16000000L
leonardo.build.core=arduino
leonardo.build.variant=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
http://forum.freetronics.com/viewtopic.php?f=27&t=167
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.
http://tonyforster.blogspot.com/2010/10/arduino-fork-of-turtle-art.html
The version here works for older Arduino boards on Sugar 0.88 It needs patching at TurtleArtActivity.py, 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
self.palette_buttons[i].set_tooltip('thing')
line 868 commented out
# palette_toolbar_button.set_expanded(True)
serialposix.py line 273
# self.fd = os.open(self.portstr, os.O_RDWR|os.O_NOCTTY|os.O_NONBLOCK)
self.fd = os.open('/dev/ttyACM0', os.O_RDWR|os.O_NOCTTY|os.O_NONBLOCK)
see also:
http://tonyforster.blogspot.com/2010/10/turtle-arduino-display-inputs.html
http://tonyforster.blogspot.com/2010/10/turtle-arduino-digital-write.html
Labels: Arduino, olpc, programming, Sugar
6 Comments:
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 http://blog.minibloq.org/p/documentation.html, but hey, we'll see. Thank you. Not quite done with the download, I'll report back the experience.
Would you be interested in trying out the "XOrduino"? http://cananian.livejournal.com/66129.html
yes please, see private mail
Hi...
Well, since you have a arduino ide running in the xo, maybe you want to try scratch for arduino. http://seaside.citilab.eu/scratch/downloads
Cheers
Pato Acevedo
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
Tony
The XOrduino is documented at http://wiki.laptop.org/go/XOrduino
Post a Comment
<< Home