Sunday, June 9, 2013

Install Arduino IDE on Debian Wheezy

Device: Arduino UNO
System: Debian Wheezy  3.2.0-4-686-pae #1 SMP Debian 3.2.41-2+deb7u2 i686 GNU/Linux
IDE:  Arduino 1.0.5

Install only requires an simple enough command:

apt-get install arduino

please refer to this link: Arduino_Debian


The installation went o.k. but suddenly this message appeared on my screen after trying to open the application:

 




When I tried to open the program, I found that I couldn't choose an appropriate serial device. I suspected it was a bad configuration in the IDE because the it was showing the next message in the status bar: Arduino UNO in COM1 and also the Tools>Serial Port menu was disabled.

In order to satisfy a mental check list, I started by checking the status of the usb ports with an lsusb command:


lsusb
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 002: ID 0409:005a NEC Corp. HighSpeed Hub
Bus 001 Device 003: ID 2341:0043 Arduino SA Uno R3 (CDC ACM)
Bus 007 Device 002: ID 04f3:0103 Elan Microelectronics Corp.
Bus 007 Device 003: ID 0458:003a KYE Systems Corp. (Mouse Systems) NetScroll+ Mini Traveler / Genius NetScroll 120


As you can see, my Arduino was properly detected by the system, so the next step is to add my user to groups needed in order to allow communication between my machine and the Arduino

newgrp dialout
usermod -a -G dialout unbkbl
usermod -a -G tty unbkbl

After doing that you need to check two important things:

1) The version of the Java's library in charge of allowing serial communications: librxtx-java
Please refer to this bug: debian_bug, as the UNO uses a USB serial chip that needs a recent version of this library
2) The proper /dev/tty* device according to you system characteristics
Please reafer to this How to: Identify_Serial_Debian

In my case this was the procedure: 

apt-get install hal
hal-find-by-capability --capability serial | xargs -n 1 hal-device
 
udi = '/org/freedesktop/Hal/devices/usb_device_2341_43_74937303836351602202_if0_serial_unknown_0'
  info.udi = '/org/freedesktop/Hal/devices/usb_device_2341_43_74937303836351602202_if0_serial_unknown_0'  (string)
  info.category = 'serial'  (string)
  linux.hotplug_type = 2  (0x2)  (int)
  linux.subsystem = 'tty'  (string)
  info.subsystem = 'tty'  (string)
  info.product = 'Serial Port'  (string)
  linux.sysfs_path = '/sys/devices/pci0000:00/0000:00:1a.7/usb1/1-5/1-5.3/1-5.3:1.0/tty/ttyACM0'  (string)
  info.parent = '/org/freedesktop/Hal/devices/usb_device_2341_43_74937303836351602202_if0'  (string)
  serial.port = 0  (0x0)  (int)
  serial.originating_device = '/org/freedesktop/Hal/devices/usb_device_2341_43_74937303836351602202_if0'  (string)
  serial.device = '/dev/ttyACM0'  (string)
  info.capabilities = { 'serial', 'modem' } (string list)
  serial.type = 'unknown'  (string)
  modem.command_sets = { 'V.250' } (string list)
  linux.device_file = '/dev/ttyACM0'  (string)



So as you can see in my case the usb-serial device is mapped to /dev/ttyACM0. After finding that, the next step is to configure the IDE itself.

There is an hidden config file in your home folder, in my case: /home/unbkbl/.arduino/preferences.txt

In that file you have to chage the serial.port  field:

cat /home/unbkbl/.arduino/preferences.txt | grep serial.port
from:
serial.port=/dev/COM1

to:
serial.port=/dev/ttyACM0


After that change everything worked like a charm! even the upload: