Integrating the accelerometer with the power, button and speaker circuits for the bag movement alarm project

I had previously developed the power circuit, then added the 4 buttons and the speaker to build a button based secret code system, but I had developed the algorithm to use the accelerometer to determine if the device had moved enough to be considered stolen as a separate element.

So I needed to integrate them together.

It was actually fairly simple.  I had abstracted away much of the activity into functions, so I could simply copy and paste the functions into the bottom.  The constants I needed to be a little more careful with where I placed, them, and I also grouped the user changeable ones in the same place with the user changeable constants from the button based secret code.

The only thing I really had to think about was putting the button based code section inside a section about the accelerometer, so that the button based code only starts once the device is considered to be stolen.  This makes it so that the only way to turn off the device is to trigger the alarm.  Ideally, you would be able to turn the device off (via the secret code) without triggering the alarm.  Something to change in the future.

The circuit, with the accelerometer integrated:

With accelerometer integrated

With accelerometer integrated

With accelerometer integrated

With accelerometer integrated

And a video of it operating, in all its glory!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s