Wednesday 6 July 2011

Install and run a program in Arduino using 64 bits Ubuntu (lucid) distro

From Arduino home page:
Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware and software.

Arduino provides a Java based IDE and examples are written in C language: http://arduino.cc/en/Reference/HomePage


MY SYSTEM consists on:

Arduino Duemilanove: An ATmega328 running at 16 MHz with auto-reset. It connects to the computer using a USB cable.

Ubuntu distro:
Release: 10.04
Codename: lucid

Linux kernel
2.6.32-32-generic
x86_64 AMD 64 bits architecture.


INSTALLING ARDUINO IDE SOFTWARE


First we install needed dependencies:
  • openjdk-6-jre
  • avr-gcc (aka "gcc-avr")
  • version 4.3.2 or later 4.3.x version (4.4.x and 4.5.x seem to have various problems)
  • avr-libc

NOTE: On the contrary to what Arduino page said, I did not need avr-gcc-c++.

$ sudo aptitude install openjdk-6-jre gcc-avr avr-libc
NOTE: gcc-avr version is 4.3.4 in my system


DOWNLOADING ARDUINO IDE


Download it from this page:
http://arduino.cc/en/Main/Software

Current Arduino IDE version when writing this article is 0.22:
http://arduino.cc/en/Main/ReleaseNotes

$ wget http://arduino.googlecode.com/files/arduino-0022-64-2.tgz
$ tar xvzf arduino-0022-64-2.tgz
$ cd arduino-0022
$ ./arduino


The arduino IDE window appears on the screen.

If in the menu Tools -> Serial port nothing appears, it has not detected right your Arduino usb board.

For the IDE to detect correctly the Arduino usb board you have to previously connect the board to your computer.
So we quit the Arduino IDE.
We now plug the usb cable from the Arduino board in your computer.

$ tail /var/log/syslog

usb 2-1.2: USB disconnect, address 8
 ftdi_sio ttyUSB0: FTDI USB Serial Device converter now disconnected from ttyUSB0
 ftdi_sio 2-1.2:1.0: device disconnected
 usbcore: deregistering interface driver ftdi_sio
 USB Serial deregistering driver FTDI USB Serial Device
 usb 2-1.2: new full speed USB device using ehci_hcd and address 9
 usb 2-1.2: configuration #1 chosen from 1 choice
 USB Serial support registered for FTDI USB Serial Device
 ftdi_sio 2-1.2:1.0: FTDI USB Serial Device converter detected
 usb 2-1.2: Detected FT232RL
 usb 2-1.2: Number of endpoints 2
 usb 2-1.2: Endpoint 1 MaxPacketSize 64
 usb 2-1.2: Endpoint 2 MaxPacketSize 64
 usb 2-1.2: Setting MaxPacketSize 64
 usb 2-1.2: FTDI USB Serial Device converter now attached to ttyUSB0
 usbcore: registered new interface driver ftdi_sio
 ftdi_sio: v1.5.0:USB FTDI Serial Converters Driver

That shows your ttyUSB device is set correctly using FTDI drivers.

Now you can launch again arduino IDE:

./arduino


LOAD A PROGRAM INTO THE ARDUINO BOARD


We are going to load the example which blinks the 13th led built in the board.

IDE howto

First we load the blinking example:
File -> examples -> basics -> blink

Compile the example:
Sketchs -> Verify (or C-r)

Load resulting code into the Arduino Board
File -> Upload to IO Board (or C-u)

It everything goes fine, led will start to blink each second.


YOU MAY ALSO BE INTERESTED IN:


Calculate Prime Numbers using an ARDUINO Board

0 comentarios: