Automatic Light Switch with Motion Detection

I thought I'd share my first project with the community:

Basically, this is an automated light switch that uses motion and light detection.

Some of the features are:

  • Motion Detection
    ** Timer resets when you're still moving in the room so that you aren't left in the dark
  • Light detection
    ** If you happen to turn off the light switch at the other end of the room, it won't turn back on
    ** If you happen to turn on the light switch at the other end of the room, it won't turn back off
    *** This means the up/down position on the light switch becomes dynamic and can adjust to any light switch
  • Setting for how many seconds the light should stay on (intervals of 10, up to 50)
  • Manual on/off operation

Just a little background about myself:

This is my first attempt at electronics. I'm a software engineer and wanted to try my hand at something new. I've tinkered with solar power quite a bit in the past, so I was familiar with some of the basic electrical principals. I still have a lot to learn, but I think this was a good first attempt.

I'm currently in the process of soldering everything on to a PCB and cleaning up the case to be more presentable. Once I have finished with that, I'll have a follow-up video with some photos.

Thanks for reading/watching!

I'm wrapping up work this weekend and wanted to share some of my progress. I'll have more details on how everything was done once I complete it.

I've never soldered in my life, but everything worked on the first try 8)

Here's what it will look like when the box is closed up (the battery pack should be inside with the rest of the hardware)

I got it all mounted last night and came across a few issues:

  1. Now that the motion sensor is on the inside of the box, instead of the outside (as it was during the prototyping phase,) it lost almost all of its awesome distance. Basically, it won't pick you up on the stairs until you were about 3 steps away. This isn't very practical for a hallway situation like this.

  2. The motion sensor decided that it would be a good idea to pick you up when you're in the kitchen. I have a feeling that it's because I mounted the sensor sideways. It's quite possible that the "top" of the sensor is more sensitive than the "bottom", which would explain the situation with the stairs.

  3. The calibration button is mounted to the PCB, which makes it difficult to calibrate. Due to the fact that the front panel is screwed on (thanks to the motion detector's wires,) I don't find it a practical spot.

  4. Sometimes the detector won't stop going off. This makes the light just turn on and off repeatedly. This only started this morning, so it's possible that I either have a bad connection or a ghost in my home.

I've decided that I'm going to re-mount the motion detector on the side of the box, which faces the stairway. This should give me back my downstairs detection, which also makes it so that if I leave the default timing settings on it, the placement of the button becomes less important.