Help About Car alarm.

we have this project about Car alarm its like car shock sensor but using ADXL345 3-Axis Digital Accelerometer and an arduino. The problem is that we have no idea what threshold should we put before the alarm of the car will be activated and we have no car to just test and read the value. What i mean by threshold is the difference between the previous reading and the new reading of the accelerometer. Any suggestion what values can we put in the threshold? Thanks :slight_smile:

This is the part of the code where it will compare and activate the alarm

 if(px>x) dx = px-x; else dx = x-px;
    if(py>y) dx = py-y; else dy = y-py;   
    if(pz>z) dx = pz-z; else dz = z-pz;  
    
    if(dx>THRESHOLDX || dy>THRESHOLDY || dz>THRESHOLDZ)
   {
     if(millis() - time_last_alarm > 10000) 
     {
     alarm_acc = true;
     time_last_alarm = millis();
     }
   }

Add a calibration routine to your sketch, that allows to enter the threshold values via Serial. Then store the values in EEPROM.

As for the values, please give examples of events that should trigger an alarm, and which should not. Eventually mount your sensor onto some toy car, chair, desk or some other object, do with it what you think should trigger an alarm, and record the observed accelerations. Then you can find out already, whether your algorithm will allow to trigger an alarm at all.

@DrDiettrich
Noted sir. Thanks for the help :smiley:

Our project is about car alarm. But instead of using car shock sensor we will use adxl345 accelerometer. The problem is I don't know what value to put to imitate the sensitivity of the car shock sensor. Any idea what value will that be? Thanks in advance :slight_smile:

No one can tell you this because you do not know enough information to calculate it. You will have to try it physically. It will depend on your specific car and where you mount it.

@vernon56, do not cross-post. Threads merged.