Introduction: DIY Rainbow Solar Mason Jar

About: The Green Energy Harvester, loves to make things related to Arduino, Solar Energy, and Crafts from used stuff.

In this Instructable, I am going to show you how to make a Rainbow Solar Mason jar. This is a great project for people with minimal electronics skills, you can make this within an hour. This is an inexpensive and easy way to add charm to any outdoor space which gives off beautiful rainbow light well after the sunsets.

The Solar Mason Jar depends wholly on the sun for power, which ultimately means it saves you more energy, and you don’t have to worry about unplugging once it is fully charged because the battery automatically stops charging once it’s full, and as long as the solar panel is facing the sun, you can rest assured that it will charge and ultimately give your garden a colorful illumination.

The Mason Jar Light is equipped with inbuilt sensors. Once the sun begins to fade into the horizon, it automatically switched on leaving your garden with colorful rainbow light.

The project is based on a cheap LED driver chip QX5252F in the TO-94 package. I have already posted an Instructables on Solar Lamp by using the same IC. But this time, I will show you how to modify the circuit so that you can run an RGB LED to produce rainbow colors effect.

Update on 31.05.2022:

I have designed a DIY kit and a 3D Jar for this project and it is now available on my tindie store. Please support me there and help me to grow.

Download the STL files for Mason Jar from Thingiverse.

Support me On Patreon:

If you enjoy my work here on Instructables, consider joining my Patreon, it will be a great help for me to make more interesting projects in the future.

Patreon Link:


1. Solar Panel -2V ( Aliexpress )

2. Controller QX5252F ( Amazon )

3. 47 uH Inductor ( Amazon )

4. RGB LED ( Aliexpress )

5. Sliding Switch ( Amazon )

6. 1N4148 Diode ( Amazon )

7. 10nF Capacitor ( Amazon )

8. AAA Battery ( Amazon )

9. AAA Battery Holder ( Amazon )

10. JST male-female connectors ( Amazon )

11. Hot Glue ( Amazon )

12. Double side Tape ( Amazon )

13. Butter Paper ( Amazon )

14. Mason Jar ( Amazon )

Step 1: How It Works

The heart of this light bulb is a very small 4 legged IC QX5252F. It works very similar to the "Joule Thief " circuit.

But the advantage of using this chip is that it does not require a bulky and heavy toroid. It does the same job using only a simple inductor, single AA / AAA battery, and a LED.

It requires only an external inductor is required for making the Circuit. The LED current can be changed by using a different value inductor. The chart is shown in the above picture. I have used a 47uH inductor.

Most of the solar garden light uses this small chip.

Connection :

Pin-1 -> Solar panel positive terminal

Pin-2 -> Battery positive terminal and one leg of Inductor

Pin-3 -> All ground ( Solar panel, Battery and LED negative terminal)

Pin-4 -> Another leg of Inductor

Step 2: QX5252F Circuit

As per the QX5252F datasheet, an external inductor is required for making the Circuit. In the reference circuit diagram, the configuration is powerful enough to drive a white LED. But if you connect an RGB LED, instead of white you will notice that the RGB LED lights up however it doesn’t cycle through red green blue color.

The circuit is not working because the output from the circuit is not a steady DC output rather it is a high-frequency pulsating signal. In my breadboard prototype with only one LED, the configuration oscillates near 184.5KHz (see the image).

How to fix this Issue?

To fix this you need to add a buffer circuit at the output.

You can download the attached datasheet.

Step 3: Adding Buffer Circuit to QX5252F

The buffer circuit is just a diode ( 1N4148 ) and a capacitor (10nF ) at the output before connecting the LED. The diode keeps the capacitor charged when the pulsating signal goes to 0 volts.

After adding the buffer circuit, you can notice that the RGB LED cycles through all the 7 colors. Now you connect the oscilloscope at the LED terminal, the output is DC current with a little amount of ripple signal which is adequate for driving the RGB LED.

Step 4: Cut the Perforated Board

I took a 5 x 7 cm perforated board for making the circuit.

I cut the perforated board to the desired size ( 2.5 x 2 cm ) by using a utility knife.

Step 5: Solder QX5252 and Inductor

First, I solder the QX5252F IC as shown in the first picture.

Then I solder the inductor on the backside of the QX5252F. One leg of the inductor is in the same row to pin-2 and the other is on the pin-4 of QX5252F.

After soldering, trim the extra legs by using a nipper.

Step 6: Solder the Diode & Capacitor

Solder the positive leg of the diode near to the pin-4 of QX5252F. The black stripe on the diode indicates the negative terminal.

Then solder the ceramic capacitor as shown above. The ceramic capacitor does not have any polarity. I have used a 0.1uF capacitor. Any capacitor value from 0.1uF to 1uF is perfect for this circuit.

One leg of the ceramic capacitor is near to the diode negative terminal.

Step 7: Solder the LED and Switch

Solder the LED near to the diode and capacitor because the LED positive terminal is connected to the diode negative terminal. The longer leg of the LED is positive.

Then solder a slide switch as shown above.

Step 8: Solder the Battery and Solar Panel Terminal

I have used two JST connector for connecting the battery and solar panel.

Solder the JST connectors as shown in the picture.

Step 9: Make the Circuit

At last, make the circuit as per the schematic diagram.

You can see my hand-sketched schematic for your reference. I have placed the actual components on the schematic for easy understanding.

Step 10: PCB Design

I have designed a custom PCB for this project. You can download the Gerber Files from PCBWay

When you place an order from PCBWay, I will get a 10% donation from PCBWay for a contribution to my work. Your little help may encourage me to do more awesome work in the future. Thank you for your cooperation.

Step 11: Drill a Hole in the Lid

You have to place the solar panel over the jar lid. To pass the solar panel wires into the mason jar, make a hole by using the drill.

Pass the JST connector wires through the holder made in the lid.

Step 12: Prepare the Solar Panel

Solder the red wire to the positive terminal and black wire to the negative terminal of the solar panel.

Then mount the panel on the top of the lid by using double-sided tape.

Step 13: Mount the Circuit Board

Mount the circuit board by using double-sided tape.

Then connect the solar panel connector to the circuit board.

Step 14: Prepare the Battery Holder

First solder the battery holder terminal with the battery JST connector.

Insulate the soldering joint by using heat-shrink tube.

Mount the AAA battery holder just side to the circuit board.

Finally, connect the battery connector to the circuit board.

Insert the battery into the battery holder.

Step 15: Frost the Jar

Why frosting is required?

Frosting the jar helps to diffuse the light all around the surface and gives a nice glow to the entire jar.

The best way to frost the jar is by using frosted glass spray paint.

I don't have frosted glass paint, so I have used butter paper/tracing paper.

First I took the measurement of the jar depth, then cut a strip with the same measurement.

Then I place it inside the jar as shown in the above picture.

Step 16: Final Output

For a quick test, just slide the solar light switch to ON position and cover solar cell by your hand. The light should be turned ON.

Place the Jar in the bright sunlight, the solar cell will charge the battery. When the sun goes ( during dark ), it will be automatically switched ON. Now you can see the slow and fast color changing rainbow effect.

You can make a few similar jars and place them in your garden or lawn. Now enjoy your new solar mason jar.

If you enjoyed this article, don’t forget to pass it along!

Follow me for more DIY projects and ideas.

Thank you !!!

Colors of the Rainbow Contest

Participated in the
Colors of the Rainbow Contest