i try to connect to adxl345 to arduino uno with connection i2c
i want to connect the adxl345
I2C mode:
CS ->3V3
SDO -> GND
SDA ->A4
SCL -> A5
VCC ->3V3
GND -> GND
any help plz
It depends on the module that you have. Can you give a link to the ADXL345 module that you bought ?
In general it is like this:
Connect GND of both ADXL345 to Arduino GND.
Connect VCC of both ADXL345 to Arduino 3.3V.
Connect SDA of both ADXL345 to Arduino SDA (or A4 for an Arduino Uno).
Connect SCL of both ADXL345 to Arduino SCL (or A5 for an Arduino Uno).
Connect CS of both ADXL345 to 3.3V.
One module should have the SDO connect to GND, and the other module should have it connected to 3.3V.
Run the i2c_scanner : Arduino Playground - I2cScanner
Many modules have already pullup or pulldown resistors on some lines. You should also have pullup resistors of 4k7 from SDA and SCL to 3.3V.
Hello KOEPEL
thank you for your help
this link for adxl345
Tomorrow i will try this
i can connect 3+ adxl345 with one arduino ?
but in coding How I can detect the acceleration just which ADXL345?
thank you again
This one ? ADXL345 3-Axis Acceleration of Gravity Module - emartee.com
It has already 4k7 pullup resistors for SDA and SCL.
It has a voltage regulator, that means you better use the Arduino 5V pin to power it via the module VCC. But you have to be sure that none of the pins will be connect to 5V, if you need to pull a pin high, connect it to 3.3V.
There is a pullup resistor for CS (10k), so you don't have to connect CS to something.
I don't know if SDO is connected to 3.3V.
With SDO, there are two possible I2C addresses. If you need three, you might need this: TCA9548A I2C Multiplexer : ID 2717 : $6.95 : Adafruit Industries, Unique & fun DIY electronics and kits
For a library, look into the Libary Manager. There are probably one or two libraries from Adafruit.
Thank you Koepel for information
the adxl345 run now
i want to ask the last question : how i can calibrate the adxl345 ?
Hi!
I am new to Arduino and trying to connect 2 ADXL345 accelerometers using I2C.
I performed address scanning and got the addresses as 0x1D and 0x53 for the sensors.
while reading data, only 0x1D responds, 0x53 is not providing any data.
Code for the same is:
#include <SoftwareSerial.h>
#include <SparkFun_ADXL345.h>
ADXL345 adxl1;
ADXL345 adxl2;
void setup()
{
Serial.begin(9600);
adxl1=ADXL345();
adxl2=ADXL345(0x53);
adxl1.powerOn(); // Power on the ADXL345
adxl2.powerOn();
adxl1.setRangeSetting(16); // Give the range settings
adxl2.setRangeSetting(16); // Accepted values are 2g, 4g, 8g or 16g
// Higher Values = Wider Measurement Range
// Lower Values = Greater Sensitivity
adxl1.setSpiBit(0);
adxl2.setSpiBit(0);
Serial.println();
}
void loop()
{
int x1,y1,z1;
int x2,y2,z2;
adxl1.readAccel(&x1, &y1, &z1);
adxl2.readAccel(&x2, &y2, &z2);
Serial.print(" ");
Serial.print(z1);
Serial.print(" ");
Serial.print(z2);
Serial.print(" ");
}