Turn on and Off Your Things With a Laser!

by XicoMBD in Circuits > Lasers

36505 Views, 245 Favorites, 0 Comments

Turn on and Off Your Things With a Laser!

PB100272.JPG
20101109_112256 .JPG
There are already some great projects around here about hacking home automation systems, but what I wanted to do was to control my plugs creatively.

Thats why I decided to do this. To have the most functionalities possible I put a arduino inside the plug switch. 

This way it was possible to add a light sensor to the plug and program it to turn on and off what is connected to it using a laser.

It just compares the last three reads and, if the second value is bigger than the first and the third one, it turns on/off the plug.


Here is a demonstration:
  

WARNING:
In this project it is required to open a device which has 220V in some parts, so be careful!
I'm not liable for anything stupid you do.

Gather the Materials

20101108_104037 .JPG
20101108_104808 .JPG
20101109_080737 .JPG
LaserControlledPlugSwitch_bb.png
Materials needed:
  • Home Automation System Switch
  • Arduino - I decided to make one, but you can use any other
  • 4N25 optocoupler
  • 220 Ohm resistor
  • LDR
  • 10k Ohm resistor
  • LED
  • 220 Ohm resistor
  • Wires
     

Open Your Plug

20101108_104118 .JPG
20101109_080314 .JPG
Start by opening the thing, then have a look and try to find what does what. The best way is to find where the pushbutton is connected to the pcb and see if there is anything written there. In my case it was indicated the GND wire and the other one.
If you want you can just connect these two wires to the 4N25 and just simulate the button this way. I preferred to keep looking, find the 5V and let the arduino directly control the relay.
  

Solder the Wires

20101109_081621 .JPG
The technique I used wasn't the most conventional one, but worked which was all I wanted.
I just soldered the two wires to the board's original built-in microcontroller correspondent legs. 

Connect the Plug to the Arduino

20101109_081533 .JPG
LaserControlledPlugSwitch_bb.png
LaserControlledPlugSwitch_Esquema.png
To let the arduino control the plug without having to share grounds I used a 4N25 optocoupler. Two legs are connected to the arduino and other two to the plug.
The optocoupler basically consists of a LED and a phototransistor, the two circuits never touches each other.

Add the LED

20101109_080758 .JPG
LaserControlledPlugSwitch_Esquema.png
LaserControlledPlugSwitch_bb.png
Connect to the arduino the LED which will show if the plug is on or off.
It is a basic LED connection, simply connect the long leg to a arduino's digital output through a 220 Ohm resistor and the short the ground.

Now your arduino can already control the plug. With this you can control the plug with your computer, or add sensors to it, which is what I will do on the next step.

Add the Light Sensor

20101109_080758 .JPG
LaserControlledPlugSwitch_Esquema.png
LaserControlledPlugSwitch_bb.png
To let the arduino know when the laser is pointed to it, I use a LDR.
It is other basic connection, one leg to the 5V and the other connected to an arduino's analog input and to the ground through a 10k Ohms resistor.

Test It!

20101109_082126 .JPG
Now that you have all the components well connected start testing the different parts individually.
First see if the arduino can successfully control the plug, to do that, you can just upload the Blink example, only changing the number of the digital output to yours.
Then you need to know if the sensor is reading well, just upload the AnalogInOutSerial example and read the values that the arduino prints to the serial console.

If it all has worked, upload the final program, you can create yours or just upload my which is attached.

Now your arduino should turn on/off the plug and the led when it detects a peek on the light readings.

Downloads

Mount Everything in Place

20101109_082423 .JPG
20101109_082530 .JPG
20101109_112256 .JPG
If you have it all working, mount everything in place, and make it look well.

I didn't have a battery pack or other power source at hand, that's why I used another arduino connected to the computer to give it the 5V.

Have Fun!

20101109_112256 .JPG
Now you can turn on and off anything connected to the plug just using your laser.

But it is not the only thing your arduino can do, so keep developing new programs and new functionalities!