Automatic Light Switch

by bmrangelsalg in Circuits > Microcontrollers

74 Views, 0 Favorites, 0 Comments

Automatic Light Switch

IMG_3808.jpg

Do you ever walk of your room and forget to turn off the lights? Do you wish that your lights would turn when you enter the room? Well I have the solution, which is an automated light switch which is triggered by a laser and photo-resistor detection system, which then signals for the servo to turn enough to flip the switch from an on and off position.

Supplies

  • 1x photo resistor
  • 1x led
  • 1x servo
  • 1x Particle Argon
  • 4x Lego Pieces
  • 1x Laser diode
  • 1x 3-Battery Pack
  • Tape
  • Velcro
  • 1x Power Bank

Setting Up Laser

IMG_3806.jpeg

You should set up your laser diode to the 3-Battery Pack and place it somewhere in your room where the laser is crossing from a wall to your argon.

Wiring Argon

IMG_3811.jpg

Next step should be to wire your argon, you should start by connecting wires from

  • VUSB to positive rail
  • Ground to negative rail
  • Long leg of LED to D6, short leg to negative rail
  • Wire connecting to positive rail to one leg of the photo-resistor which also has a resistor between.
  • Wire connecting to ground on other leg of resistor
  • Wire connecting A2 to other leg of photo-resistor
  • Wire connecting positive rail to servo, wire from D2 to servo, wire from ground to servo.

Coding the Software

Screenshot 2023-11-13 10.32.22 PM.png

Assuming you did the same wiring as me you can use the same code, which sets up servo, photo-resistor, and a time-based function.

Mounting the Servo

IMG_3783.jpg

For this part I used 4 lego pieces that I found to add around the light switch to basically make it easier for the servo to flip as the fins I had were pretty small. I used tape-velcro on the wall and servo along with some tape to secure it on the wall.

Housing the Argon

IMG_3809.jpg
IMG_3808.jpg

I used a shoe-box and cut a hole into it so that the laser I had set up earlier as well as taping the argon to the box. All that was left after that was to set up the box somewhere in the room where the laser would hit the photo-resistor at the right angle to trigger the servo.

Testing the Project


This is the project working after putting it all together and following all the steps.