I have been trying with no luck to get the Raspberry Pi talking to an Arduino. I am using a 3.3 V-to-5 V converter to swap voltages. I did put an LED on the UART TX pin, and it looks like it was inverting the data. If this is true, what circuit do I need to get it communicating with the Arduino?
I am using a Cool Components Logic Level Converter. It is a transistor for 3.3 V to 5 V and resistor for 5 V to 3.3 V.
5 Answers 5
The GPIO of the Raspberry Pi are 3.3 V and they are not 5 V tolerant; this means if you drive 5 V to them, you may break the input. http://elinux.org/RPi_Low-level_peripherals has the information about the pins.
You can use one of these boards:
http://store.nkcelectronics.com/5v-to-33v-logic-level-shifter-bo.html
Or just buy a 74LS245 from Digi-Key or Mouser Electronics and connect it like this:
Low cost 5 V to 3.3 V converter
You can also use a single n-channel enhancement MOSFET for each pin if you have a few of those around. See the post Raspberry Pi and I2C devices of different voltage , or page 43 in the I2C bus specification. Since you only need two pins, this might just do the trick for you.
-
I used this approach connecting my Pi to my Arduino. This blog post has photos of a breadboard and a very clear diagram if you're not super confident: fritz-hut.com/connecting-an-arduino-and-raspberry-piStefan Mohr– Stefan Mohr2013年01月22日 22:18:33 +00:00Commented Jan 22, 2013 at 22:18
I'm using a CD4050 to do the level conversion from 5V to 3.3V and also to act as a buffer to protect my Raspberry Pi. The Arduino should see 3.3V as a logical high, so you shouldn't need to convert from 3.3V to 5V (I stand corrected here, according to the Arduino webpage any voltage over 3V is considered logical high).
I put together a quick example of using the CD4050, Raspberry Pi GPIO UART and Arduino here: http://www.andremiller.net/content/raspberry-pi-and-arduino-via-gpio-uart
Any comments are welcome, it's working, but I might have done it wrong :)
I actually have run across the same issue and have resolved it by running a barebones atmega328 with an Arduino bootloader at 3.3 volts, but at 8 MHz. The 8 Mhz may cause a problem if you have strict timing requirements. I, myself am only planning on using the Arduino to generate PWM for an rgb led strip, so it's ok if the frequency of the pwm is half of normal. My preliminary testing so far has indicated that the Arduino can receive the message just fine.
There is one simple solution you can remove any external power source of Arduino and connect Raspberry Pi's GPIO pin 1 to 5v pin of Arduino using jumper wire that way Arduino main power will be 3.3v and all its pins will have 3.3v instead of 5v. Now you can directly connect Uart pins of Pi and Arduino. Worked for me.