ADXL 345 - UNO r3 not working

I recently purchased an ADXL 345 triple axis accelerometer, but it wasn't working. I tried an I2C scanner and it said that no i2C component was found. Another thing I should add is when I used multimeter to test the voltage coming in and out of each port on the ADXL345 I found that every port (apart from the ones I hadn't connected) where displaying 3.3V constantly. Does anyone know how I can fix this accelerometer?

Here is the wiring:

SDA Adxl 345 -------> B1 Logic Level Shifter -------> SDA Arduino
SCL Adxl 345 -------> B2 Logic Level Shifter -------> SCL Arduino
CS Adxl 345 -------> B3 Logic Level Shifter -------> Pin 9 Arduino
VCC Adxl 345 -------> 3.3V Arduino
GND Adxl 345 -------> GND Arduino
HV Logic Level Shifter -------> 5V Arduino
LV Logic Level Shifter -------> 3.3V Arduino

I also added some 4.7k ohm pull up resistors to the SDA and SCL from the logic level shifter to the ADXL 345 sensor.

sorry about the scrappy text diagram my circuit is a bit of a mess

Here is the I2C scanner code:

#include <Wire.h>
 
 
void setup()
{
  Wire.begin();
 
  Serial.begin(9600);
  while (!Serial);             // Leonardo: wait for serial monitor
  Serial.println("\nI2C Scanner");
}
 
 
void loop()
{
  byte error, address;
  int nDevices;
 
  Serial.println("Scanning...");
 
  nDevices = 0;
  for(address = 1; address < 127; address++ )
  {
    // The i2c_scanner uses the return value of
    // the Write.endTransmisstion to see if
    // a device did acknowledge to the address.
    Wire.beginTransmission(address);
    error = Wire.endTransmission();
 
    if (error == 0)
    {
      Serial.print("I2C device found at address 0x");
      if (address<16)
        Serial.print("0");
      Serial.print(address,HEX);
      Serial.println("  !");
 
      nDevices++;
    }
    else if (error==4)
    {
      Serial.print("Unknown error at address 0x");
      if (address<16)
        Serial.print("0");
      Serial.println(address,HEX);
    }    
  }
  if (nDevices == 0)
    Serial.println("No I2C devices found\n");
  else
    Serial.println("done\n");
 
  delay(5000);           // wait 5 seconds for next scan
}

Thank you!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.