I2C accelerometer works with a mega, but not with a pro mini

Hello everyone,

I've done some work with an arduino mega, but I've just recently gotten my pro mini, maybe someone can see what I've overlooked.

I have an arduino mega 2560, a 9 DOF sensor stick from sparkfun, and a 5V/16MHz pro mini (ATMEGA 328P uC). I bought the 5V "FTDI Basic Breakout - 5V" to communicate with the board. My problem is that when I attach the pro mini to the sensor, all I get for output is a bunch of zeros. The mega works just fine with my test code for the accellerometer. I don't have an oscilloscope but I did check the voltage levels on the SCL and SDA pins coming from both arduinos- the mega gives me about 3.6V, the mini 3.3V. I think both of these voltages are okay from looking at the accellerometer datasheet.

Interestingly, while the sensor stick does have a built in regulator giving it 3.3V from the mega gives much cleaner data than from the 5V pin.

Thanks in advance for any pointers!

EDIT:

I'm using this FTDI breakout board FTDI Basic Breakout - 5V - DEV-10008 - SparkFun Electronics
this IMU SparkFun 9 Degrees of Freedom - Sensor Stick - SEN-10724 - SparkFun Electronics
and this pro mini http://www.sparkfun.com/products/9218

EDIT 2:

I'm assuming that the fix mentioned here http://www.nearfuturelaboratory.com/2007/01/11/arduino-and-twi/ is no longer valid, given that it's four years old and the minis are now based on a different uC.

Your aware that the mega and pro mini use different pin numbers for the I2C clock and data signals, right?

Lefty

Thanks for the reply!

retrolefty:
Your aware that the mega and pro mini use different pin numbers for the I2C clock and data signals, right?

Lefty

Yes- On the mega I use pin 20 for SDA and 21 for SCL. On the mini I'm using pin 4 for SDA and 5 for SCL. I tried switching them as well on the mini, just in case I'd done something stupid.

analog or digital pin 4 and 5?

First, you really should use a level translator when interfacing a 5V Arduino to 3.3V sensors (the 3.3V regulator is for power only...not IO).

You mentioned that you were having issues communicating with the accelerometer, are you having the same problems communicating with the other sensors on the board?

thewknd:
analog or digital pin 4 and 5?

Oh my god... That was it >_<. Naturally I went straight to the oscilloscope and the wire library code instead of just taking a look at the bottom of the board for two seconds.

Thank you!

EDIT: Can someone modify the Pro Mini page so it says "I2C: A4 (SDA) and A5 (SCL)" instead of "I2C: 4 (SDA) and 5 (SCL)"? Hopefully it'll save some poor sap like me hours and hours of head scratching.

A4 and A5 are aliases for when the analog pins are used as digital pins. Since that is not what the I2C class is doing, I don't think that using A4 and A5 is a good idea.

Making it clear that the pins are the analog ones is, though.