Go Down

Topic: Arduino to Raspberry Pi communication options (Read 3963 times) previous topic - next topic

bruinlax

been messing around with my arduinos for a few months, and i'm trying to think out a my next project using communication

Setup:
2 arduinos to communicate to 1 raspberry pi
one arduino will be right next to the pi, the other will be 10-20 feet away from it. 
I would plan to connect using Cat5e

Data rate -not that much.   Pi will just periodically poll for switch states on the arduinos / tell them to turn led's on.

I'm new to non-ethernet communication, I'm trying to sound out which communication standard would work the best / easiest, and looking if anyone has any recommendations

USB to Serial:
Positives: this would be ideal if i could make it work, have the arduino's connected to the pi, and then able to communicate via usb to serial.  Allows me to "update firmware" by using the IDE from the pi
-Wouldn't have to worry about 5v vs 3.3
Cons:  Not sure how easily compatible it is with 2 arduinos  - a little bit more work playing w/ linux to recognize the ports.  expandibility might be limited if i want to add more chips.
-Not sure if the USB signal would carry that far.


direct into UART on pi:   
Cons: I think i'd need to "convert" the 5v to 3.3 to not blow up the pi.   
Question: Can i communicate to more than one chip? is there a library for that, or do wire software to set up  one as a "master" and "poll" for responses continuously from the chips.
Question:  any thoughts on the signal traveling through 10-20 feet of cat5?

i2c:
Pros: Easy expandibility in software if i increase the project
Question:  any thoughts on 10-20 feet of cat5?
Question:  any thoughts on the signal traveling through 10-20 feet of cat5?

Xbee:
Pros: Easy expandibility in software if i increase the project
Cons: prefer not to go wireless if i don't have to, increased cost / complexity

Anything else i'm missing?  i don't know what i don't know.

thanks





xbee:  would prefer to not have to go wireless, but could be an option

florinc

A somewhat cheaper wireless solution suitable for 20 feet is Bluetooth.

I2C is not recommended for distances longer than 1m (3 feet).
UART (TTL serial) should be ok for 20 feet cables. Using the SoftwareSerial library, you can use any pin for Rx/Tx.

Si

Arduinos with Ethernet?

Though I think the USB is the neatest option. With 2 Arduinos connected to a USB hub, I'm not sure whether you would get to /dev/tty devices, or one device with 2 Arduinos talking on it.

Either way I would imagine its possible, if they share a serial connection I guess you would have to use IDs to see who sends / gets the message.
--
My New Arduino Book: http://www.arduinobook.com

CyHamster

#3
Aug 15, 2012, 10:46 am Last Edit: Aug 15, 2012, 01:20 pm by CyHamster Reason: 1
Have you considered RS-485? Looked into it myself for a project, its fairly easy to implement with the right driver chips (I can't remember which ones I decided on for my project I think it was MAX485s but I'll check on the weekend if you'd like), cable run can be up to about 1km (yep really!), allows multi point connection and can use twisted pair cabling.

Covers everything you asked for I think  :)

Have a look at this:
http://arduino-direct.com/sunshop/index.php?l=product_detail&p=323

Graynomad

Rob Gray aka the GRAYnomad www.robgray.com

poliveira1978

you could try apache2 and PHP on the raspberry and the arduinos in client mode, perhaps...
you can take a look to an example of what i'm talking at here

winner10920

Regular ttl serial would be byfar easiest I would imagine, then you can still upload new code no problem if you bring over the reset line(Two pairs= (tx,rx,)&(reset,gnd)),
you could even make a custom board or just perboard the atmega328's and run them 8Mhz 3.3v to save any level shifting,
I've done it before, usually doesn't even need a crystal, all you really need is decoupling caps and you get two extra I/O, hardest part is chaanging the fuses for 8Mhz internal oscillator and loading the 8Mhz bootloader, which isn't bad once you know how
and with a 328p@ < 4$ your entire remote board would be less than 5$ ea and is easier/cheaper to expand on

Go Up