Sending and recieving over USB

The "Eleven" is our Uno-equivalent Arduino-compatible board, but with a number of improvements including prototyping area, a mini-USB connector, LEDs mounted near the edge, and the D13 LED isolated using a FET. [Product page]
Post Reply
stirling_AC
Posts: 1
Joined: Thu Nov 10, 2011 6:23 am

Sending and recieving over USB

Post by stirling_AC » Thu Nov 10, 2011 6:27 am

Hi,

I've just recently purchased a Freetronics 'Eleven' and am trying to send data to (and receive) over USB from Unity game engine.

I'm getting an error and am wondering if I require a USB host controller with this product or even a USB/serial chip?

Apologies for asking a daft question – I'm just starting out!

Anyone that can offer a suggestion would be welcome.

Cheers,

Allan

User avatar
jonoxer
Freetronics Staff
Freetronics Staff
Posts: 298
Joined: Sat Oct 15, 2011 11:31 am
Location: Melbourne, Australia
Contact:

Re: Sending and recieving over USB

Post by jonoxer » Thu Nov 10, 2011 9:50 am

microcontrollers and am trying to send data to (and receive) over the USB from Unity game engine.
I hadn't heard of Unity until you mentioned it, but it looks really interesting. Thanks for the pointer!
Do I require a USB host controller with this product or even a USB/serial chip?
With the firmware installed in the Eleven it acts as a USB slave ("device"), identifying itself as a serial port to the host. I guess that what you're doing is running Unity on a PC with an Eleven plugged in via USB, is that right? And you want events in the game to be sent to the Eleven, or vice versa?

The easiest way to handle that from the PC side is to treat the connection as a serial port, and make up your own simple message protocol. I showed an example of that approach in Practical Arduino in the "Oscilloscope / Logic Analyzer" project:

http://www.practicalarduino.com/project ... c-analyzer

A few years ago I also did a couple of projects linking Second Life to physical objects using the same technique.

I don't know what development environment you're using on the PC, but if you're working inside the browser you may not have easy access to the serial port. In that situation one of my favorite tricks is to use a serial-to-TCP/IP proxy, which opens a serial port at a preconfigured speed and exposes it as a network socket. Then you can make network calls to localhost and communicate to serial devices such as an Arduino on USB.

There are a few different serial/net proxies around depending on what operating system you're running: Serproxy, SerialNet.pde, JavaProxy, Tinkerproxy2, Funnel, etc.

If you can provide a bit more information about your actual development environment it'd be easier to give specific suggestions.
--
Jon

Post Reply