Getting started with Arduino Uno on Ubuntu

Posted on 2011/01/31

22


I really wanted to try Arduino; Arduino narrates a story where the good guys are winning. Saturday I arranged to buy one, the Arduino Uno, and the first thing that came into my mind was “Wow, it’s really smaller than I thought possible!”.

Arduino Uno hands-on box

Arduino Uno hands-on box

I went home and started unboxing it: the packages comes with a pamphlet and some decals, and the board itself is very cute and gives the idea that the designers paid attention to small details.

Arduino Uno unboxing

Arduino Uno unboxing

Arduino Uno board

Arduino Uno board

I wanted to make it breathe right away connecting it with my Ubuntu desktop, but the steps were a bit more complicated than I thought, so I’m gonna explain them to make things easier for other people. First of all, Ubuntu Maverick distributes an “arduino” package containing the Interactive Development Environment (IDE), but it’s an “old” version (18) and it doesn’t support the newer Arduino Uno (as the Ubuntu instructions say). For this reason I followed some of the generic Linux instructions to get started. On my Ubuntu machine I use “sun-java6-jre” installed, but the “openjdk-6-jre” should work fine, too. The Arduino pages say that the braille support package “brltty” must be removed because they conflict with the serial port communications, so I did:

$ sudo apt-get remove brltty brltty-x11

Then, to install the prerequisites:

$ sudo apt-get install avr-libc avrdude binutils-avr gcc-avr

The Arduino IDE versions that support the Arduino Uno are the ones >=21, So I downloaded and extracted the current one, version 22:

$ wget http://arduino.googlecode.com/files/arduino-0022.tgz
$ tar xzf arduino-0022.tgz

Then I connected the Arduino Uno board using an USB cable, and the leds started blinking. On my desktop, the device was recognized and a new serial port “/dev/ttyACM0” was created:

$ dmesg
...
[ 3221.472079] usb 2-1.2: new full speed USB device using ehci_hcd and address 4
[ 3221.631190] cdc_acm 2-1.2:1.0: ttyACM0: USB ACM device
[ 3221.631845] usbcore: registered new interface driver cdc_acm
[ 3221.631848] cdc_acm: v0.26:USB Abstract Control Model driver for USB modems and ISDN adapters
...

It’s time to start the IDE; it’s not necessary to install it, it can work from where it was uncompressed.

$ cd arduino-0022
$ ./arduino

The IDE itself is just a simple window containing code, that is called “sketch”. From the menu, I opened an example navigating to “File -> Examples -> Basics -> Blink”, and another window appeared with few code lines to make a led blink.

Screenshot of Arduino IDE: Blink example sketch

Screenshot of Arduino IDE: Blink example sketch

The “verify” button compiles the code, and the “upload” button does the trick of putting the code onto the board and starting the program. It’s really “one-click” simple! The led starts blinking and the dirty work is completely hidden to the final user.
I’m really happy with my purchase and I haven’t even started doing anything! I appreciate the quality and the simplicity of this product that is a great step forward from traditional PICs, mostly because it’s easier to start using one, and also because there’s a large community of enthusiasts that have done the most creative things and have put their experience on the public domain for others to see and use.

About these ads
Posted in: Hardware