I want to send info from a raspberry pi to an arduino and vice versa using serial communication. Do i need a level shifter to accomplish this? Or can i communicate between the two without a shifter?
2 Answers
It depends.
USB to USB will be fine.
If your Arduino is 3V3 it will be fine (the Pi's gpios are all 3V3).
If your Arduino is 5V (most are 5V) you will need to AT LEAST level shift the Arduino TX gpio to the Pi RX gpio. All you need are a couple of resistors. See http://en.wikipedia.org/wiki/Voltage_divider
If the Arduino RX gpio is always an input you may connect it directly to the Pi's TX gpio. It would be safer to use a current limiting resistor, perhaps 10K and work down until it works.
-
If i understand you correctly, you can communicate in serial between the arduino and the raspberry pi at different logic levels without a level shifter if i use the usb?– PaulDec 31, 2014 at 15:31
-
As @joan has stated the easiest is to use USB. Direct connection requires level converters (these are cheap enough).
Direct connection implies the devices are in close proximity, but in this case it may be better to use I²C. http://blog.oscarliang.net/raspberry-pi-arduino-connected-i2c/ shows an example. I have used something similar to this with a direct 3-wire connection to replace a previous serial connection. I²C allows simpler logic (using Arduino as slave) - although slightly slower than the maximum you can achieve with serial.