Arduino on Linux

On linux 2.6.x:

modprobe ftdi_sio

echo ftdi_sio >> /etc/modules

welcome fab

that was fast... you got the board 1 day ago :slight_smile:

massimo

Hej,

last week in Barcelona we managed to install Arduino on several linux boxes: ubuntu, knoppix, max2.0, debian (raw), etc.

The good news are that Eric's tutorial applies almost step by step to each one of them. The bad news are that ubuntu and debian won't bring Java and that is not cool.

We had endless problems to fix this also because RXTX (from www.rxtx.org), the library that we use for the serial communication, had serious problems to talk to the latest javaComm (version 3). We are happy to announce that RXTX has developed version 2.1.7 of their software that fixes any problems and leaves javaComm out of the picture.

The only problem I found was to get a serial port monitor that would allow us to send data down to the board, any ideas?

/David

I suggest append to make.sh

if [ ! -d work/tools/avr/bin/ ] 
then
   mkdir -p work/tools/avr/bin/
   cd  work/tools/avr/bin/
   for i in avr-gcc  avr-objcopy  avr-objdump  avr-size  uisp
   do
              ln -s ${DIRAVR}/bin/${i}
   done
fi

My 10 Euro cent!

Updated installation method by people at Riereta.Net. Taken from:

http://riereta.net/tiki/tiki-index.php?page=PdInstallationArduino

Thanks acracia and dddani for it

/David


  1. apt-get install subversion

  2. getting arduino package sources:
    download the latest version of arduino cvs with subversion:
    ~/ svn checkout svn://svn.berlios.de/arduino/trunk
    we will come back to this directory later

  3. apt-get install gcc-avr avr-libc jikes uisp

  4. install jreyour version_number (java.com) de http://www.java.com/es/download/manual.jsp and put it into the /usr/lib firectory

  5. install rxtx for Java:


Installing RXTX
First, obtain the RXTX binaries package with CommAPI from:

take the latest version for linux
Decompress and Untar this package:
~/ cp gunzip rxtx-2.1-7pre17-i686-pc-linux-gnu.tar.gz
~/tar xf rxtx-2.1-7pre17-i686-pc-linux-gnu.tar.gz
At this point, you'll have an rxtx-2.1-7pre17-i686-pc-linux-gnu directory. Next, you'll need to copy the shared objects into your java installation:
~/cp rxtx-2.1-7pre17-i686-pc-linux-gnu/librxtxParallel.so /usr/lib/jreyour version_number/lib/i386
~/cp rxtx-2.1-7pre17-i686-pc-linux-gnu/librxtxSerial.so /usr/lib/jreyour version_number/lib/i386
If you are installing on an architecture other than an x86, you'll need to adjust both the /i386-pc-linux/ and the /i386/ accordingly.

Next, you'll need to install the RXTXcomm.jar file:

~/cp rxtx-2.1-7pre17-i686-pc-linux-gnu/RXTXcomm.jar /usr/lib/jreyour version_number/lib/ext/

At this point, the RXTX installation is complete.

We are almost finished. We just need to create the properties file that the Comm API will use to load the drivers (.so files). To create this file, type the following command:

~//bin/echo Driver=gnu.io.RXTXCommDriver > /usr/lib/jreyour version_number/lib/javax.comm.properties
o
~//bin/echo Driver=gnu.io.RXTXCommDriver > /usr/lib/j2se/1.4/jre/lib/javax.comm.properties

~/ln -s /dev/ttyUSB0 /dev/ttyS99

If you don't have the /dev/ttyUSB0, do

~/ modprobe ftdi_sio

If you don't have it, then you have to give to your kernel support to usbhid and libftdi.

Device Drivers ---> USB support ---> USB Serial Converter support ---> USB FTDI Single Port Serial Driver (EXPERIMENTAL)

Congratulations! You have installed the Linux Comm API.


  1. add the path to java/bin and rt.jar to your CLASSPATH:
    in my case this looks like:

export CLASSPATH=/usr/lib/jreyour_version_number/bin:/usr/lib/jreyour_version_number/lib/rt.jar

  1. you can check on this variables with the "env" command
    note that as soon as you close your xterm this settings are gone. for a tutorial on environment variables
    look at: 澳门8159网站|首页|欢迎您

  2. go back to arduino svn directory:

~/ cd to trunk/build/linux

  1. compile it:

~/ ./make.sh

  1. go to work directory

~/ cd work

  1. create binaries directory

~/ mkdir -p tools/avr/bin/

  1. create symbolic links to the programs arduino uses to compile

~/ cd tools/avr/bin/

~/ ln -s /usr/bin/avr-gcc avr-gcc ;
ln -s /usr/bin/avr-objcopy avr-objcopy ;
ln -s /usr/bin/avr-objdump avr-objdump ;
ln -s /usr/bin/avr-size avr-size ;
ln -s /usr/bin/uisp uisp ;

  1. go back to /trunk/build/linux/ folder

~/ cd ../../../../

Per executar arduino

~/ ./run.sh

  1. for having the comm.api driver always properly set, change your bash configuration file:

~/ vi /root/.bashrc

and add

/bin/echo Driver=gnu.io.RXTXCommDriver > /usr/lib/jreyour version_number/lib/javax.comm.properties

i have two arduino board-USB on LINUX-debian kernel 2.6.15-4
-one with resistor 1/4w , go well
-one (newer) whis resistor SMD . this board can download a compiled program but can ejecut it.
¿ have you got idea about problem ?
thanks

Hi, Working on a Ubuntu Dapper, i have jre installed since i work with Eclipse and NetBeans for different java projects.

I managed to run the IDE and "compile", but when i try to upload the sketch|program to the board it freezes, the IDE freezes. If i try to "burn the bootloader" (i was trying if something works) it freezes too. The only way to close that window is clossing the terminal from the IDE was create (it doesn¡t respond at anything but i could move the window)

I think that is my version of jre (1.5 of sun - yeah it sucks, but blackdown only has 1.4 version)
More info :
I put a led over pin 13 and GND, it start bliking (i thougth the led_blik_tutorial was loaded from "fabric") I run the IDE, change the led_blik_tutorial to hold the led on for 2 seconds. I reset the board y hit "Upload button" after 8 seconds (more or less) it start bliking like at first, no changes were made. RX and TX led's do nothing. (i try this on the two usb-board i buy)

This was my shell output

nodani@noworld:~/arduino/build/linux$ ./run.sh
Stable Library

Native lib Version = RXTX-2.1-7pre17
Java lib Version = RXTX-2.1-7
WARNING: RXTX Version mismatch
Jar version = RXTX-2.1-7
native lib Version = RXTX-2.1-7pre17
RXTX Warning: Removing stale lock file. /var/lock/LCK..ttyUSB0

Binary sketch size: 5238 bytes (of a 7168 byte maximum)

How i could make it work?

Thanks

Thanx to all the Arduino Linux guys for describing their installation steps. I'm running a AMD64 Ubuntu 5.10 and noticed some small differences so I made a document discribing the steps I did to get Arduino up and running: go.yuri.at » Installing Arduino on Ubuntu 5.10 AMD64

@ICEM4N: could it be that you have another RXTX copy installed somewhere, see this similar error message from Processing: http://processing.org/faq/bugs.html#serial

Thx, following this guide http://riereta.net/tiki/tiki-index.php?page=PdInstallationArduino and makingsome minor changes it worked! (Ubuntu dapper 6.06 -updated from breezy 5.10 )

ICEMAN,
The arduino board comes pre-programmed with the led blinking program.

hi i was following the installation instruction on the post above without any trouble but as soon as i do ./run.sh i get this error:
olsen@ll-928:~/lab/arduino/trunk/build/linux$ ./run.sh
Exception in thread "main" java.lang.NoClassDefFoundError: processing.app.Base
at gnu.java.lang.MainThread.run(libgcj.so.7)
Caused by: java.lang.ClassNotFoundException: processing.app.Base not found in gnu.gcj.runtime.SystemClassLoader{urls=[file:lib/,file:lib/build/,file:lib/pde.jar,file:lib/antlr.jar,file:lib/oro.jar,file:lib/registry.jar,file:lib/mrj.jar,file:lib/RXTXcomm.jar], parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}}
at java.net.URLClassLoader.findClass(libgcj.so.7)
at java.lang.ClassLoader.loadClass(libgcj.so.7)
at java.lang.ClassLoader.loadClass(libgcj.so.7)
at java.lang.Class.forName(libgcj.so.7)
at gnu.java.lang.MainThread.run(libgcj.so.7)
...
any clue around?
thanks&greets
olsen

I'm having trouble installing Arduino, because of the lack of Java in Ubuntu... I'm really not an expert with Linux, but would it be possible to have Arduino be stand-alone in the same way that Processing is?

Hey all,

I hope people are still watching this thread.

#1. I'm trying to get arduino working on debian/etch using only packages available from repos (java from blackdown, as well as rxtx) I had package issues with 1.4 so I'm using 1.3 right now. I'm currently getting stuck with Jikes could not find package "java.lang" in it is not provided by any of the java packges I see.

#2. Due to the "fun" of java I would greatly perfer a non java dependant version of arduino for linux. probably just a few scripts would do it, "arduino_upload" "arduino_download" "arduino_compile" and I guess a serial debugger... I've gone somewhere on this but even things like uuisp are not working quite so well:

uisp -dserial=/dev/ttyUSB0 -dspeed=9600 --download of=~/Projects/Arduino/test.pde -dprog=stk500 -dpart=ATmega8 -v=3

Programmer is not responding.

I saw somewhere on the playground that arduino uses the stk500. I was able to get a little more luck (downloading what I think is the firmware) using:

uisp -dserial=/dev/ttyUSB0 --download of=~/Projects/Arduino/test.pde -dprog=dasa -dpart=ATmega8 -v=3

Reset inactive time (t_reset) 1000 us
AVR Direct Parallel Access failed after 32 retries.
Override signature bytes, device ATmega8 assumed.
Vendor Code: 0x1e
Part Family: 0x93
Part Number: 0x07
Atmel AVR ATmega8 is found.
Downloading: flash

Is there a more simple guide than Arduino Playground - BuildProcess on what the arduino IDE actually does?

Thanks.

I was able to fix the "java.lang" problem by editing the CLASSPATH to find rt.jar

So thats all I can do since the output is meaningless to me. Looks like I can't attach it to this post: http://b.goto10.org/misc/arduino_make.sh_output.txt

./run.sh gives me:

Exception in thread "main" java.lang.NoClassDefFoundError: processing/app/Base

Ok, looks like for some reason the make.sh script creates the work directory is such a way that it is not writible by the regular user?? so I did this:

sudo chown -R bbogart trunk/
sudo chgrp -R bbogart trunk/

looks like the svn make.sh script refers to something not in svn:

Extracting examples...
unzip: cannot find or open ../shared/dist/examples.zip, ../shared/dist/examples.zip.zip or ../shared/dist/examples.zip.ZIP.

I'm guessing these java erros are due to my old 1.3 version, off to try some different packages...

so I've switched to blackdown 1.4 and It seems to compile! It would be nice for the makefile to print out "success" or something when it works, since I did not realize it with all the errors.

I build with DIRAVR=/usr so that the build could find the avr compiler. Now when I run the environment ./run.sh it says it can't find the compiler but it is in my path:

which avr-g++
/usr/bin/avr-g++

I'll post this and followup on the next steps.

Looks like the processing .class files have hard references to the compiler tools.

On linux it should just run avr-g++ which will be in the PATH when installed from a package.

I don't see how to edit the source to point to my own avr tools... since its encased in a binary .class file and the SVN trunk seems to contain no files used to generate that .class file.. ?

Maybe adding a setting in the "Perferences" for the Avr tool path would be best..?

.b.

I've tried using the script higher in this thread, and using the instructions from

http://www.arduino.cc/playground/Learning/Linux

but no matter what I do I can't get arduino to find my avr-g++ binary (and I suppose neither the rest of the AVR toolkit)

ok, after searching it looks like these files refer to the tools/blah stuff:

Library.java, Compiler.java, Sizer.java, Uploader.java

Seems to me there should be a function that has the job of choosing where all the avr and uisp tools are.

Ok, HCS is making some changed to these files and I'll post back here results.

anyone out there working on a debian package for arduino?

.b.

I just worked out a patch for the avr-gcc, etc. path issues with bbogart:

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1156638816/0

Tested on Mac OS X and Linux.

I've documented the process of today at: Arduino Playground - Debian

Thanks much for your help with us. None of the core developers have regular access to a Linux box, so we rely on contributions to improve the process. If you have any other suggestions or fixes, please let me know. In particular, I'm curious about the need to chmod the Arduino files from svn. Who owned them when they were checked out? Did you check them out with a sudo?

I am trying to get the Arduino board installed on my Fedora Core 5 laptop: no luck yet.
My problem appears to be with the Java GUI

I have followed the guid of an earlier post in this thread, taken form here: http://riereta.net/tiki/tiki-index.php?page=PdInstallationArduino

I was getting a strange error...
check_group_uucp(): error testing lock file creation Error details: Permission deniedcheck_lock_status: No permission to create lock file.
So I copied the proper rxtx version serial lib into the work directory ( cp /usr/java/jre1.5.0_07/lib/i386/librxtxSerial.so work/ )
Now I don't get that error.

When I run arduino:

  1. I get the file selector dialog but no files are displayed.
  2. When I enter a filename a directory within the work directory is created: for example if I try to open Pd_firmware.pde a directory is created work/NullPd_firmware.pde/

Is there a way to upload this firmware to the arduino from the command line?