Arduino Development Platform

At present times, this page is merely a transcript of the operations carried out to set up a VirtualBox Machine in order to use it as an Arduino development environment.

One of the key point in this setup is to have the USB to serial cable connecting the Arduino reconned as a COM port.

Used Debian Jessie 8a1-64bit base image

VirtualBox setting:
Add second CPU
Add blank USB filter

modify:
/etc/network/interfaces (172.20.20.7)
/etc/hosts
/etc/hostname

install:
apt-get update
apt-get upgrade

apt-get install hwinfo

X Window
apt-get install xorg

LXDE
apt-get install lxde

REBOOT

No bottom panel :-/
Nothing in /home/sysadmin/.config/lxpanel/LXDE/panels
The default lxpanel is: /usr/share/lxpanel/profile/LXDE/panels (not present)
Got default config from: http://wiki.lxde.org/en/LXPanel
nano /home/sysadmin/.config/lxpanel/LXDE/panels/config
Pasted default file content

No option to get over 1024x768 pixels
INSTALL VB GUEST ADDITIONS:

ssh root@172.20.20.7
apt-get update
apt-get upgrade
apt-get install dkms build-essential module-assistant linux-headers make gccreboot
m-a prepare

FAIL
E: Unable to locate package linux-headers-3.13-1-amd64
E: Couldn't find any package by regex 'linux-headers-3.13-1-amd64'

Shutdown VM and link /usr/share/virtualbox/VBoxGuestAdditions.iso in VB GUI
It should be available in /media/cdrom0

Then ssh root@172.20.20.7
uname -a     [note exact kernel version - 3.13.5-1]
apt-get install linux-headers-3.13.5-1   [FAIL]
cd /media/cdrom0
sh ./VBoxLinuxAdditions.run
reboot

INSTALL ARDUINO DEVELOPMENT ENVIRONMENT
apt-get install arduino

To be able to use the USB devices, the user executing VirtualBox must be listed in the vboxusers group (logout/in required)
Also to use the pseudo serial port user must be in the dialout group (logout/in required)
Plug the Adruino
Identify the tty port for serial communication, watching dmesg while you plug the device in:
> watch "dmesg | tail -30"

Something should appear like
FTDI USB Serial Device converter now attached to ttyUSB0

You can confirm your device is recognized using:
> lsusb
...
Bus 002 Device 012: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC
...

BUT DOING THIS FAILS AS THE IS NO /dev/ttyUSB0 created when plugged.
WHY IS THAT ?

Again watching dmesg, we read:
usb 2-2: usbfs: interface 0 claimed by usbfs while 'brltty' sets config #1

THERE IS A BUG: brltty is trying to get hold of the device, read this for more info:
https://bugs.launchpad.net/ubuntu/+source/brltty/+bug/874181

It is said that we could change brltty udev rules to avoid this but I found nothing related in /etc/udev/rules.d/*
So uninstalling brltty (braille tty) seemed like a good option:
> sudo apt-get --purge remove brltty

NOW WE HAVE /dev/ttyUSB0 when the device is plugged in !!!
> ls -l /dev/ttyUSB*
crw-rw---- 1 root dialout 188, 0 Sep 15 23:58 /dev/ttyUSB0

Verify that you can access the tty:
screen /dev/ttyUSB0 9600 is a perfectly good way to access a serial port. Just don't forget ctrl-a \ to get out


NOW - in VirtualBox Manager GUI:
Create a USB Device Filter for the device
Enable Serial Port 1 (COM1 - IRQ: 4 - I/O Port: 0x3F8 - Port Mode: Raw File - Port/File Path: /dev/ttyUSB0)

NOTE THAT /dev/ttyUSBx can change EACH TIME YOU PLUG THE DEVICE so check it and adapt VB configuration accordingly.
When the VM is launched, the ttyUSBx gets disconnected from the host machine, this is normal:

ftdi_sio ttyUSB1: FTDI USB Serial Device converter now disconnected from ttyUSB1
ftdi_sio 2-2:1.0: device disconnected

ON THE GUEST VM:
You'll need to add your user to the "dialout" (and/or "tty") group(s) in order to access the serial port selection menu.
> sudo usermod -a -G dialout username
[> sudo usermod -a -G dialout username]

Logout/in to activate those changes

Open the adruino IDE
Select menu: Tools > Serial Port > /dev/ttyUSB0

Open: Tools > Serial Monitor

It should communicate with the arduino...