Along with my other hobbies, I have an interesting collection of antiques I've collected. One antique has sat by my bedside for over 3 years, serving no purpose. This shell canister has mysterious phrases like FLASHLESS, PP-GL2-F3-S1 and ELECTRIC PRIMER. It has a 3 inch diameter. I still haven't figured out where it came from, but I do know that it's the "booster package" for a shell fired from a ship, artillery or other. With its heavy metal, cool oxidation and unique shape I knew I wanted to use it for something. If anyone knows about these primers please comment below.
Finally, the idea came. Nightlight. Arduino. Boom. Model 1 is here to make your bedroom look really, really cool. Once the darkness level is reached it will simply fade in and out. I know not everyone is going to have one of these canisters laying around but the circuit and code can still serve as a fun mini 20 minute project. Let's do it.
This project uses a simple layout with a photo resistor and a few LEDs. Any dark colored cylinder should work. We will be using an analog pin, 5V and ground pin for the sensor. The four colored LEDs of your choice will be powered by single PWM pin for the dimming effect.
I made the circuit on a mini breadboard and attached it the the back of my Uno. This keeps the size down so it could fit down the 3 inch diameter. One problem I found is that depending how dark your canister is the sensor may turn on the LEDs before you turn off your bedroom light. To correct this I attached the sensor to a wire extension so I could place the sensor by the top, to get an accurate reading from my room. I taped the photo resistor in place. When you have completed the circuit diagram it should look something like this.
That messy chunk of wires is pure joy...
The diagram is black for ground, red for 5V, orange for the analog, and blue for pin 9. Sadly, the frizing diagram can't show my exact layout because it would be confusing to view, but if you move all the parts close enough to get on a mini breadboard you should be fine.
The code will need enhancement depending on light amount in your room. For my present light environment I needed the light amount to == 0.
Hope you have a great day everyone and enjoy your nightlight! Arduino is just plain awesome for anything.
Comments