A bike alarm that alerts you if your bike is being stolen and contains a GPS tracker.
For the final project of a networked system using an accelerometer, Karim and I created a bike alarm system. This device will measure excess amount of movements, like those of someone stealing the bike. The alarm will also contain a GPS module so that the bike owner can track the location of their bike if it was stolen. The alarm will be connected to the internet in order to send text messages to the bike owner, normally via Wi-Fi, but for our demo will used an Ethernet connection. The accelerometer will set its initial values immediately after the device is turned on and will continue to track movement until the alarm is turned off. This device will be very useful for bike users, as well as scooter and other small forms of transportation users. This alarm is more effective than other alarms because it does not simply deter the thief, but also alerts the owner if their possessions are in danger, creates noise in order to deter theft and allows the bike’s location to be tracked.
Our current implementation of Bike Buddy is broken down into three main components, each on a separate Arduino. There is one for detecting motion and GPS coordinates, one for receiving input from the other Arduino, and one to send a text message to the bike owner via Ethernet. Our goal would be to be able to fit all of this information onto one Arduino, but our sketch became too big, so we had to subdivide and simplify.
For our first Arduino, which I will call the sender, we had a buzzer, an on/off switch, and accelerometer, a GPS module and an Xbee module and shield. Unfortunately, due to lack of sketch space, we were unable to have the GPS display data because the sender was sending information to another Arduino to have it perform an action, not to display the given information. In our loop function of our code, we initially check to ensure the switch is on before performing any action and, if it is not on, we turn off the buzzer and set the movements count to zero, so the Bike Buddy will start fresh when it is turned on. If the switch is on, the Bike Buddy then calibrates the accelerometer so it can later accurately detect acceleration. It then enters a while loop where it calculates the total magnitude of acceleration based the accelerometer readings and uses a function called motionDetects() to compare the total magnitude of acceleration to the set threshold. If it is above this threshold, the total number of movements, the integer movements, is increased. Once movements has crossed its own threshold, it sends a message to the next Arduino.
The second Arduino in the Bike Buddy is the receiver. This Arduino has an Xbee module and shield and a buzzer. It is a very simple code that simply turns on the buzzer once it has received a certain message from the sender. This Arduino is mainly a proof of concept showing that Bike Buddy could exist on two Arduinos, the sender and a text sender. This Arduino shows that a message can be sent from the sender and that the message can trigger another action. The third Arduino is the text sender. This Arduino uses an Ethernet shield, but would normally connect to the internet via Wi-Fi. Currently, the text sender uses Temboo and Twilio together to send a message to the bike owner. The bike owner would need to sign up for Twilio in order to add their phone number to the Bike Buddy and receive the messages. The Twlilio account information will then be inputted into the Bike Buddy Temboo account list. The Arduino then accesses the bike owner’s information inputted on Twilio via Temboo and uses the Twilio account to send the user a message. Normally, the text sender would, if on one Arduino, send the message if it crosses the movements threshold, or if on two Arduinos, send the message when the sender sent the message via Xbee once it passed the movements threshold.