Lights Out

by IMHamburger in Circuits > Arduino

1284 Views, 0 Favorites, 0 Comments

Lights Out

IMG_20200527_235328.jpg
Stuff

Do you have the problem where you always forget to turn off the light when you leave the room? This careless act wasting a lot of energy, so in this project, you will learn to make a machine that can turn the light off for you when you are not using it, saving a lot of energy. This machine is simple to operate, you won't even have to do anything to it to make it work. So when the machine detects you around, it will turn on, and when you leave and forget to turn the light off, it will count down. After the countdown, it will turn the light off for you. But if you return before the countdown is finished, the machine will restart, meaning that it will not turn the light off and will wait till you leave again.

The circuits for this project are short and simple, just follow the following steps to create the machine. If you don't understand the steps, feel free to have a look at the circuit graph below.

Supplies

  • Arduino Leonardo
  • Breadboard
  • Cardboard
  • "Hand"
  • HC-SR04 ultrasonic sensor
  • Servo motor
  • Wires

Circuit

Swanky Habbi-Luulia.png
IMG_20200528_002236.jpg

This graph is the circuit of this machine. Have a look at it if you don't understand the following steps.

Arduino Board + Breadboard

IMG_20200528_001708.jpg

Connect the positive side on the Breadboard to Arduino Board's 5V and negative side to Arduino Board's GND.

Servo Motor

IMG_20200528_001318.jpg
IMG_20200528_001333.jpg
IMG_20200528_002244.jpg

Connect the Power line(Red) to positive on the Breadboard, Ground line(Black) to negatively the Breadboard, and Signal line(White) to D Pin10 on the Arduino board.

Attach a hand on the Servo Motor which will turn and turn the lights off. I used Legos as the hands because it is easy for me to get. Glue the hand onto the Servo Motor and position it on the switch so it can turn off the light when it rotates.

Position the Servo Motor to the switch, so when it rotates, it can turn off the light.

HC-SR04 Ultrasonic Sensor

IMG_20200528_003810.jpg

Last is the HC-SR04 Ultrasonic Sensor. Connect Vcc to positive on the Breadboard, GND to negative on the Breadboard. Connect the TRIG line to D Pin 6 and ECHO line to D Pin 7.

Now you are done with the circuits!

Box

IMG_20200528_004018.jpg

Now that everything is almost done, put everything into a box so it looks good and is tidier. It can be any box, as long as it fits everything.

If you were wondering about how to power this machine, I used my computer, connecting a wire to the Arduino Board to my computer.

Ignore the holes in my box, I used a recycled box I found. But you could also cut a hole for the sensor or other wires.

Coding

The file and the link are the codes for the machine to work. They both include the codes my friend Aaronhung1128 developed, be sure to check out his projects as well. Upload the codes into your Arduino. Feel free to change the codes.

Click me for codes

This is the end of the project, hope you had fun making this machine and have fun using it. See you next time.

Downloads