Light Alarm - Arduino tutorial

light alarm

In this project we'll be creating a light alarm. As it may be obvious from the name, this alarm triggers when there's a source of light directed at it.

What you'll need for this to work is:

  • Arduino Uno
  • Breadboard
  • 10 breadboard wires
  • 2 LEDs
  • 3 resistors - 220 Ω
  • Photosensitive resistor LDR
  • Buzzer
  • USB-B cable (or something else to power the Arduino)

parts

Once you have all the components, connect them like this.

fritzing

Once that's done, we need to code the sensor, LEDs and the buzzer. We're going to read the value from photosensitive resistor and we'll compare it with another value. If resistor's value is higher than the value we set, it's going to trigger the alarm. We can set the value from 0 to 1023, depending on how bright our surroundings are. You can play with the values or you can precisely tell at what value you want the alarm triggered. For that, take a look here.

And that's it! It should be working now, but if it isn't, leave us a comment down below and we'll try to help you.