I wanted to create something for upcoming New Year gift to present my parent.At the same time I saw a competition on MASON JAR is going on in instructructables. So it only made sense that I would use mason jars to make simple DIY lamp.Making mason jar lights is really, really easy!.After all this is what I came up with.It is the perfect blend of rustic and tech, don’t you think?
This is a dark activated color changing mood lamp. Its brains is a ATtiny85, but you could also use an Arduino.It has a light sensor which sense the light condition and decide when the room light is turned off.This then will light a RGB LED and slowly fade through different colors.
Step 1: Parts and Tools Required :
1. Mason Jar (Amazon)
2. Attiny85 (eBay)
3. 8pin DIP socket (eBay)
4.Coin Cell (eBay)
5.Coin Cell Holder (eBay)
6.Resistors (1x10k and 1x 50ohm)
8.Common anode RGB Led (eBay)
9.Sliding Switch (eBay)
14. Arduino and Jumper Wires
15. 10uF electrolytic Capacitor
Step 2: Schematic and Working :
The brain of the lamp is Attiny85. The LDR and 10K resitor makes the light sensor.The sensor output is connected to the attiny analog pin-3.The sensor detect when the room is dark and tell attiny to give varying pwm signals to the RGB led.According to the different values of PWM signal the color of the RGB led changes.For power switch I used a sliding switch.
The ATtiny85 only has 2 PWM pins.But to change the color of a RGB led we need 3 PWM pins.This limitation is overcome by using software PWM.This means that you can fade in and out of all 3 colors using any of the pins on the ATtiny.The software PWM works by setting the pin HIGH and then LOW at different rates so that the LED looks like it's dimming. This is called Persistence of Vision or POV. The LED blinks so rapidly that the human eye can't detect that it is flashing at all, and it sees instead that the LED appears to be dimming.
Step 3: Preapare the Perforated Board
The lid of the jar is circular.So I first cut a rectangular board by using plywood cutter.Then I trimmed the edges with a tin cutter.Hit and try until the board fix in to the lid.
Step 4: Solder the Cell Holder and DIP Socket
First place the Coin Cell holder and DIP socket as shown in figure.
Then solder it.
Step 5: Install the Switch
Drill a hole for installing the sliding switch.I used 6mm drill bit for making the hole.use a drill bit according to your switch size.Then install the switch by applying hot glue.
Note : I forgot this stage,so make the hole after placing the cell holder.When you will make this project, drill the hole before soldering any components on to the board.
Step 6: Solder Everything As Per Schematic
After soldering the components, join the soldering points by wires.Refer schematic during this stage.
Add a current limiting resistor to the anode.In my case it is around 50ohm.
Note : Instead of using single resistor you may use 3 resistors with three cathodes.Both works fine.
If you want to power it with 5V then you should change the resistors value.
For calculating the current limiting resistors click here
Step 7: Program the Attiny85
There are many great sites and other instructables that give step by step instructions on how to program a ATtiny85 with a Arduino. The reason I used the ATtiny85 was because it is a cheap chip and the size is very small .
I program it on a bread board.If you have a shield then it is very easy.
The details of program an attiny is explained here
The code is attached bellow.Change Light threshold value from 0 to 1023. Lower number means activation at lower light level.
If you are using a Common cathode RGB led then Change HIGH to LOW and LOW to HIGH in the code.
Step 8: Frosting the Jar
You can use your imagination to find a way to diffuse colors uniformly. Color diffusion is necessary to achieve best results.So frosting of jar is needed.The best way to frost the mason jar is by using frosting spray paint.
For frosting a glass jar you can see here.
In my country I did not find it ,So choose a short cut method.I used a tracing paper to diffuse the light.
Cut the tracing paper with width equal to the height of the jar.Roll the paper and insert in to the jar.If you have a frosting spray then you can use it.
I satisfied with my cheap solution.
Step 9: Mount the Board
Stick duct tape to the board.I used scotch tap.Then place it inside the lid and stick the tap to the lid inner edges.
Make sure that the LDR is bend toward the top, in such a way that it exposed to light.
For better response of LDR use jar with transparent lid.
Then close the lid.
Step 10: Test the Lamp :
To test the lamp slide the switch to ON position and switch off your room light.You will get a surprising gift.
I have a lot of fun while making my own jar mood lamp.If you are thinking to make this, I am sure that you are probably the new proud owner of an adorable little mason jar mood lamp.
If you enjoyed this article, don’t forget to pass it along!
Follow me for more DIY projects and ideas.
Thank you !!!
First Prize in the
Mason Jar Challenge
oculartechie made it!