how i can connect 3 adxl345 to an adruino uno ? in datasheet i read i can connect one to the address 0x53 with sdo to gnd and the other one to address 0x1d with sdo to Vcc. how can i connect a third adxl345?? how can give unique address to adxl345 ?
There was a very similar post yesterday about (I think) the MPU6050
Why not use SPI? Connect SDIO, SDO, SCLK together to the corresponding pins on the arduino, then use different pins for CS. CS is used to let the arduino know which device you are talking to.
Page 15 of the datasheet.
AWOL : my project is to use i2c connection . how i can give each adxl345 a different address?? thank you for help
I think the trick is to give two of them at any one time different addresses, and only talk to the third.
I don't have an ADXL345, so I've never tried it.
First: RTFM. Next: Follow AWOL's advice.
The ADXL345 has an ALT ADDRESS pin. You can change the address by toggling this pin. So:
- Set all 3 ALT ADDRESS pins to a particular state.
- Change the ALT ADDRESS of one of the chips to the other state.
- Talk to this chip using the address for that state.
- When done, reset the state to the same as the other two.
- Repeat as needed with the other chips.
It will require 3 Digital Outs from the Arduino.
KeithRB : thank for your help
But i don't understand how to change the ALT ADDRESS to particular state ? what you means in state ? and how i can find the address of state ?
Jeez, you referred to it in the OP:
in datasheet i read i can connect one to the address 0x53 with sdo to gnd and the other one to address 0x1d with sdo to Vcc.
state: a particular condition for the pin: HIGH or LOW, 1 or 0, 5 V or GND. I said "state" because it doesn't matter which one, you just have to pick.
You have to connect a Digital Out on the Arduino to each of the ALT ADDRESS pins.
In a sense you are turning the ALT ADDRESS into a chip select pin.
thank you again the last question how to Talk to this chip using the address for that state. ?
Using the I2c library.