Standlight for power LEDs
November 26, 2010
My brother wanted one of these ages ago, I realized it would probably need software.
Software had two bugs in it, initially — forgot to say “unsigned” when that was what I meant, and had a fencepost error that had the standlight on twice as long as intended.
But the circuit worked the very. first. time. I’ve never built one of these before, I was quite proud that it worked. The standlight controller contains an Atmel ATTiny85 (overkill, for now) that watches the wheel rotate by monitoring zero crossings in the AC output from the hub alternator. When the hub spins too slow, it activates a battery-connecting circuit; when it spins fast enough, it deactivates the battery-connecting circuit. If there is no wheel motion for “long enough”, it deactivates the battery-connecting circuit. I checked, with a multimeter, to verify that no current flowed into the battery when the wheel was spinning fast enough. The supply current is about 70-80 mA, which should support many hours of on-time.
Bike light plans
October 22, 2010
Inspired by this slashdot article, I thought I should go ahead and detail what I am working on, and what I plan to work on next.
Right now, I am working on a two-board lighting system. One port takes two AC in puts from a bicycle hub dynamo, and provides controlled current to run one or more high-power LEDs (patent madness — if I said “several”, that would be limiting and exclude the “one” case). It also makes available a 5V supply, a ground, and a high-voltage DC supply that varies based on bike speed and lighting load.
The second board receives ground, high voltage, the two AC lines, and 5 volts, for running a microprocessor, and also has two attachments (if I said “wires”, that would be limiting) for a battery pack. The second board monitors the high voltage; if it falls below a threshold, it activates (electrically connects) the battery pack to the high voltage lines.
Optionally, it also monitors the wheel rotation rate by observing the two AC lines. Based on wheel rotation, it may (don’t be limiting…)
- during periods of no wheel rotation, run a timer, and if enough time elapses, disconnect the battery;
- detect a wheel rotation rate exceeding a threshold, and disconnect the battery;
- detect a wheel rotation rate exceeding a threshold, and start a timer, and if enough time elapses, disconnect the battery (this restores some charge to a rechargeable battery).
After designing the second battery-switch board and after discussing some of this on the Xtracycle mailing list, I realized several things. One was that the LED current supply could and should be separated from voltage rectification and doubling; rectification and doubling should reside with the battery switch. Second, was that the voltage doubler could be disabled when the voltage was high enough (too-high voltage is a problem sometimes), and when this was the case, that more DC current would be available, and this change in state could be signalled to the LED current supply. The on-board microprocessor controlling the battery switch, could also control this. Third, was that designed this way, it would be possible to also build a 5V supply module, which could be connected or switched on when lights were not needed, and used to charge or operate devices through a USB cable. On long bike trips, this would allow continued use of consumer electronics such as music players, some cameras, and cell phones.
And, should all these great ideas work, it should then be possible to build a unified supply board (running from the same rectifier, doubler, and battery switch board) combining both the USB and LED supplies, apportioning power appropriately between them, optionally using the USB power protocols to determine the load on that supply, and adjusting the lighting appropriately to stay within the power capacity of the dynamo hub.
It is, of course, intuitively obvious to One Skilled in the Art how to accomplish this; a simple microprocessor could act as a USB host, and power calculations are relatively easy. A simpler device might not even do the calculations, and would instead simply reply on a current monitor (and optionally, voltage doubler state information) to vary the light output as necessary to not exceed the supply current limits.
One simplifying trick that I realized was that the best way to limit voltage, is simply to dump power into the batteries if the voltage exceeds a safety threshold; modern NiMH batteries can tolerate very high charging rates and in the worst case, are cheap and easily replaced if they are accidentally ruined.
More BatchPCB goodness
October 8, 2010
Goodies from BatchPCB
October 6, 2010
My brother and I agree that it would be so nice to have a standlight (a power standlight, not one of those wimpy ones that runs on capacitors and dribbles a smidgen of light out). In theory, with the simplest software (the only kind I trust), this will become a standlight switch, compatible with the lighting that I already have.

Further second system adventures
May 5, 2010
So, in my copious free time, I tweak and fiddle on the bike light design I’d like to design next.
I thought I was close; I’ve been figuring out the rough timing parameters on the software, and how quickly voltages will swing (slowly) and how long it will take me to detect the swings (several centiseconds) and what the big loop cycle time ought to be (2400Hz). But I can just track the current in the control loop, and that should be ok. So, life is good.
And then I realized that I could embed solar panels, under acrylic or polycarbonate, on my snap deck. 150 square inches accessible, I could put enough solar cells on there to get perhaps 10 watts of power. That would be nice, for daytime use — but it would cost $75 for the cells. (I don’t believe these estimates — the site I found with Google provides watt estimates that I know are incorrectly high because they simply multiplied Vopen circuit and Ishort circuit).
Decisions, decisions.
Working on software for a second system
January 18, 2010
As regular readers (if any exist) know, I am slowly developing a better bike light for my own amusement. Said light will have 3-10 watts of LED light, meaning 3-10 1-watt power LEDs, at an incremental cost of $10 per LED, so it will actually provide a useful amount of light. One of the hurdles to cross is programming an embedded processor, in particular one with interrupts, because some events (wheel spins) will happen whenever they will. I am using CrossPack AVR to develop and download code. I got my starting code from Instructables, and an 8 pin AVR development board (not necessarily necessary, but sometimes I do make a time/money tradeoff) from Sparkfun, and USBtinyISP programmer (made from a kit) from Adafruit (this was much easier than dealing with the finicky Windows-centric programmer from Sparkfun). An 8-bit board is suitable for an ATtiny13 and ATtiny25, 45, and 85; that had been my original plan, but now I think that ultimately I will use a larger chip. However, all the hard (i.e., “new”) stuff can be tested with this setup.
I added an LED (with limit resistor) to pin PB4 on the development board:

Backside detail (notice the LED wire end wrapped over to ground):

Read the rest of this entry »
Light photo
October 29, 2009
Playing with my bike, playing with my camera.
Read the rest of this entry »
Not so grand plans
April 6, 2009
I decided, that the next circuit I build, will do one thing well, and I’ll worry about the rest later. Read the rest of this entry »
More PCBs
March 26, 2009
There’s a learning curve. I think I’m past it. Read the rest of this entry »
Further adventures in bike-light-ology
January 19, 2009
Today’s lesson: Hub generators are current sources. Read the rest of this entry »





