Arduino Light Sensitive Door Bell




About: Hi my name is Alex and I love creating stuff. I dabble in a bit of html coding, writing, and programing and I'm alwase finding new things I love. Also I'm a 17 year old Jesus freak that has a crazy life (I m...

Now let me start this off by saying I'm sure this has been done before so if anyone has a door bell that looks like mine I apologize. I came up with the idea on my own and didn't research anything so I wouldn't steal someone's idea so all I'm saying is this is original content. This arduino project is simple and I made it to test my skills as I'm learning so it doesn't take an arduino pro to pull this door bell off. It plays a tune when you press the button and only works in the day so you can't be annoyed at night. It should only take around 30 minutes and requires the Arduino Uno beginners set. Now lets get started.

What you'll need


1. The arduino uno

2. A chord that connects the arduino to your computer

3. A photo-resistor

4. A push button

5. 2 10k ohm resistors

6. A piezo

7. Some wires


1. arduino programing soft wear

2. bread board (optional)

Step 1: The Circuitry

The circuitry for this project is very simple and can easily be done on a small bread board. The first thing you need to do is plug in your power buses (The strips that run the length of your bread board and are labeled + and -). Second you need to make the button people will press when they come to your door. All you need to do is connect one terminal of the button to power (+) and the other terminal to ground (-) using a 10 ohm resistor. The resistor is there so you don't make a short circuit. Now connect a wire to digital pin 2 and put it in-between the push button and the resistor. This will allow your arduino to know if your pressing the button or not. Next you need to wire up your piezo. To do this simply connect one terminal to ground and the other to digital pin 8. Now your door bell has the potential to make sound and all you need to do now is hook up a photoresistor to tell your arduino if its light or dark outside. To do this connect one end of your photoresistor to power and the other to ground using a 10 ohm resistor. Now attach one end of a wire to analog pin A0 and place the other end in-between the photoresistor and the 10 ohm resistor. This wire must be placed between the photoresistor and the 10 ohm resistor because only between these two resistors does the voltage change. This voltage change is directly proportional to the photoresistor so as the photoresistor receives more or less light the voltage gets higher or lower. Because the analog pin can only read changes in voltage this is nesssisary to allow the arduino to know the lighting conditions. There you have it! You have completed the circuitry for your arduino doorbell!

Step 2: The Code

Now for the code. I have all the code listed beneath just for those of you that don't want to do the work and would rather copy and paste but I will also explain whats going on for those of you that are curious.

void setup() {

Serial.begin(9600); }

void loop() {


int time = analogRead(A0);



if (time > 300){ digitalRead(2);

int on = digitalRead(2);

if (on == HIGH){





















Forgive the unnessisary spaces instructables makes me do that and I dont know how to get rid of it. If anyone knows how to get rid of that please tell me. Anyway whats going on here is in the set up your telling pin 2 to detect if things are on or off instead of turn things on and off as well as telling the arduino to communicate which your computer. Your then asking your arduino to see how light it is on a scale of 0 to 1023. I don't know why its those numbers but it is. Your then capturing that number in a local variable and delaying 5 milliseconds as the ardunio does take a millisecond to do its work. You then tell your arduno to sent the number to the computer so you can look at it. Then you command it to not do anything else unless the amount of light is above 300. This number may need to be changed depending on how bright your surroundings are. This section of code makes sure your door bell can only be rung when its light (the day time). Next you ask your ardunio if the button is pressed or not. If it is you ask it to play the tune you make. This is comprised of tones and delays. The tones need three arguments ( the need to be told to do three things). First which pin to put out voltage on, second what tone to play (a value between 0 and 1023) and lastly how long to play it for in milliseconds. The delays ensure the tones don't all play at once but instead play one by one. My tones aren't perfect and I used rough numbers so feel free to mess around with them tell they sound right. You could also combine tones by eliminating a delay and make your own door bell sounds. However if you don't make you own the door bell will sound like the video at the start. Congratulations you have finished your door bell! now all you need to do is get some longer wires and maybe a door bell case and you can put your creation to use. If any of you arduino pro's have read this instructable and found I messed up some were I'm open to critique I'm certainly not an expert yet. Please tell me were I went wrong in the comments. Thanks everyone and comment if you make it!



    • Arduino Contest 2019

      Arduino Contest 2019
    • Trash to Treasure

      Trash to Treasure
    • Tape Contest

      Tape Contest

    7 Discussions


    2 years ago

    Please, as a general rule, could you tell us in the first sentence or two what your device is for. Then immediately after, how it differs from those in the market already. Going straight in with "You will need..." or "I made this from some scrap..." will not attract readers to continue reading. (This applies to many Instructables, not just yours)


    2 years ago

    Hope you like the door bell and comment if you make it. If someone could make a upbeat tune for the door bell that would be super cool. Special thanks to Jesus for the help.