Hackster is hosting Hackster Holidays, Ep. 7: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Friday!Stream Hackster Holidays, Ep. 7 on Friday!
Salman Faris
Published © CC BY-NC-SA

Burglar Alarm

A simple burglar alarm built using an ATtiny45. You can attach it anywhere and will it will inform when someone tries to steal something.

BeginnerFull instructions provided2 hours18,879
Burglar Alarm

Things used in this project

Hardware components

ATtiny85
Microchip ATtiny85
×1
Buzzer
Buzzer
×1
Hall Effect Sensor
Hall Effect Sensor
×1
Coin Cell Battery CR2032
Coin Cell Battery CR2032
×1
Coin Cell Battery Holder
Coin Cell Battery Holder
×1
SparkFun Capacitor 0.1uF
×1

Software apps and online services

Arduino Web Editor
Arduino Web Editor
Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Laser cutter (generic)
Laser cutter (generic)

Story

Read more

Schematics

Burglar Alarm Circuit Diagram

Burglar Alarm Circuit Design

Code

Burglar Alarm Code

Arduino
void setup() {

  pinMode(2, INPUT_PULLUP);

  pinMode(3, OUTPUT);

}

void loop() {
  int data = analogRead(2);

  if (data >= 500 )
  {
    digitalWrite(3, HIGH);
  }
  else
  {
    digitalWrite(3, LOW);
  }

}

Credits

Salman Faris
26 projects • 418 followers
Maker | Hardware Hacker | Electronics Enthusiast

Comments