Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting started with Arduino: VirtualBox: Ubuntu

I would like to play with Arduino development, but I would like to do it in Ubuntu Linux, and I would like to do it on a Ubuntu VM hosted on my Windows computer using VirtualBox or VMWare Player.

Is it possible to do this? Do Ihave to do anything special to make the Arduino-connected USB port of the host OS (windows) accessible to the USB port of the guest OS (Ubuntu/virtualbox)?

like image 745
Jay Godse Avatar asked Nov 06 '11 11:11

Jay Godse


3 Answers

Yes, VirtualBox will allow you to present your local USB devices to the virtual machine.

With the VM powered off (not saved), Go to the Settings page... USB. Enable the USB controller if it is not already enabled. You can then create a new device filter (the USB plug with the +) and choose the appropriate device. This device will always be attached to the VM, which may or may not be desirable.

If USB is already enabled you can add/remove devices on a running VM (much like a real machine). Use the Devices... USB menu and select the device to attach to the VM.

like image 126
Tevo D Avatar answered Oct 30 '22 23:10

Tevo D


Actually, I had already tried the method suggested by @TevoD and running lsusb did show that the FTDI usb device was recognized within Virtualbox, however, I kept getting avrdude failure.

Finally the solution was found in this post at the Virtualbox forum. That did solve the problem, and I can now use Arduino IDE (or avrdude in general, from command-line), from within my Crunchbang 'Waldorf' guestVM (a Debain based super-light distro) -- running on Windows 7 Professional 64-bit host.

Since that link might go away some day, or might get behind an authentication scheme, the key steps are:

  1. Change the COM port number of the FTDI USB-serial port, assigned by default. This is typically needed because Virtualbox has some issues dealing with COM port number in double-digits (e.g. COM11, COM23 etc. aren't liked, but COM1-COM9 is okay). To make this change, you need to ensure that the FTDI USB-serial device hasn't been claimed and attached to Virtualbox guestVM, i.e. perform the step with guestVM shutdown. Via Win7 Device-Manager > Ports > COMxy (where 'xy' is default port#), select 'Advanced Settings' and then change the COM port no. to be a free one between 1-9.

  2. Next, in the Virtualbox console, change the guestVM properties, and enable Serial Port settings, i.e. let the FTDI USB-serial converter be seen as a serial-port in the guestVM, not as a USB device. So internally the serial-port driver is used in Linux, not the usb-serial (FTDI driver). So if the COM port# is 2, we set the port as COM2, set mode to Host-Device, and the path/file to "COM2:" (don't forget the trailing colon, but of course, without the "" marks).

Restart the VM and I also had to restart the host, and then you are good to go.

However, if this method doesn't work -- it didn't work on my Netbook. This alternative method described here does work. Of course, it requires the proprietary USB 2.0 EHCI support delivered via the optional "Extension Pack" to be installed.

like image 33
bdutta74 Avatar answered Oct 31 '22 00:10

bdutta74


Haven't tested, but it should be possible to map an USB device from Windows to Ubuntu via VirtualBox once the VirtualBox Addons are installed. I imagine Windows must know about the device for the routing, so try installing the FTDI chip driver on both Windows and Ubuntu and try to connect your board (see if Windows and then Ubuntu find the device).

You mentioned C/C++ works for you, so it might a lot simpler to just do the install straight on Ubuntu and use your C/C++ setup as opposed to the Arduino IDE. On the Arduino Playground there is a guide on how to setup on Ubuntu as well as a Development Tools guide

You might also find this question helpful. Do try the Electronics site as well, as it seems more suitable for your question.

like image 34
George Profenza Avatar answered Oct 30 '22 23:10

George Profenza