Go Down

Topic: Connecting two Arduinos via (wireless) USB.... (or Xbee) (Read 3081 times) previous topic - next topic

Psycho

Sep 15, 2012, 06:06 pm Last Edit: Oct 13, 2012, 10:13 am by Psycho Reason: 1
Hi!

I want to send data from one Arduino board to another via USB (it has to be via USB!) and there will be no host device (like a PC) connected to the boards (after programming ;-) . One board will geather data from a sensor and then send it to the other board that will use the data.


1) As far as I understand, I will need two Arduino boards and one USB shield (setting up the shield as host device). Or do I need a second USB shield?

2) I have found alot information about wireing two boards connecting some pins - an option I can't use. But I have not found any information on connecting via USB - can someone point me to a guide please?

3) Are there any problem with this setup? Has Anybody done it successfully?

PaulS

Quote
(it has to be via USB!)

Why? You can connect the serial port pins, and ground, between two Arduinos and easily exchange serial data.

Pushing the data through the USB to serial chip is a lot harder.

Quote
I have found alot information about wireing two boards connecting some pins - an option I can't use.

Why can't you?

Quote
But I have not found any information on connecting via USB - can someone point me to a guide please?

You'll need to write a driver for the Arduino to use to command the host shield. Not a trivial task.

Psycho

I didn't want to write all this up, but unfortunately some people wont except a simple "it has to be USB" :-(

It has to be USB, because the connection will be via the back channel of a wireless video system that has a USB "back channel". And that system has no wires hanging out to connect pins. USB will also be much more future proof, if I have to use another setup. This is not ment to be a toy setup on a table, its for a professional film production wireless follow focus system. The video system transmits live view of the camera to a remote monitor. The input for the Arduino will be a puls encoder operated by the camera assistant at the remote monitor. The data beeing the number of steps to the next focus point. The second Arduino will use that data and drive a stepper motor rotating the fokus ring on the lens. Once programmed the system has to work independently of a PC. And to keep it simple on set, I won't use an extra wireless system for the focus control - the video transmitter is enough (it has a USB 2.0 channel built into it).



Quote
You'll need to write a driver for the Arduino to use to command the host shield. Not a trivial task.

I thought there is a library for use with the USB shield? Where can I find information about writing a driver?

dxw00d

Quote
system that has a USB "back channel"


That would suggest that the Arduinos are not connected directly together. How does this 'back channel' appear? Is it a standard, type A, usb socket? If it is, then the device must be acting as a usb host, and that will make a difference to making your requirement work. What devices would normally be connected through this channel? Do you have any documentation on how it works?

zoomkat

Quote
Where can I find information about writing a driver?


The below book might help you get up to speed on USB.

http://www.lvr.com/usbc.htm
Google forum search: Use Google Advanced Search and use Http://forum.arduino.cc/index in the "site or domain:" box.

Psycho

Quote
How does this 'back channel' appear?


Physically this is a standart USB plug:
receiver has type A socket
transmitter has type mini-B socket(?)

Its normally used to connect a keyboard, mouse,... to controll the PC (while the PC is sending the video stream the other way to the display). So, it is "more or less" a pass through USB connection.

I tried, if it is a simple point-to-point electrical connection by just applying some voltage to the one end and measuring the output, but unfortunately its not that easy. The system needs a USB host device that sets up the protocoll.

When a keyboard is connected, the computer sees the keyboard as if it was directly pluged into the computer - the wireless system does not appear itselfe. So, if I can set up two Arduino boards to communicate via a normal USB cable, I'm pretty sure a can replace the cable with the wireless system.


Quote
The below book might help you get up to speed on USB.


Thanks, but I'm not going to buy an expensive book - there must be some more information on the web. Has nobody ever tried this? (I'm a bit disappointed now, I thought the Arduino community has exploited the possibilities of that littel board far more than some blinking LEDs :-(

zoomkat

Quote
Thanks, but I'm not going to buy an expensive book - there must be some more information on the web. Has nobody ever tried this? (I'm a bit disappointed now, I thought the Arduino community has exploited the possibilities of that littel board far more than some blinking LEDs :-(


Well, I guess I'll be the one to tell you: From what I've seen so far, I just don't think you have the depth of knowledge of the project you want to do to complete the project any time soon. You are starting to sound like a kid getting upset and whining because nobody will tell him how to build a nuclear reactor for his school project.
Google forum search: Use Google Advanced Search and use Http://forum.arduino.cc/index in the "site or domain:" box.

silasmoeckel


Hi!

I want to send data from one Arduino board to another via USB (it has to be via USB!) and there will be no host device (like a PC) connected to the boards (after programming ;-) . One board will geather data from a sensor and then send it to the other board that will use the data.


1) As far as I understand, I will need two Arduino boards and one USB shield (setting up the shield as host device). Or do I need a second USB shield?

2) I have found alot information about wireing two boards connecting some pins - an option I can't use. But I have not found any information on connecting via USB - can someone point me to a guide please?

3) Are there any problem with this setup? Has Anybody done it successfully?


This is really not that complicated a usb host shield can connect to the usb->serial adapter on the other unit.  Worst case you will also need a ftdi usb->ttl serial but this is base functionality for the shield and library that goes with it.  At that point you have a point to point serial link do whatever you want with it. 

Psycho

Hi silasmoeckel,

thanks for chiming in. Please be so kind and share some of your knowledge :-)

I thought the USB shield for the Arduino is just some sort of "ftdi usb - ttl serial" bridge? (As far as I understand what that is from my short search on the web.) Or am I missing an important point?


Do I need a USB shield on both ends - or can the normal USB connector (that is used for uploading the program code) be used at least on the slave side? (Sending data like if it is connected to the PC and using the serial monitor.) That would make the setup smaller and cheaper.


I will have a look at the serial library. Do you know of any resources (on the web) where I can get a bit more help with this speacial case of USB point to point connection with Arduino boards?

zoomkat

Quote
It has to be USB, because the connection will be via the back channel of a wireless video system that has a USB "back channel".


Does the USB "back channel" just act as a wireless USB connection between two USB gizmos?
Google forum search: Use Google Advanced Search and use Http://forum.arduino.cc/index in the "site or domain:" box.

Psycho

Quote
Does the USB "back channel" just act as a wireless USB connection between two USB gizmos?


Yes and no, after some tests I think it is like a simple connection but it also functions as a USB hub. You can only use it with the proper USB protocoll - it does not allow to send some random electrical pulses. I think its implemented this way, because you can have several receiver units with several input devices (e.g. keyboards) comunicating with one transmitter device. I have used it with two receivers watching the video on two screens, but I have not tryed to connect more than one USB device (as I won't need it anyway).

So, I really have to tell the system: "Hello, here is a USB host device and that over there is a USB slave device, now set up a connection and send data".
(Thats the only reason I'm using Arduino at all, if it were a simple point-to-point wireless electrical connection, I would have been able to just make an electrical circuit that drives the stepper motor.)

zoomkat

To test the back haul capability, I'd connect a pc with the arduino IDE to the base back haul USB connection and an arduino to the remote USB connection and see if simple basic communication can be accomplished (or attach other USB device like a printer, usb web cam, etc. to see if they work thru the back haul). If that works, the it is back to the issue of making the base arduino function as the USB master.
Google forum search: Use Google Advanced Search and use Http://forum.arduino.cc/index in the "site or domain:" box.

Psycho

So, after writing a small programm that sends and receives data from the serial monitor, I tryed it with the Arduino connected to one end of the wireless system and my computer to the other end. It does not work :-(

The computer does not see the Arduino. The computer (Mac book) does see the wireless system but it seems to only support keyboards and similar devices (my Powermate does work). Even after connecting my keyboard to the wireless system and plugging the Arduino into the USB hub of the keyboard, the Arduino is not seen by the computer, also the keyboard is working.

Thats quite a bit disappointing. I will have a look into setting up the Arduino as a "keyboard" (there is a USB keylogger example somewhere). But I don't know if that will work. I will also look into other wireless HDMI transmitters and the wireless shield for the Arduino (but that might be problematic with other wireless systems on set).

Any ideas about wireless connections between Arduino boards?

Psycho

Small update:

After some more testing I think that USB port on the wireless system is only usefull for keyboard/mouse. Those companies crippling there hardware by software are really annoying, as there are normal USB controller chips on the boards, they are just set up in a very specific way. Bad news!

So, two options left:

1) Using the "remote control" channel of the wireless system that is desigend for transmitting the infrared pulses of a remote control.
Pros: no extra receiver/transmitter, very strong wireless connection. Cons: only one "wire" so I will have to work with frequency modulation (which makes it a slow connection), not future proof as other HDMI wireless kits might not work the same way.

2) Building a wireless system with Arduino and the Xbee boards.
Pros: future proof/independent of the HDMI wireless kit, I can set it up to my specific needs. Cons: extra receiver/transmitter (consuming more money, power, space, weight,..)

I think I will go with 2) using Arduino with the Xbee boards. Has anybody used two Arduinos with a Xbee (series-1) each to set up a simple point-to-point connection and can comment on reliability in real world usage, especially how it works with no direct line-of-sight of receiver/transmitter?

tack

#14
Oct 14, 2012, 06:58 pm Last Edit: Oct 14, 2012, 07:01 pm by tack Reason: 1
For wireless comms between Arduinos, take a look at the nRF24L01 modules. You can get them from china for £1.32 each on eBay, or about 2.50-£3.00 from UK.

Then look for RF24 and RF24Network libraries by maniacbug.

I've started playing with these myself and they are nice little devices. If you don't need to transmit far, less than 10m, the those cheap low powered ones will do. If you need more range then you get higher powered units for about £7.50 each.

They are a much cheaper alternative to XBee, Zignee or Wirelss Shield. They also work in 2.4Ghz so you can use any normal wifi type antennas with the higher powered ones.

Go Up