Accelerometer fall detection

Hi Everyone,

I want to make a fall detection device for a motorbike using an accelerometer.

I want to be able to press a button in a widget which will store the xyz value (incase I park it on a hill as opposed to a flat surface) and from then if there is any change in the xyz value it will send me a push notification, essentially detecting if the bike has been knocked over.

Essentially it would work like this;

Turn movement detection on and off.

Press widget button on > virtualpin(V0) “high” > store current XYZ value > if XYZ value changes == “Movement detected” > If “Movement detected” then Blynk.Virtualwrite(V1)

or

Press widget button off > virtualpin(V0) “low” > clear XYZ value

Please help me out team.

Thanks.

Your virtual pin handler would look like this:

BLYNK_WRITE(V0)
{
 if (param.asInt() ==1)
  {
    // your code in here to store current XYZ value
  }
  else
  {
    // your code in here to clear XYZ value 
  }
}

and you’d use a BlynkTimer to call a function which reads your accelerometer on a regular basis, compares the current value to the stored value, and alerts you if there is a significant difference in the readings.

Presumably you also want to disable alerts when you’re riding the bike, so you could use a flag variable to achieve that…

Pete.

1 Like

Thanks Pete, I will start with that and put together a sketch and check back in if i’m having any trouble.