Is it possible to connect a 3.3v Arduino Mini Pro straight to a Raspberry Pi using the i2c pins? I've done a bunch of searching but everyone talks about connecting to a 5v Arduino with a shifter/bridge between the two. If it is possible then do you connect the SDA to SDA, SCL to SCL, GND to GND and 3.3v to 3.3v? Only power the Raspberry Pi?
Thank you for any advice and/or guidance.
should work if both the raspi and arduino are 3.3v
All right except do not connect the 3V3 lines together, that will cause trouble if the power is at both ends. The 3V3 on the Pi can only supply 50mA.
I hooked up my 3.3 Arduino Pro mini directly to the Raspberry pi, SDA to SDA, SCL to SCL, GND to GND and 3.3v to 3.3v. The arduino powers up and looks to be functional however when I run "i2cdetect -y -a 0", it does not show a connected i2c device. I'm sure my i2c is working on the RPi because I hooked a separate i2c device and the i2cdetect command finds it no problem. Do I need specific code to run on the arduino in order for it to respond to the i2cdetect command?
I've done a lot of google searching and all I can find is examples of Raspberry Pi connected via shifter/bridge to a 5v Arduino. I would be shocked if I was the only one that has ever tried connecting it to a 3.3v Arduino when it should be much simpler.
Also I am using the 3.3v from the pi to power the Arduino. I also tried only connecting the two i2c lines by themselves and using the usb to serial to power the arduino with the same results.
Do I need specific code to run on the arduino in order for it to respond to the i2cdetect command?
Yes, you do. Use the Wire library Wire - Arduino Reference. Tell the code your chosen address and register the receive and request handlers.
I would be shocked if I was the only one that has ever tried connecting it to a 3.3v Arduino when it should be much simpler.
Connecting a Pi and an arduino through I2C is not the smartest idea on the planet. One reason is that the arduino will have to run in slave mode. This means it can't initiate any communications by itself, it has to wait to be polled by the Pi before it can send data back. Another thing is that you will have to fashion a software interface so the arduino looks like an I2C slave accepting register bytes or code bytes, and then sends the fixed number of bytes back.
So what would the recommended way to communicate multiple Arduinos with one Raspberry Pi?
k3v1np:
So what would the recommended way to communicate multiple Arduinos with one Raspberry Pi?
Powered USB hub?
Grumpy_Mike:
I would be shocked if I was the only one that has ever tried connecting it to a 3.3v Arduino when it should be much simpler.
Connecting a Pi and an arduino through I2C is not the smartest idea on the planet. One reason is that the arduino will have to run in slave mode. This means it can't initiate any communications by itself, it has to wait to be polled by the Pi before it can send data back. Another thing is that you will have to fashion a software interface so the arduino looks like an I2C slave accepting register bytes or code bytes, and then sends the fixed number of bytes back.
The Arduino Wire library does all that.
k3v1np:
So what would the recommended way to communicate multiple Arduinos with one Raspberry Pi?
i2c should work. You'll need the Wire library - Wire - Arduino Reference
The Arduino Wire library does all that.
No it doesn't get over the problem:-
the arduino will have to run in slave mode. This means it can't initiate any communications by itself, it has to wait to be polled by the Pi before it can send data back.
Yes there are ways for it to run in slave mode using the Wire library, but that does not mean it is a good idea.
GPIO pins 14 and 15 on the Pi, are serial lines, you can connect this to the arduino's TX & RX. The only thing you have to watch is that the arduino sends a 5V signal so put a 330R between the arduino's TX and the Pi's RX line with a 3V3 zener diode from the Pi's RX line to ground to bled off the extra voltage.