Addressing False interrupt Alarms: ADXL345 and ESP32 WROOM Module Setup

I've configured an ADXL345 connected to an ESP32 WROOM module to detect movements and count them via interrupt pin.

However, I've encountered a significant issue: despite no actual movements occurring, I'm receiving numerous false alarms.

In the last test, I received 67 interrupts within a 12-hour period.

Both the ADXL and WROOM32 are situated on a carbon steel electric scooter. Despite the scooter being stationary on the floor and untouched by anyone, I'm consistently getting false reports triggered by apparent movements. Any suggestions on how to resolve this issue would be greatly appreciated.

Code based on Datasheet

// adxl345
#include <Wire.h>
const int ADXL345_ADDRESS = 0x53;  // I2C address of ADXL345
const byte GPIO_adxl345 = 23;  //adxl_345 interrupt
int adxl345_motion_count = 0;  // count
// adxl345
 
// SETUP
void setup() {
  Wire.begin();                                  //i2c for adxl345 and  PCF8574
  Wire.setClock(100000);                         // Set I2C clock speed to 100 kHz
  pinMode(GPIO_adxl345, INPUT);


  Wire.beginTransmission(ADXL345_ADDRESS);
  Wire.write(0x2D);
  Wire.write(0x08);  // Set to normal operation mode    00001000 (0x08)
  Wire.endTransmission();

  //DATA RATE HZ
  Wire.beginTransmission(ADXL345_ADDRESS);
  Wire.write(0x2C);  // LOW/normal_power + data rate HZ
  Wire.write(0x04);  // Set data rate to 0.78 Hz.   LOW/normal power (0000 0100) data rate
  Wire.endTransmission();

  //   Wire.beginTransmission(ADXL345_ADDRESS);
  //   Wire.write(0x31);  // g range
  //   Wire.write(0x01);  // 4G=00000001(0x01)
  //   Wire.endTransmission();

  //ACTIVITY: ac/dc,x,y,z  inactivity: ac/dc,x,y,z
  Wire.beginTransmission(ADXL345_ADDRESS);
  Wire.write(0x27);  // Axis enable control for activity and inactivity detection
  Wire.write(0xF0);  //  0xF0 = 11110000  AC,X,Y,,,,,
  Wire.endTransmission();

  //  INT_1 / INT_2
  Wire.beginTransmission(ADXL345_ADDRESS);
  Wire.write(0x2F);  //  Interrupt mapping control INT1 or INT2  EF=INT1:activity others INT2
  Wire.write(0x00);
  Wire.endTransmission();

  // Interrupt enable for ACTIVITY
  Wire.beginTransmission(ADXL345_ADDRESS);  //  0x10= activity ON (00010000) all off(freefall,inactivity,tap...)
  Wire.write(0x2E);
  Wire.write(0x10);  // Enable just activity
  Wire.endTransmission();

  //Activity threshold
  Wire.beginTransmission(ADXL345_ADDRESS);
  Wire.write(0x24);
  Wire.write(0x07);  //  0-255 deimal  00000000-11111111     62.5mg * 255 =15,937mg(16g)  0x07=
  Wire.endTransmission();

  attachInterrupt(digitalPinToInterrupt(GPIO_adxl345), adxl345_new_motionISR, RISING);

}



void adxl345_new_motionISR() {
  adxl345_motion_count++;   
}

Please show a full circuit diagram of how everything is connected, I clouding power supply and GND lines. Some good photos if the actual connections would also help.

A moving vehicle is generally a challenging environment for electronics as they tend to be electronically noisy and you have to deal with lots of spurious signals, sources of extreme noise & spikes etc. Your long I2C lines are probably a liability and a long wire for the interrupt signal just as well. You may have to buffer it to lower the impedance with e.g. an opamp or just a simple Schmitt trigger buffer. There are many ways to do this.

However, before jumping to solution mode, let's see if we can understand the problem a little better.

Btw, is there any pattern to the spurious interrupts? Do they occur under certain conditions?

PS one more thing; fire safety is a concern with electric scooters. Whatever you do, ensure that your anti theft protection doesn't result in the vehicle burning down, taking the building it's in with it. This is starting to become a major headache; ask your local fire dept.

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