Hacking an LED solar garden light.

You can file this blog entry under exploring interesting bits of electronics hidden in everyday household items much like these two previous entries on using coin cell batteries and flickering LED candles. Solar rechargeable LED garden or pathway stake lights have become very inexpensive and common place. Looking from the outside, they generally consist of a small solar panel to charge a battery and a high brightness white LED. A typical most inexpensive example, as shown in figure 1, costs as little as $1.00 but maybe up to $2.00 each.

Figure 1, Typical solar LED light

The LED comes on when it gets dark and the solar panel is no longer able to charge the battery, so there has to be some sort of control circuit inside to do this. Inside the example I deconstructed was a single 1.25 volt 100 mAh AAA NiCd cell and a small PCB with the LED, a 220 uH inductor, and a four pin voltage boosting integrated circuit marked YX8018. The complete circuit is shown in figure 2.

Figure 2. solar garden light circuit

The YX8018 comes in a 4 pin transistor style TO-94 package and the pin configuration is shown here:

The YX8018 is more or less just a gated oscillator which runs at approximately 200 KHz driving an open drain NMOS switch ( output on pin1 ). The circuit pulses the small inductor to step up the voltage to drive the LED in a similar way as a Joule Thief circuit. The use of a single AAA NiCd rechargeable cell keeps the cost down. Which also means the solar panel can be a cheaper low voltage version. The 3 cm x 3 cm one from this example generated 2.7 volts in full sunlight with a short circuit current of 17 mA.

To reduce the component count the application of the YX8108 chip is rather ingenious. They use the internal ESD diode between the CE ( chip enable ) input and ground for charging the NiCd cell from the solar panel, but also use the voltage ( or lack thereof ) from the solar panel to detect when it is dark enough to turn the LED on. The CE input includes a small pull-up current. I measured about 30 uA with 1.25 volts on VDD . This small current will pull pin 3 high gating on the oscillator if the solar panel is not generating more than 30 uA of current. An alternative method of controlling the CE input shown in the datasheet is to use a light dependent resistor CdS photocell between CE and GND.

So that’s all there is to this garden light, but what else can we do with these parts to learn about electronics? Well, as in these Lab activities, we can learn about the Characteristics of Photovoltaic Solar Cells, the Diode current vs. voltage curves of the white LED, and the characteristics of the rechargeable AAA NiCd cell. In addition we can learn more about inductor based DC-DC Converters by building various configurations around the YX8018 chip. Some of the following is from the figures in the datasheet of the YX8018, others are ones I’ve come up with. Note that in most of these examples I’ve omitted the solar panel and leave the CE pin floating for continuous operation.

In figure 2 the current pulses from the inductor return to the battery through the LED to the ground side of the battery. We can also connect the LED across the inductor so that the inductor current returns directly to the inductor as shown in figure 3.

Figure 3 Alternate way to connect the LED

The basic configurations in figures 2 and 3 drive the LED with pulses of current at the oscillator frequency. This is fine because the frequency is way above anything the eye can perceive as flicker. We can rectify and filter these pulses into a DC voltage to drive the LED as shown in figure 4. Rectifying diode D1 can be a standard diode such as a 1N914 but a more efficient choice for these low voltages would be a Schottky diode. At these high frequencies, filter capacitor C1 does not need to be very large, a 0.1uF or 1.0uF value will work well.

Figure 4 Adding DC rectifier to the boosted output.

By adding another diode and capacitor we can generate negative output voltages as shown in figure 5. We don’t necessarily need a negative voltage to drive the LED but this is more a demonstration of how DC-DC converters can also generate negative voltages from positive voltages. Capacitor C1 and diode D1 level shift the positive peaks of the voltage waveform at pin 1 and clamp the voltage seen at the junction of D1 and D2 to a diode above ground. This now negative going waveform is rectified by D2 and filtered by C2


Figure 5 Negative voltage generator.

The datasheet includes a table listing the output current at a VDD of 1.25 V for different inductor values. I’ve reproduced it here.

L1 Inductor value

Output Current













Another option is to replace the simple inductor with a transformer. The Coilcraft Hexapath 6 winding HPH1-1400L has a winding inductance of 200 uH so it fits right in the range of values listed in the table. In figure 6 we have configured the HPH1-1400L as a 1:5 step up transformer and the circuit can deliver 1 mA of current to a 15 KΩ load resistor ( or 15 V DC )

Figure 6 Transformer DC-DC booster delivers 1 mA at 15 V.

I’m sure there are countless other possible circuits we could think up. Such as using one of the AWG outputs from the Analog Discovery module to drive the CE input. Appling a pulse width modulated square wave could serve as a way to change the brightness of the LED.

Adding a voltage comparator to drive the CE input with feedback from the boosted output adds regulation to the circuit as in the DC-DC converter Lab Activity. The regulation scheme proposed in the Lab is more complex but a simpler version can be made by adding just a couple of resistors and an NPN transistor to figure 4 which demonstrates the concept. Figure 7 shows the additional circuitry.

Figure 7 Adding negative feedback regulates the output voltage.

The regulated output voltage will be N times the VBE of Q1 (a 2N3904 works well). The multiplication factor N is set by the resistor divider ratio. Using the 10 KΩ potentiometer and the resistor values shown the output should be adjustable to a range of voltages around +5 V. The load regulation is fairly good up to the maximum current based on the chosen value for L1 however, the temperature stability will be rather poor because of the strong negative TC of VBE.

As always I welcome comments and suggestions from the user community out there.


  • Hi Doug - thanks so much for your investigations and ideas.  I have a number of these lights that are in a shady area, so seldom get a chance to recharge the batteries.  I am thinking about using a remote Li-lion pack (1S3P) to provide 3-4v to these units and bypassing the Ni-Cd battery in each unit.  I would still use the solar panel in each unit to signal dusk to the YX8018, and switch on the LED.  I guess I will need a back feed protection diode in each unit to prevent them from attempting to charge the 18650 pack… will I also need a voltage regulator to step down the Li-ion’s greater voltage, or will the YX8018 operate ok at somewhere between 3 and 4v?  BTW - the 18650s will be solar charged, but from a bigger and much better placed panel.  The lights are placed along a 20m path, so I expect some voltage loss by the time it gets to the last one in the string…

  • Hi Doug, I appreciate this is an old post but i'm looking at modifying my own garden lights that use this chip and was hoping you could help with a question I have.  If I control the led on/off function independantly i.e. place a switch inline from the negative poll of the LED and choose to switch off the led when it 'should' be on i.e. when solar panel is producing next to no current how will the XY8018 react to this.  Will it recognise the low current from the solar panel and switch the current to the led circuit but find no draw and revert back to the charging circuit?  If it does that and because it is now dark outside will the circuit then drain the battery because the solar panel is now acting like a resistor?  Sorry if my explanation is poor or uses the wrong terminology i'm probably a little out of my depth being on this page.  All help is appreciated.

  • DISCLAIMER I am a developer/experimenter and my experience is with a pack of 20 off-the-shelf YX8018's I got by mail order. YMMV, maybe considerably; I have no idea who or how many companies make them.
    A) Some documentation I have found says that it should work from 0.85 V to 2.5 V. I have had got the YX8018 working with well under 1 V; I have also driven it from about 3.6 V and 4.5 V, via an Arduino Nano output pin with 180 ohm series resistor (to limit the current drawn). 
    B) It is a 'charge pump'; it is not a 'voltage multiplier' nor a 'regulated power supply'. It is the Vf of the LED that limits the output voltage*. I have successfully illuminated 7 green LEDs in series, generating between 10 & 11 V. 
    C) As far as the YX8018 is concerned, it makes no difference whether you use NiMH or NiCad batteries. You could run it off just about anything, including a charged capacitor. 

    My own project is to generate enough power to activate a 12V door lock actuator, in both directions, from a 3.6 V NiMH battery. The actuator has 2 ohms resistance and draws 6 A when used as intended. I have achieved this, by charging two 4500 uF capacitors; one to generate +12 V and the other -12 V (using the two circuits Fig 4 & 5) and removing the LEDs. It takes about 20 seconds to charge the capacitors to just over 10 V, which then have just enough charge to drive the actuator the full travel from one end to the other. 

    * There seems to be some 'internal Zener' on the LX pin, as the most I can generate at the capacitors is about 11.5 V, whether I drive it from 4.5 V or 3.6 V. 

  • yes, the diode polarity is correct.

    current through the inductor builds magnetic field.

    collapse of field induces a current that upon encountering a short, sustains the magnetic field, or, encountering "infinite" resistance, produces "infinite" voltage until the energy of the magnetic field is consumed... ie, an open circuit makes a really high voltage that burns through insulation as the resistance of air/plastic etc isnt infinite at all, and that arc is the current being consumed across that resistance producing a given voltage. e=ir.

    the diode allows the current to keep circulating through the inductor in the applied direction but clamps it at the forward voltage of the diode, the energy being consumed at a rate proportional to that forward voltage, for as long as it can supply the required current.

    when non-conducting, the diode is "infinite" resistance, when conducting, it appears as a non linear resistance that causes 0.6v drop regardless of current.

    its a neat little trick to make relays etc turn off really fast... add some resistance to the freewheel diode for a higher voltage for a faster decay of magnetic field or current... i like to use indicator neons myself, they clamp automatically to 50-70V or so. much faster field collapse than say, an 1n4007 with its 0.6-0.7V drop.

    we often confuse it with BEMF. 

    BEMF is the opposition as we APPLY the current.

    when we remove the current source... its F(orward)EMF!

     in fig 2, the forward voltage of the diode is higher than the battery, so no current flows. the inductor stores magnetic energy, then the decaying field again produces FORWARD EMF, and, as above, encounters a "resistance" that clamps it at the forward voltage of the diode.

    obviously a 1n4007 instead of the LED will fry as it conducts at only 0.6v and the battery has no limiting resistance... and a red led of 1.2v may also smoke...

    fig2 for when the source is LOWER than the forward voltage of the diodes.

    fig3 for when its HIGHER than the diode voltage.

  • Nice article, thanks! Is the polarity of the LED in Fig. 3 correct? What if one swaps it?


  • We don't manufacture the YX8018 so we are not able to comment on any specific performance related aspects of that part.

  • What is the minimum working voltage of YX8018, & how does it maintain output voltage constant without an external regulator diode. isn't this cct better to use with Ni-Mh battery instead of Ni-Cd?