picture home | pixelblog | qt_tools

omino code blog

We need code. Lots of code.
entries for category "solar garden light"
David Van Brink // Sat 2007.08.11 21:30 // {solar garden light wbl weird blinking lights}

WBL: Production For Use

Solar Powered WBL

Here is my first completed solar-powered WBL.

I took the solar garden light apart and carved away much of the plastic around the battery and circuit board. This is epoxied and screwed to a plastic jar lid; the underside has a rectangular hole to replace the cheap rechargeable AA cell. The solar cell is placed on a “chip-tube” signpost, and angled slightly upward.

It’s been running reliably, nightly, for a few weeks now. (Zener diode did the trick! No more burnouts.)

Here it is at night, after a full day’s charge. It’s a 15 second time exposure, you have to imagine it blinking inside the plastic peanut-butter jar.

Recycle, Reuse

The whole point of this “production for use” series of WBLs is to use discarded materials. Old bendy straws and styrofoam packing peanuts are evident above. It turns out that, for this project, translucent objects take on quite a mystique! Straws, salsa-cups from lunch, discarded syringe holders, thin styrofoam sheets, pudding and applesauce cups, and even burnt-out incancdescent bulbs are all figuring in. But plastic bottles are the best.

Here’s the frustrating part: trying to get the labels off. Ironically, Odwalla bottles use some kind of impervious glue, shown here glinting in the sunlight and clinging accidentally to dirt. And nail polish remover labeling is (perhaps unsurprisingly) immune to nail polish remover. But the Elmer’s glue labels? They just fall off when poked.

I’ve tried soaking in water, rubbing alcohol, and “goo gone” with various levels of success. More research is needed on this aspect of reuse.

Myles // Wed 2007.12.12 07:487:48 am

to remove any lable from a container, paint with household ammonia, then cover with some plastic wrap. Wait 10 minutes or less, the lable will peel off. This also works with stickers on cars.

David Van Brink // Mon 2007.12.17 10:0710:07 am

Awesome! Thanks for the tip! I will try the Ammonia Method & report back.

oh, i dont know. what do you think?

This post follows an earlier post.

More Measurements!

After a tantalizing near miss, I had to back up a bit to first principles in determining how to harness the mighty force of a $4 solar garden light to power a PIC chip in the evenings. But I really do want this to work… the idea of repurposing cheap consumer products to power my own gadgetry is just too appealing to pass up. It’s perfect for this use: pretty lights that activate automatically at night.

The solution, by the way, was to place a 5v zener diode across the output from the garden light, to protect the PIC circuit from overvoltage.

But because I had so much fun using an “oscilloscope” to understand the problem, I am compelled to here include and interpret the observations which led up to that solution.


Ah, the very word evokes sweet theremin tones. Traditionally, an oscilloscope was useful for observing periodic events and waveforms. Luckily, I have access to a modern oscilloscope which is digital and quite small and acts like a voltage-meter attached to a strip recorder. It was useful to understand the voltage swings of the solar garden light on a timescale of 10 or 15 seconds.

Run 1: Solar Garden Light With No Load

First experiment was to understand how the voltage multiplier responded with no LED or other load across its output terminals.

  • A: When the sun is out, the output is a steady 1v. Probably just the battery straight through, somehow. 1v is not enough to conduct through the LED.
  • B: Covering the solar cell for just a moment activates the voltage multiplier, and it charges up to 17 volts! With no load, it just sits there, discharging very slowly.
  • C: I touch the output terminals together for a moment, and it drops to zero, and then back to its default 1v.

Run 2: Solar Garden Light Attached to PIC Blinker

I knew that the solar garden light could power the blinker without necessarily destroying it. At least not ever time. So I risked it, to better understand what was going on voltage wise when it was running.

  • A: When the solar cell is covered, the voltage momentarily spikes to 7 or 8v…
  • B: …then settles down to 3 or 4v, very spiky, as the LEDs do a flickering on/off pattern.
  • C: All the LEDs go off for a little while, and the output of the solar garden light climbs up to 10v! The PIC chip specifies an absolute maximum of 7, but seems somehow to survive this.
  • D: The next pattern in the program begins: slow throbbing lights. The voltage drops back down to a reasonable 3 or 4v.

Run 3: Using LEDs To Limit The Voltage

Normally the output of the solar garden light is attached straight to a white 3v LED, and the voltage measured across the LED is, necessarily, always 3v. I reason thus: No matter what the voltage multiplier is doing, the 3v LED that came with it never gets fried, and runs at about 20mA. So, I continue to reason, although the voltage multiplier swings high with no load, pulling it down to 3v still only dissipates 20mA or so. That is: we can pull the voltage down by any means we like without fear of excessive current. So, what about using a pair of 3v LEDs to keep the voltage below 6v? (The PIC is rated up to 5.5v, but hey.)

  • A: A spike only to 6v. Safe and sane! The two blue LEDs flash briefly, as they are using any voltage over 6v. (Sort-of.)
  • B: Flickering LEDs pull the voltage down to 3 or 4v.
  • C: All LEDs go off… and again the voltage only rises to 6v; the two blue LEDs glow dimly.
  • D: LEDs come back on, voltage again hovers around 3 or 4v.

And The Solution Is: A Zener Diode

It turns out that a “zener diode” is a kind of diode which has, instead of the typical 0.7v drop, a calibrated drop of some other value. You can pick any value you like from a catalog. So, by placing a 5v zener diode across the output terminals it will dissipate (maybe) a few mA, and keep the power to the PIC chip down to a reasonable 5v. I got a tiny one rated for a half watt since the solar garden light never puts out much current.

The astute viewer (more astute than I) may notice the diode’s cathode marking is next to my scribbled + marking. Zener diodes are in some literal sense wired up “backwards” compared to normal diodes. The voltage rating is their “reverse bias breakdown voltage”. Ok, whatever. At least they use a slightly different schematic symbol, with a little jag on the cathode line.

And thus, I believe that this successfully harnesses the power of the cheap solar garden light!

Future Work

Future work includes: Optimizing the software to draw less power to maximize running time, by using fewer LEDs at a time. Analyzing other models of solar garden light; apparently some of them present a high-frequency pulsing across the output, which is fine for an LED but not so nice for a microcontroller.

Thanks to Kerry V and Aaron F for their guidance and knowledge of the new electricity.

Robert Soelberg // Mon 2007.06.25 02:222:22 am


Your passion for unlocking the problems big and small continues unabated. I met you when you were writing software drivers for a graphics card maker and writing Ankh: 64 Rooms.

Your talents were so great, I was able to write a second game of 64 rooms.

Glad to see your are doing well.


oh, i dont know. what do you think?

Item 1. PIC12F509 is a fun/funny little chip.

The PIC12F509 truly embodies all that is great about our current state of technological development. It’s an 8-pin package that can store a kiloword of code and has a handful of bytes of RAM. It has 5 I/O pins and one input-only pin, and power and ground. Needs no other components; has a built-in 4MHz oscillator.

Costs about $1.

I mean really, if nothing else, it’s a fine replacement for your default 555 square wave generator, right? It costs about the same, and doesn’t need any external resistor or capacitor.

I jest of course, reminiscing about saving my pocket money in the late 70’s to buy a few more 7404’s at Radio Shack on the way home from school. Today those 5 I/O pins are about blinking the LEDs.

Oh, and the PIC12F509 has some of the requisite quirks that make it a joy to use. We don’t want things to be too easy, we want arbitrary challenges to sweeten the success.

  • Of the 1k program space, the CALL instruction can only access the first and third quadrants… and the third only if you are very careful.
  • Of the 1k program space, the GOTO (jump) instruction can only access the first 512 words unless you are very careful.
  • The RAM is bank switched in the most delightful way.
  • There’s a timer, but no interrupts! Ha!
  • The call stack is two, count ’em, two levels deep.

So this all means you have to be… how to say… “clever” in your programming, especially for a realtime LED blinker. Count those cycles and loops, friends. A joy.


Item 2. Powering the LEDs from a cheap solar garden light.

Making blinking toys is fun, but there’s always the question of how best to power them.

Today at Home Depot I picked up a box of 10 solar-powered rechargeable garden lights. Each one has a white LED and a single 600 mAH NiCd rechargeable battery. $39.95 for the whole box and you can’t beat that.

I’ve had some success with other lamps, hacking them to power EL wire. (EL wire draws a lot of power, and they only last the first hour of evening, alas.) We got this latest box for our burning man camp, but also I had to try something.

Inside, the tiny circuit board apparently uses some kind of voltage multiplier circuit. One side has a diode and a capacitor or two, the other has a half dozen minuscule surface mount parts. A quick test confirms that the voltage across the LED is 3v. The PIC12F509 runs fine on 2v to 5v. Splendid!

Removing the LED and attaching two wires in its place seems like just the thing…

note — 3v label incorrect, see edit below

An LED usually draws about 20mA. The NiCd battery is rated 600mAH at 1.2v, which would be 240mAH at 3v, or 12 hours at 20mA on a full charge. Perfect for planet Earth: the average length of night turns out to be 12 hours. (Estimates based on optimistic assumptions: perfect charge, 100% efficient voltage-multiplier. Of course, you probably bought your solar garden light in the summer, when the nights are short. And in the winter, who’s checking?)

A PIC12F509 itself draws less than 1mA at 4Mhz, 3v. That means that, assuming our blinker averages less than 1 LED on at a time — a pretty safe average, if the blinking pattern uses partial-brightness — then the blinker should run all night. Joy.

Further experiments to follow.

Item 3. Edit. Later that same day. Whoops. Caution.

Ah. Well. Experiments followed, with cautionary results.

1. Measurement across output terminals under no-load conditions.
Sensor in sunlight (“lamp off”): 1.3v
Sensor in darkness (“lamp on”): 20.75v !

2. Measurement across output terminals while blinker operating: Varying from 3.5v to 4.5v, or so.

3. During the course of connecting/disconnecting the blinker from the output terminals, somehow I fried the PIC12F509. Replacing it with a fresh one worked fine. (They’re $1 each… I have a handful of these fine little computers.)

Hypotheses. The voltage multiplier is some kind of free-running unregulated bugger. With no load the voltage can climb pretty high. The device is designed for a particular load (a 3v 20mA white LED). In normal operation the device starts pumping its capacitor while there’s a load. I probably attached the blinker while the storage capacitor was peaked at 20v, letting it run through the load suddenly, and that fried the PIC chip.

Speculation. To avoid sending spikes through the replacement load, don’t connect it while the output terminals are live. Do it in the sunlight, or remove the battery first. And touch the leads together to discharge it. It may be prudent to program the blinker patterns such that there’s some LED load at all times. It may be prudent to seek more expert advice about voltage regulation and maintaining a load in some electricity-savvy manner. I’m just a software guy.

More to come.

Yong // Mon 2007.06.18 09:099:09 am

David, you are a true geek. Thanks for sharing.

Kero Kero Keroppi // Mon 2007.06.18 17:495:49 pm

Good and honorable stuff. Inspired by your effort, I’ve started writing up my own current project. Have look!


David Van Brink // Mon 2007.06.18 21:049:04 pm

Yay Aaron!
(And looks v. groovy so far.)

Kerry Veenstra // Mon 2007.06.18 22:3910:39 pm

Yes, I’ve seen that unregulated-supply thing, too. I have an old weather satellite receiver (which is sort of unnecessary now with the WWW). It wants 12 VDC. If you buy a Radio Shack 12V power supply, it will drive the receiver with about 16 V! If you buy a Radio Shack *Regulated* 12 VDC power supply, you’ll pay twice as much, and the receiver will be driven with 12 V, and one of channels will be not be fried.

oh, i dont know. what do you think?

(c) 2003-2011 omino.com / contact poly@omino.com