Ardu-Lazy: Turn Off the Lights With a Laser Pointer!

Introduction: Ardu-Lazy: Turn Off the Lights With a Laser Pointer!


This is my first instructable and i tought of doing it about a thing i did a while ago.

First i would like to give you a general overview of the project: Its basically a photoresistor which gives a signal to arduino when the laser is pointed at it, and arduino "orders" a servo-motor to move and turn off the lights. It is a simple but very convinient system, especially the part when you can activate it laying down in your bed (There´s the lazy part of the title )

Second: The project was already "ensambled" by the time im making this instructable, so you may think the pics dont show connections or similar details, so if you have any doubt about anything you dont see in the photos, or anything not clear, dont hesitate to contact me

Third: English is not my first language so if i make any grammar or spelling error, sorry :)

Step 1: Things You'll Need

So, as I said before, this is a simple project so you will need few components:

1 Photoresistor

1 10Kohm resistor

1 Servo (The one i used is micro; its smaller therefore cheaper)

1 Arduino Uno

1 9V Battery (Powers the arduino)

1 9 volt battery snap to DC adapter cable (pic 3)

Jumper wires

Old Cellphone Charger (120V to 5V in my case)

3 Green leds

3 100ohms resistors

1 Pipe Clamp (The size should be according to the light switch cover)

2 Screws (Big enough to fit on the clamp's holes)

Two small rectangles of opaque Paper of some kind (I used baking parchment paper)

Case (Used the cardboard box in which the Samsung Galaxy SIII mini comes)

Step 2: Preparing the Cover and Mounting the Servo

With a drill make a hole in the middle upper part of the cover, aprox the same size as the photoresistor

Grab the pipe clamp and with the help of a hammer and/or pliers transform the circular form to something kind of square (Note it doesn need to be perfect just enough to give the servo a good contact surface)

Put the servo in where the pipe should be (If you want, secure it with glue, epoxy or even tape, you can even just put something foamy between the clamp and the servo if you feel it's too loose) and then screw the clamp in the light cover

Step 3: Photoresistor Circuit and Mounting

Ok, this is one of the two parts that soldering is recommended (Not mandatory in this one, as this goes glued with hot glue in the back of the light cover)

So the connection we want to make its basically the one on the image:

From one leg of the 10k resistor solder one cable

Solder the other resistor leg, one leg of the photoresistor and a cable

Last solder the last leg of the PR to another cable

When you have the circuit (on a piece of perfboard, just soldered or even just twisted ) use hot glue to secure it in the back of the light cover (YOU NEED THE PHOTORESISTOR TO BE VISIBLE TROUGH THE HOLE YOU MADE BEFORE) and be sure you make a little gap (side ) between the cover and the wall so you can get the 3 cables out (PIC 3)

Step 4: Leds (ON LIGHT)

So in this step soldering is highy recommended

The connections go like

1. Solder all the long led legs and a cable all together

2. Each one of the short led legs goes to one leg from a 100ohms resistor

3. the resistor legs that remain unsoldered go together with a cable

If you want the brightness of the leds to be a little "cut down" in the case cut a little rectangle and paste some of the opaque paper and then put the leds inside the case. Add as many rectangles as you like to set a good "futuristic shine" green

Step 5: Arduino Code


Arduino puts the servo in 90 deg. position and turns on the leds everytime it goes on

Then it reads the value of the PR every 0.1 seconds, when the value hits a very low number (laser pointed at PR) it moves the servo to turn off the lights and in initial position again

The code its quite simple:

Servo servo; int foto; int cont;

void setup() { servo.attach(7); servo.write(90); foto=0; cont=0; pinMode(8,OUTPUT); digitalWrite(8,HIGH); }

void loop() { foto=analogRead(A0);

if (foto<100) { servo.write(30); delay(700); servo.write(90); cont=1;

} delay(100);


Step 6: Connecting Everything!

So the first thing you want to to is know which one is positive and which one negative in your cell phone charger. Mine was kind of intuitive (Black negative, white +) but always check first with a multimeter

Once you've done that connect the positive cable of the charger to the red cable of the servo, and the (-) to the brown or black servo wire. The servo wire that remains free its called the pulse, and its the one that goes to arduino

After dealing with the phone charger, just follow the connections in the schematic

Remember to connect the 9V battery to power the arduino with the dc adapter

After that just store the arduino with the 9V battery that powers it, and all the cables in the case


Step 7: Success!

Here is a vid of the project working, but when i filmed it , i was all secured with tape

If you liked it dont forget to vote it for the DIY UNIVERSITY CONTEST

Thanks for reading, hope you found it useful or at least fun to make!

DIY University Contest

Participated in the
DIY University Contest

Be the First to Share


    • Anything Goes Contest

      Anything Goes Contest



    8 years ago on Introduction

    Interesting project. Thanks for sharing this!