CAMERON KOO

Aspiring Audio Engineer

Screaming Wallet: An Accelerometer with Audio in Arduino C++

What's this project about?

I created a product that warns user when they drop their wallet. This wallet features an accelerometer, ADXL345, and a few lines of code from Arduino. The prototype in this project is an upscaled version. Note that the device is designed to only detect sudden drop. Therefore, it will not make a sound when someone walks, crouches and even jumps.

There are three main components in my design. They are input, output and reset.
A picture that shows the final product.

How does it work?

The main way to make sure that my product will detect a sudden drop easily and successfully is to obtain the changes and differences in all of the three axes, X-, Y- and Z-axis. This requires me to gather the raw data from event.acceleration.x,event.acceleration.y and event.acceleration.z. We detect the numeric data every 0.1 second to see if there is a sudden drop. Next, a sound would trigger when it is exceed a certain amount of changes in terms of x, y and z. One thing that helps determining if the device was dropped is thhe stable status that occurs after the drop. Therefore, if there is a huge change in intervals, then the product is stable and on a surface. It will make a warning to signal the user to pick it up. To improve the user experience, I included a password for user to set. The wallet would only stop the alarm when the password is entered.

abs() is used because sometimes the number can be negative depending on the side that it is acceleration
millis() is required because if after 5 seconds, if the number/index of the axes are not changed. It will make a sound to signal.

What's the password?

In the section with audioOut() and password. The program will keep playing a sample of a audio clip until password is entered. There are 8 buttons, 7 for keys and 1 for reset.

This is the code for the password section.

Libraries used:

<Wire.h>
<Adafruit_Sensor.h>
<Adafruit_ADXL345_U.h>