Introduction: Automatic Light Controller

About: I am a 21 year old DIY ist and Tinkerer with a deep interest in the field of robotics, electronic and cooking. I am skilled in wood and metal work as well. I work in my basement workshop and i am mostly scratc…

In this instructable i will show you how to make an automatic light controller. I wont claim this idea as my own since many before me have made things like this but what i felt was that they all showed the prototype and not the implemented forms. If its not implemented as a reliable device in real life, then its of no use.

But first let me explain what this is although its pretty self explanatory but basically its a controller that will control a load using information of the number of people in the room. The number of people are counted using two parallel laser beams and corresponding ldr sensors. The algorithm senses the order of broken beams and counts accordingly. More on that later.

I have shown how this will be implemented in real life. I am currently using this system for my room and have been using it past few day, making improvements along the way. Even now its not perfect but its good enough that i feel confident presenting it to you guys.

If you like my instructable, please vote for me.

Step 1: Parts List and Tools

Following are the parts used for this project:

  1. 2 Electronic Project Boxes
  2. Relay Module
  3. Arduino Nano
  4. 2 LDR Modules (Custom or off the shelf)
  5. Prototyping Board
  6. Wire
  7. 5V Laser Modules
  8. 5V Power Supply

Some of the tools and supplies you will need

  1. Drill Machine
  2. Soldering Iron
  3. Wire Cutters
  4. Solder Wire
  5. Laptop

Step 2: My Prototype

My first approach towards this was also to build it on a bread board. I built the entire circuit and used an lcd as well. I used a separate breadboard for laser diodes. Only after testing and tuning my code, i decided to implement it.

Step 3: Building the Transmitter Side

This is very easy because all you have to do is to hook up the two laser diodes. I used some lego technic parts to make an aiming system for each laser beam so that i can adjust it accordingly. You can use lego or any other method you find easy. I just glued the assembly inside one of the project boxes and wire it up. I taped the wire to avoid undue stress on the wires going to the laser module.

Step 4: Building the Custom LDR Sensor

At first i used off the shelf ldr sensors but for some reason my code was having trouble with it. So i decided to build my own. I used a prototyping board and a basic 555 timer IC with minimal components. The circuit is very basic. I built two on the same bread board and connected an LED and a wire with the output of each which is pin 3 on the 555 timer ic.

Step 5: Building the Reciever Circuit

The receiver circuit consists of the Arduino Nano. First go ahead and mount the arduino nano on a prototyping board. Then connect the relay to the arduino such that the signal pin is connected to one of the digital pins and power pins are connected to the 5 volt supply rail. Then connect the ldr circuit such that power pins go to the 5 volt supply rain and data pins go to the arduino digital pins. Pin numbers dont matter as they can be changed in the code.

Step 6: Building the Reciever Side

Drill holes in the project box to mount the electronic circuits. The ldr circuit will be mounted such that it faces the lasers. The arduino will be mounted in the center such that you have usb access. Insulate and add the relay module in there. My box was small so it was a tight fit. I couldnt mount the relay module. Insulate the power supply module and put that in there as well. I made the mistake of not having external usb access to the arduino nano so i had to mount everything open and then close it later. You dont make that mistake so that you can mount it while its all closed and program from there.

Step 7: Installation

Mount the pair on both side of the door sill just below hand level. Run a wire between the two either from below or above like i did it. This will be to power the transmitter side. Run another wire to your electrical panel where you will wire the relay inline with your light switches.

What i did was add a switch on the power supply of the receiver so that i can turn the system on and off as i want. The lights were wired on the relays normally closed side so that if the system malfunctions i can just turn it off and normal operation will resume.

I aimed the laser diodes and then placed covers on both the sides to make it look more neat.

Step 8: Code

Sorry i accidentally deleted the code. I will rewrite it soon and post it here asap.

Step 9: Conclusion

This was a great little project and it really does work. Its so fun when you walk out and lights go out automatically. It does have an issue when two people walk in at the same time or if a person stands in the door way. Still figuring out the solution.

Thanks for viewing my instructable and i hope you liked it. Please comment you suggestions and improvements.

Please vote for me if you liked my ible.

Maker Olympics Contest 2016

Participated in the
Maker Olympics Contest 2016