DIY Bike Alarm

This version of a DIY Bicycle alarm is easy to make, cheap and keep a potential thief away. This DIY Bicycle Alarm will make an alarm noise when the bicycle is going to be moved and the angle of the bike changes to more than 15%. To get this functionality the system is made with a tilt sensor and a speaker connected to an Arduino. The tilt sensor will recognise when the angle position of the bike changes and triggers a speaker to make some alarm noise. All together with a battery it will still small enough to fit into a box that can be mounted to the bike. The parts you will need for this project:

Needed parts:

For testing, it is good to have an extra breadboard for the tilt sensor, så, you can move it around better.

Hardware Setup

The Code that brings everything to life

int inPin = 2; // the number of the input pin
int reading; // the current reading from the
input pin const int SpeakerPin = 8; // the number of the Speaker/Buzzer
pin void setup(){
pinMode (inPin, INPUT);
void loop () {
reading = digitalRead(inPin);
if (reading == 1) {
tone(SpeakerPin, 494, 500); // if tilted, turn the Speaker ON delay(500);
} else {
noTone(SpeakerPin); }
Serial.println(reading); // only for debugging
delay(200); // pause 200 milliseconds between readings
// End of Code

And finally it's up to you to put everything in a box and mount it to your bike.

This is how it looked like when I was testing it.