Smart Light v1.0

smartlampv1.jpg
Smart Light v1.0

Over the past few months I have been working on a project, dubbed the “Smart Light”, that allows a user to control a connected appliance based on the ambient light in a room. I decided to gift this to the person who requested it so I put the final touches on it just after Christmas. With the hardest part over, installation and tuning were a breeze and I’m excited to take what I’ve learned from this project and build on it.

I made only a few minor changes but, overall, not much has changed since my last update. I had to replace the AC/DC converter I was using to power the Trinket as it failed on me. I’ve discovered that quite a few old dumb-phone chargers output 5V and varying mAh so I’ve begun a collection of name brand chargers for future projects like this. As you can see from the picture, I mounted the analogue light sensor inside the smallest Hammond case I could find at a local electrical supply shop. I braided the 3 wires to the sensor so that it would be easy to work with when installing the system. Also, I recently discovered heat shrink with hotmelt glue and used it extensively in this project as there were a number of exposed connections that normal heat shrink couldn’t handle.

With the project installed and working, I’m quite happy how it turned out but I do intend to make changes in both the hardware and software for the next version. The sketch for this project is simple and boils down to: if the light value is below a specific value, activate the relay else do nothing. The problem with this logic is that the light values fluctuate so that the value read by the sensor may jump above and below the threshold value. This jumping leads to the relay putting on a light show as it is rapidly activated and deactivated. To fix this, I am going to have the system activate the relay only after a certain number of readings in a row are below the threshold. This should drastically reduce the flickering effect when the appropriate value is found.

On the hardware side, my main concerns are minimizing the size of the system, adding the ability to adjust the threshold value that determines when to activate the relay and adding flexibility in placing the sensor. The biggest use of space in the case is the wiring so for my next version I’d like to move as much of the wiring and components to PCB. Right now, the only way to adjust the threshold value for the system is to modify the whole sketch and then re-upload it to the system. This is hardly ideal so I’d like to add a knob or series of buttons that allow the user to change the value. I’d even go so far as to add a small LCD screen to allow the user to set custom values and to see what the value. Lastly, I’d like to investigate the cost of making the sensor wireless so that the user isn’t limited by the length of the sensor wires when installing the system. Make the sensor wireless also opens the door to expanding the system to include other types of sensor allowing for further automation and monitoring of the home. I could see motion sensors being added to the system to trigger a security camera.