Smart Light: Final Circuit and Enclosure

Here is quick update on the progress of my Smart Lamp project I started near the end of the summer. As I mentioned in my previous post, I have already put together a prototype circuit to test controlling the flow of power to a plugged in lamp based on the input of the light sensor. Below is the proposed final circuit for the smart light project. The only change I foresee is the removal of the LED indicator since the Trinket and the AC-DC converter both feature LEDs on them and space is tight in the enclosure.

Smart Lamp Final Circuit

Smart Lamp Final Circuit

I’ve bought a Hammond ABS enclosure to hold all the components. I removed the mounting stand-offs as they did not match well with any of the components and the relay would not fit if mounted to them. The white board you see in the picture is foam board which I was thinking of using as a medium to mount the parts to. My current plan is the use Velcro to secure the components right to the case. I tested this using my EDtracker build and a small Hammond enclosure and it worked well. The tracker is secure when in the case but can be easily removed if need be. I have included a picture that tries to illustrate how the extension cord will be routed through the enclosure. I still need to drill a hole for the end on the left of the picture.

The biggest change since my last post is the addition of a spare USB charger I had. This will serve the purpose of powering the microcontroller right off of the extension cord. I have removed the USB port from the charger and soldered wires where the power pins were in order to keep the USB port on the Trinket free for programming. Unlike the circuit shown above, the trinket is mounted on a (trimmed) proto-board in order to easily allow multiple connections for powering the relay and sensor.

There’s just testing, soldering and calibration left! I’ll post a final build update regarding the testing and calibration with pictures of the final product soon.

Advertisements

Smart Light Test Circuit

The light sensor (plus a few other goodies) arrived from Adafruit a couple of week ago. Since then I’ve had a chance to bread board the final circuit that will make up the smart lamp. I still have to order a case for the final product and decide where to mount the light sensor for optimal exposure. The plan has been modified from creating a smart lamp to creating a smart extension cord as I found out that there are multiple sets of lights that will run off this device. So I will mount the finished circuit to the end of an extension cord instead which will allow whatever is plugged into it to be activated when light levels drop below a set threshold.

I’ve posted the code that runs on the Adafruit 5v Trinket on my github page for those interested. Working with the Trinket itself has been mostly pain free. Adafruit has a great tutorial section for setting up and working with the Trinket. However, I did have trouble getting the light sensor to work with the Trinket when I first started out. Since the Trinket is not able to send back serial communications to a connected PC, I had to switch to an UNO R3 to see what was going on via the serial monitor. The light sensor from Adafruit I chose is perhaps not the best suited for this project because it requires a reference 3.3v inorder to gaurantee the best accuracy in taking readings. This is despite the fact that this sensor can be supplied with up to 7v. In the end I was able to get it working with the 5v Trinket  and accuracy does not seem to be an issue from the subjective testing I’ve done. Keep an eye out for a post with the final circuit all soldered together!

circuit transfer
Transferring the bread board circuit to a proto-board.

DIY Smart Lamp using Arduino

My Dad has been doing some remodeling of his living room recently and, as part of this, bought bookshelves and some lights to go with them. He wanted some way to turn them on without having to deal with the little switch included with the lights so he thought it would be nice if the lights turned on in the evening on their own. So the task fell to me and and I happily accepted.

This project is actually fairly simple as only a few cheap parts are needed and little coding is required. There is a real danger of electrocution with this project however as we are dealing with voltages from 120V to 220V ( depending on where you live). Please be sure to the necessary precautions when working with live wires for this and any project you take on.

I am using the following parts for this project:

  • Arduino Uno R3 (for prototyping) and an Adafruit Trinket 5V – Mini Microcontroller (finished product)
  • light sensor
  • Seed Grove Relay
  • Adafruit Perma-Proto Small Mint Tin Size Breadboard PCB
  • GA1A12S202 Log-scale Analog Light Sensor
  • Dollar store extension cord (for prototyping)
  • IR Motion Sensor

Since I didn’t have access to the lights when I started nor did I have a light sensor handy, I started by creating a prototype to test the relay with an Adruino Uno R3. I wrote a simple loop that closed the the relay, waited a second then opened it again. This was repeated so long as power was supplied to the Arduino.

Relay connected to extension cord.
Relay connected to extension cord.

For the next prototype I simply added a sensor I had lying around to test controlling the relay based on the input form a sensor. I sensor I chose was a IR motion sensor. The end result was an extension cord that would send power to whatever was plugged into it when motion was detected. I’ll post an update once the light sensor arrives and I find time wire up a circuit for testing.