HOWTO run Arduino on the XO Laptop
The XO Laptop comes with the drivers you need to talk to an Arduino board, but you need to do a few things before you can run the Arduino environment. Once you get it running, though, it works just fine. The first step is to install Java. To install Java on the XO Laptop, check out these instructions (the version of Java that you download will be different from what's listed on that page, so you'll need to modify the commands slightly to take that into account).
Once you've got Java up and running, you need to install the GNU C and C++ compilers as well as the LIBC for the AVR chip that the Arduino uses. To do this, open up the Terminal activity, su to root, and install avr-gcc, avr-libc, and avr-gcc-c++ using yum:
$ su # yum install avr-gcc avr-libc avr-gcc-c++
While you're root, you may as well make one of the changes you need to make; add the olpc user to the lock and uucp groups. To do this, edit the /etc/group file with the /usr/sbin/vigr command and add the olpc user to the end of the lock group:
lock::54:olpc
and to the end of the uucp group:
uucp::14:uucp,olpc
After you exit vigr (which is just a script that starts vi to safely edit the group file), decline its offer to edit the gshadow file, and type exit to get back to a normal (non-root) shell):
# /usr/sbin/vigr You are using shadow groups on this system. Would you like to edit /etc/gshadow now [y/n]? n # exit exit $
Next, make sure you're in your home directory, download Arduino (there may be a more recent version of it, so check the Arduino page to be sure. Extract Arduino in your home directory (you'll be running it out of your home directory as well):
$ cd $ wget http://www.arduino.cc/files/arduino-0010-linux.tgz $ tar xvfz arduino-0010-linux.tgz
Now, you're all Arduino-fied. To run it, cd to the arduino-0010 and run the arduino script:
$ cd ~/arduino-0010 $ ./arduino
There is one last trick: you'll likely find that the Arduino user interface misbehaves quite a bit. To get it to work right, press the screen rotate button four times to get a nice 360 degree rotation. Arduino will redraw and start behaving itself as shown in the screenshot.
Update: As Seth points out in the comments, the Update.1 build that is coming out this month will do away with the su command, so you should use sudo -s
instead of su
(or simply prefix each superuser command with sudo
).
Update 2: If you use JRE 5 from the Java technology archive instead of JRE 6, you won't need to use the screen rotation trick. You'll need to add these two lines to the .bashrc file in your home directory, and then stop and relaunch the Terminal activity:
export JAVA_HOME=/usr/java/jre1.5.0_13/ export PATH=$PATH:$JAVA_HOME/binYou'll need to install Java and modify your ~/.bashrc before you try running
./arduino
Posted by Brian Jepson |
Dec 21, 2007 06:35 PM
Education, Linux, olpc |
Permalink
| Comments (16)
Recent Entries
- Minty soldering jig
- Selecting row number in MySQL
- iPhone 3G software unlock
- Python on Android
- Controlling Sony camcorders with the Arduino
- Gradient text effect in CSS
- Retro gaming emulators that include (legal) ROMs?
- Das DereLicht - ham radio transmitter from a CFL bulb
- Using Google App Engine as a personal CDN
- Route-me - Open Source mapping library for iPhone
Comments
Newest comments listed first.
Posted by: Gian Pablo Villamil on December 22, 2007 at 4:31 PM |
This works great, with one minor hiccup: if I run Arduino as a regular user, I get the message:
lock_status: No permission to create lock file
check_group_uucp(): error testing lock file creation
When this happens, I can see no serial ports in the Arduino IDE.
However, if I run as a superuser, everything is fine. I can compile and upload code to the Arduino with no issue.
What am I doing wrong?
Posted by: Brian Jepson on December 22, 2007 at 8:06 PM |
Gian,
I think you might need to exit and restart the Terminal activity to make sure that your group membership in both "lock" and "uucp" is updated. You might need to restart, but I think restarting the Terminal should do the trick.
Another thing you might try is running the command "newgrp uucp" just before you launch Arduino.
Hope this helps,
Brian
Posted by: Gian Pablo Villamil on December 23, 2007 at 5:35 AM |
That did the trick!
I am working on encapsulating Arduino as an OLPC activity (writing a Python wrapper basically) to sort out the UI issues, and so that it has a regular activity icon.
This is a *huge* home run for the OLPC project.
Posted by: Brian Jepson on December 23, 2007 at 9:20 AM |
Gian, that is wonderful news! I can't wait to try out your activity when it's done. I think the XO could become my Arduino programming device of choice!
Posted by: Seth Wodoworth on January 1, 2008 at 6:09 PM |
You should edit your directions a little bit. As of Update.1 root is going to go away as a user, and you will have to sudo all of your commands.
Also, the developers wont ship non-free java on the XO because it's not open software. Do you know if the free-java equivalent works with the Arduino?
Either way we would love to have a writeup on the OLPC wiki. (wiki.laptop.org/go/)
Seth Woodworth (isforinsects)
Posted by: Brian Jepson on January 1, 2008 at 6:24 PM |
Thanks, Seth. I noticed that su went away in the latest joyride, but I couldn't find sudo in 650, so I have to wait until Update.1 is rolled out to revisit these instructions, otherwise they may not work for most G1G1 recipients.
Could you give me some more information on free Java on the XO? Is there a wiki page with instructions on installing a free Java equivalent on the XO? At the bottom of http://wiki.laptop.org/go/Java there is a link to a mailing list post that says that Open Source JDK is still missing some important pieces. That page still directs users to the RestrictedFormats page.
Cheers,
Brian
Posted by: Scott Penrose on March 3, 2008 at 7:44 AM |
Rather than re-launch terminal, you can just type "source .bashrc". Saves waiting for the activity to restart.
Posted by: Chris Spurgeon on March 9, 2008 at 3:29 PM |
Hmm, it looks like the Java install isn't working for me. I don't get any errors, it all seems to work just the way the XO Java instructions describe, but when I try to fire the Arduino install I get a "java not installed" error. I double checked and I *am* using jre-1_5_0_13-linux-i586-rpm.bin just like the instructions say. Any suggestions of things I can check?
Posted by: Chris Spurgeon on March 9, 2008 at 3:49 PM |
Forgot to say, I am running release 656 on my XO. Does that make a difference?
Posted by: Brian Jepson on March 9, 2008 at 4:04 PM |
Chris, it shouldn't matter if you are running that build.
Can you check what you put into your .bashrc very closely? I've seen this not work because someone forgot a $ or :
Also, can you post the output of these commands?:
echo $PATH
cat ~/.bashrc
ls /usr/java
You can use a 3-button mouse to copy and paste (highlight the text you want to copy while you are in the Terminal activity, switch to the web browser, and paste it in with a middle click).
Thanks,
Brian
Posted by: Chris Spurgeon on March 9, 2008 at 5:09 PM |
Hi Brian (great tutorial at ETech BTW!)...
I haven't altered my .bashrc yet, since that step came after the Arduino install step, and that fails for me. When I run ./arduino I get this error...
./arduino: line 16: java: command not found
echo $PATH looks like this...
/usr/share/activities/Terminal.activity/bin:/usr/bin:/bin
cat ~/.bashrc looks like this...
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# User specific aliases and functions
The output of ls /usr/java is ...
jrel.5.0_13
Thanks in advance for your help!
Chris Spurgeon
Posted by: Brian Jepson on March 9, 2008 at 5:43 PM |
Thanks, Chris. You should definitely modify your .bashrc before you proceed; that should be part of the Java installation.
Sorry that I didn't make that clearer (what I meant by putting it in the "Update" at the end was that you should do everything listed there in place of installing Java 6. This is because Java 6 takes care of putting things in your PATH, whereas Java 5 does not). I'll amend the post to reflect that.
Posted by: Chris Spurgeon on March 9, 2008 at 8:00 PM |
Sweet! That's all it took, the Arduino IDE is up and running now, thanks! I love the idea of being able to have the smaller, more rugged XO as my machine when making last minute on-site Arduino code tweaks.
Posted by: Roland Latour on March 10, 2008 at 2:27 AM |
If you use the above method to load Simple Message
System, you can actually *use* that Diecimila by
way of my shell script package. Full IO and PWM
control. AD is scaled to mV and formatted for
import to most spreadsheets. Run 'wget
207.14.167.161/SMS1.tgz' to get the package.
Posted by: hc gilje on August 19, 2008 at 4:42 AM |
Its been a while since this post was written, so maybe something has changed:
when I type yum install avr-gcc avr-libc avr-gcc c++
I get a not found error from this link.
koji.fedoraproject.org/static-repos/olpc2-ship2-current/i386/repodata/repomd.xml
any workaround for this?
best
hc
Posted by: Brian Jepson on August 19, 2008 at 6:25 AM |
hc,
I just looked into this, and there is a problem with the Fedora repository. According to this thread, the Fedora team is working on fixing this:
http://www.olpcnews.com/forum/index.php?topic=3156.msg24661;topicseen
- Brian
Leave a comment
Bloggers
Welcome to the Hacks Blog!
Categories
- Ajax
- Amazon
- Android
- AppleTV
- arduino
- Astronomy
- Baseball
- BlackBerry
- Blogging
- Body
- Cars
- Cryptography
- Data
- Design
- Education
- Electronics
- Energy
- Events
- Excel
- Excerpts
- Firefox
- Flash
- Flickr
- Flying Things
- Food
- Gaming
- Gmail
- Google Earth
- Google Maps
- Government
- Greasemonkey
- Hacks Series
- Hackszine Podcast
- Halo
- Hardware
- Home
- Home Theater
- iPhone
- iPod
- IRC
- iTunes
- Java
- Kindle
- Knoppix
- Language
- LEGO
- Life
- Lifehacker
- Linux
- Linux Desktop
- Linux Multimedia
- Linux Server
- Mac
- Mapping
- Math
- Microsoft Office
- Mind
- Mind Performance
- Mobile Phones
- Music
- MySpace
- MySQL
- NetFlix
- Network Security
- olpc
- Online Investing
- OpenOffice
- Outdoor
- Parenting
- PCs
- PDAs
- Perl
- Philosophy
- Photography
- PHP
- Pleo
- Podcast
- Podcasting
- Productivity
- PSP
- Retro Computing
- Retro Gaming
- Science
- Screencasts
- Security
- Shopping
- Skype
- Smart Home
- Software Engineering
- Sports
- SQL
- Statistics
- Survival
- TiVo
- Transportation
- Travel
- Ubuntu
- User Interface
- Video
- Virtualization
- Visual Studio
- VoIP
- Web
- Web Site Measurement
- Windows
- Windows Server
- Wireless
- Word
- World
- Xbox
- Yahoo!
- YouTube
Archives
- January 2009
- December 2008
- November 2008
- October 2008
- September 2008
- August 2008
- July 2008
- June 2008
- May 2008
- April 2008
- March 2008
- February 2008
- January 2008
- December 2007
- November 2007
- October 2007
- September 2007
- August 2007
- July 2007
- June 2007
- May 2007
- April 2007
- March 2007
- February 2007
- January 2007
- December 2006
- November 2006
- October 2006
- September 2006
Recent Posts
- Minty soldering jig
- Selecting row number in MySQL
- iPhone 3G software unlock
- Python on Android
- Controlling Sony camcorders with the Arduino
- Gradient text effect in CSS
- Retro gaming emulators that include (legal) ROMs?
- Das DereLicht - ham radio transmitter from a CFL bulb
- Using Google App Engine as a personal CDN
- Route-me - Open Source mapping library for iPhone
www.flickr.com
|