Arduino 64bit

From ArchWiki

Jump to: navigation, search

Contents

Introduction

Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware and software. Its intended for artists, designers, hobbyists, and anyone interested in creating interactive objects or environments. It is based around the Atmel AVR Microcontroller series and comes in several board sizes which offer variations in memory, speed, I/O pins.

To help with development, there is an open source IDE, also called Arduino, written in Java, which uses the AVR open source tools.

This document describes how to install Arduino on 64-bit Arch Linux.

It has been tested with a Duemilanove 328 board from http://www.earthshinedesign.co.uk/ which is described as identical to a normal board. I have not tested it with any other board, however, it should work.

Prerequisites

Standard Packages

From the main repositories, install avrdude, gcc-avr and avr-libc. As super user, type:

pacman -S avrdude gcc-avr avr-libc

Other package

You need to download, build and install rxtx from the AUR. You can use yaourt or build it by hand as follows.

wget http://aur.archlinux.org/packages/rxtx/rxtx.tar.gz
tar xzvf rxtx.tar.gz
cd rxtx
makepkg

and then, as super user

pacman -U rxtx-2.2pre2-4-x86_64.pkg.tar.gz

the file name may vary slightly as the AUR updates but it looks something like this.

To check it is installed, if you type the following command:

ls /usr/share/java

it should display a subdirectory 'rxtx'. For more information see the AUR pages.

Installing Arduino

The Main Program

Firstly, download the current version of Arduino (at the time of writing, version 0017) from http://www.arduino.cc/ . Click on download, and download the 'Linux (32 bit)' version. This is (at present) a file called arduino-0017.tgz

Create a directory to install arduino in, then untar the arduino file into it from wherever you downloaded it. If you used Firefox, this would be the Downloads directory under your home directory."Downloads" directory)

e.g. for me (paulr)

mkdir /home/paulr/Arduino
cd /tmp
tar xzvf /home/paulr/Downloads/arduino-0017.tgz
mv /tmp/arduino-0017/* /home/paulr/Arduino

Patching Arduino for 64 bit

The problem with the Linux Arduino is the provided files are designed for 32 bits. To make it work replace these with files from the applications installed earlier. This approach (copying over the files) is probably easier for less experienced users (it is also possible to link to the installed files)

First the rxtx files are copied into the 'lib' subdirectory, then the avrdude configuration and executable are installed into the 'hardware/tools' subdirectory.

cd /home/paulr/Arduino
cp /usr/lib/librxtxSerial.so lib
cp /usr/share/java/rxtx/RXTXcomm.jar lib
cp /etc/avrdude.conf /usr/bin/avrdude hardware/tools

Install and check

All the software is now installed. Connect your Arduino to the computer using a USB cable. Then type:

dmesg | tail

and you should see something like :

USB Serial support registered for FTDI USB Serial Device
ftdi_sio 3-2:1.0: FTDI USB Serial Device converter detected
usb 3-2: Detected FT232RL
usb 3-2: Number of endpoints 2
usb 3-2: Endpoint 1 MaxPacketSize 64
usb 3-2: Endpoint 2 MaxPacketSize 64
usb 3-2: Setting MaxPacketSize 64
usb 3-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

The important part is "ttyUSB0" near the bottom - this tells you which port on your machine the Arduino is connected to.

Blink some LEDs

To check everything is working correctly, you can run the Arduino IDE, and download one of the provided demonstration programs to the Arduino Board. Firstly, run the IDE.

/home/paulr/Arduino/arduino

Now, select the "simple LED blinker" demonstration program by selecting from the menu.

File>Examples>Digital>Blink

This should open a second window with the blink program in.

Check to see if it compiles by selecting

Sketch>Verify/Compile

The next thing to do is to configure the IDE. That involves two things. Firstly, specifying the correct board type, as there are several different Arduino boards, and secondly, specifying the correct output port.

Tools>Board>Arduino Duemilanove or Nano w/ATMega 328
Tools>Serial Port>/dev/ttyUSB0 

You may have a different port (this is the value displayed by dmesg above) and board.

Finally, upload and run the "Blink" application on the Arduino board.

File>Upload to I/O Board

If all goes well the rx/tx lights on the Arduino should blink a bit, and the on board LED should flash at about 1Hz.

Troubleshooting

If it doesn't work you'll get java "gobbledegook" e.g.

processing.app.SerialException: Serial port '/dev/ttyUSB0' not found.  Did you select the right one from the Tools > Serial Port menu?
at processing.app.Serial.<init>(Serial.java:153)
at processing.app.Serial.<init>(Serial.java:76)

Look at the first line, which often gives a clue. It may mention an application - check that you copied the files over correctly above. In this case, it tells us it can't find the /dev/ttyUSB0 port - which means either its not plugged in (which is the case here, I unplugged it to get the error) or you have selected the wrong Serial Port (see above)

Personal tools