I am starting a personal project of home automation and I have a raspberry pi and an arduino Uno board.
I want communicate raspberry pi and my arduino where my raspberry should be able to write and read signals to and from arduino.
The distance between them I think its going to be something around 10 to 15 meters.
What do I need for it? what kind of wires or other components I'll need to achieve my goal? I repeat: I do not want to communicate raspberry pi and arduino wirelessly.
Thanks!
-
Not sure but I think you could just run a USB cable and read and write to the Serial port?evamvid– evamvid2014年04月06日 14:51:35 +00:00Commented Apr 6, 2014 at 14:51
-
What about the usb limitation of 5meters?thiagoh– thiagoh2014年04月14日 00:55:57 +00:00Commented Apr 14, 2014 at 0:55
-
you're right -- I didn't know about thatevamvid– evamvid2014年04月14日 00:57:42 +00:00Commented Apr 14, 2014 at 0:57
2 Answers 2
The Raspberry Pi and all microcontrollers used in the Arduinos natively support a number of standard protocols, e.g. RS-232 (often called "UART" on embedded platforms), SPI and I2C/TWI, for each of which you will find plenty of tutorials.
RS-232 is probably the most robust of them when it comes to long transmission distances, but at the 10 to 15 meters you're expecting, you should reduce the bit rate to avoid transmission errors.
RS-232 in its simplest form only requires a common ground wire and one data wire per transmission direction.
You will be using RS-232 with TTL levels (0 Volt/+5 Volt instead of the up to -15 Volt/+15 Volt defined by the original standard).
Be aware however that the Raspberry Pi operates at 3.3 Volt, while the Arduino is likely to use 5 Volt — enough to damage the Pi — so you will need a level shifter of some sort. Since you're not going to need (or get) high speed anyway, a resistive voltage divider will be sufficient (there are tutorials for that too).
Look into Motenio at lowpowerlab.com. This is an Arduino clone with a built-in 433 mHz radio. Use one motenio as a gateway to the Raspi via rs-232. Then you can have up to 127 other motenio's communicating via 433 mHz link to the motenio/Raspi hub.
I have this set up at my house, along with a webserver on the Raspbi. I have aan effective range thru brick walls of aprox. 700 ft. Works great!