Pages: [1]   Go Down
Author Topic: ADXL345 + Uno R2 works while ADXL345 + Leonardo R3 does not  (Read 1464 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi all,

I bought three Leonardo's in hopes of replicating an accelerometer design based on the ADXL345 breakout. In my prototype with Uno R2 I have the system working perfectly using the code available from the Bildr tutorial here: http://bildr.org/2011/03/adxl345-arduino/.

However with Leonardo R3, the serial is spamming me with continuous activity and double taps even though nothing is happening. Exactly same wiring, same code, three soldered Leonardos tested. Always the same problem.

Could somebody please enlighten me a bit? What's wrong with I2C on Leo? I'd prefer not doing the code and soldering again to try with SPI..

Thanks.
Logged

0
Offline Offline
Shannon Member
****
Karma: 215
Posts: 12455
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

That webpage looks wrong.  You _must_ have 4k7 pull-up resistors from SCL to 3V3 and from SDA to 3V3.
Logged

[ I won't respond to messages, use the forum please ]

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for the reply MarkT. I understand that the current setup might not yield perfect results. However it works on the Uno. Is there an internal pull-up resistor in the Uno that's missing from Leo?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Fixed. It was an obvious mistake. The SPI and i2c pins have changed on the Leonardo. Attaching the SDA directly to the "SDA" pin and SCL to "SCL" works. Still without any resistors.
Logged

0
Offline Offline
Shannon Member
****
Karma: 215
Posts: 12455
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

From what I see from the docs that breakout doesn't have pull-ups.  The fact it happens to work now could mean there are some weak-pull ups somewhere - if so the I2C bus may well be running out-of-spec and it could stop working or go intermittent without warning - perhaps your breakout does have pull-ups installed though? Easy to check with a multimeter.  4k7 is the recommended value.
Logged

[ I won't respond to messages, use the forum please ]

Pages: [1]   Go Up
Jump to: