Saturday, September 13, 2014

Installing Arduino IDE and Libs on Ubuntu 10.10 and Windows 7

Ubuntu 10.10
Windows 7 (64bits)
Arduino IDE 1.0.5 for Linux (32bits)
Arduino IDE 1.5.7 for Windows



Status:
  • 2014.09.14  It's working. 
Installing on Ubuntu:
  • sudo apt-get update
  • sudo apt-get install arduino openjdk-6-jre gcc-avr avr-libc
  • Plug and Check if Arduino device was detected (ttyACM0: USB ACM device):
  • lsusb
  • dmesg | grep tty

Setting the Permission on ttyACM0 (Linux only - All distro):
  • Check the owner group of the serial port:
  • ls -l /dev/ttyACM0
  • You will get something like "dialout" or "uucp".
  • Add our user (pi) to that group:
  • usermod -a -G dialout pi
  • Add our user (pi) to "lock" group (if you have filesystem-2012.6-2 or newer):
  • usermod -a -G lock pi
Installing on Windows:
Testing - Linux and Windows:
  • Double click on /~/arduino-1.0.5/arduino and choose "Run" (arduino.exe on Windows).
  • Select a serial port (menu: Tools->Serial Port->dev/ttyACM0) (COM4 on Windows).
  • If there is no serial port available then try one of those options.
  • Select a board (menu: Tools->Board->Arduino Uno).
  • See examples (menu: File->Sketchbook).
  • Open file serial_echo.ino with Arduino IDE and Upload.



Testing with Python:
  • We don't need any privileges, like when working with Arduino IDE (chmod 777 /dev/ttyACM0).
  • python
  • import serial
  • On Linux:
  • ser=serial.Serial(port='/dev/ttyACM0', baudrate=500000, timeout=1)
  • On Windows:
  • ser=serial.Serial(port='COM4', baudrate=500000, timeout=1)
  • ser.write('Testing...\n')
  • print ser.readline()
  • ser.close()
References: