Home

Things are looking up, slightly. Some time ago I picked up a “Really Useful Box” at Staples. The rectangular board fits nicely inside. A larger version of the same box, would include enough room for the battery switch and battery. The box itself is not entirely watertight; it needs a bead of silicone around the rim. Note: Really Useful Boxes has a bizarro shipping policy for tiny boxes; $10 will ship up to 5 boxes, which arrive in an comparatively huge double-layered cardboard, suitable for shipping something heavy and delicate, not a handful of tiny plastic boxes.

Here’s the box, with the shunt resistor and “indicator” LED siliconed onto the outside.

IMG_0424.JPG

Opened:

IMG_0425.JPG

Bottom view:

IMG_0426.JPG

Stacked on the larger box:

IMG_0431.JPG

Headlight mounts always end up looking a little clunky, and are a little hard to adjust. This one works better than most I’ve tried, and looks better too (at least, relative to the others). You’ll have to take it on faith that the shape is pretty good, but the shape is pretty good, meaning, it throws a lot of light down the road, not too much too high, and makes a nice puddle around the front of the bike. I solve the light-in-eyes problem with low-beams; this one’s not too bad, but the amber low beams, mounted low, aimed low, are vastly better.

Read the rest of this entry »

Figured out the wax thing (probably). I suspect that the BuckPuck has an overheat circuit, and was still hot from the melted wax when I tested it.

The official bottle-cage container was not at all durable, and really a waste of money. Instead, I am using a tighter-fighting, cheaper, with reliable screw-top, Trader Joe’s Peanut Butter jar. Also, I decided to ditch the 8xAA battery pack, and will either use a 9 volt battery, or am 8xAAA pack, which can fit into a little bubble wrap to protect the electronics, while still leaving it loose.

New effort, being tested:

IMG_0386.JPG

Closeup:

IMG_0386_2.JPG

In a (particular) bottle cage:

IMG_0392.JPG

Lid off, showing holes for wires (not yet sealed) and easily accessed standlight-controlling chip, with switch and over-voltage LED. The battery switch PCB (itself coated in wax) flips up out of the way to allow access to the battery.

IMG_0394.JPG

I’m not 100% sure on the wax potting; it adds weight, which is not for everyone. I’ve also laid out the circuit on a larger rectangular board with room for zip-tie-downs for the large capacitors, which is a lighter-weight way to immobilize them. However, it doesn’t fit as well into a cage-compatible container.


Interestingly, the battery controller is very sensitive to static discharge; touching any part with a finger after turning it off, tends to turn it back on. I’m not sure this matters, but it would be nice to make it be a little less excited about turning on.

I’m still tweaking the software. Latest mistake on my part was getting the numbers backwards for the on/off counter, so right now it is a little too happy to turn on. This doesn’t necessarily run down the battery; if the battery comes on when the bike is moving “too fast”, the effect is to dim the lights slightly as the system voltage drains into the battery, and the batteries are (slightly) charged.

I added a switch to allow me to force the batteries on; in theory I could use the bike as a battery charger, though it would take hours, but the main goal is to permit the lights to stay on arbitrarily long if you need light (fixing something by the side of the road, for example). With the bike stopped, toggling the switch off-on-off turns the lights off immediately. Usually.

“Debouncing” the circuit has been a little tricky. When the microcontroller decides to “turn off” the lights, it is really turning off its own power, as well as the power to a beefy trio of capacitors, an op-amp, and a little switching power supply. It doesn’t just go to sleep, and sometimes thinks it sees signals as things settle unevenly towards zero (somewhat like HAL singing Daisy). So, timers and wheel turns are taken on faith as they occur, but for purposes of detecting switch movement, and for resetting the software to its on-the-road state, there are counters. A net of 313 (1/10th second) samples must agree before the switch is judged to have a value. For purposes of deciding that the bike is no longer sitting still, 8 zero crossings (one foot of motion, can be back-and-forth) must occur. This is partly necessary because there can still be voltage to the microprocessor even when the lights are out (surprise!) as the big caps slowly drain.

Packaging has been a pain. Originally I had intended to pot the controller in wax, but when I did that, for some reason it didn’t work. It half-worked, but I couldn’t get the lights to go on. Quite depressed, I got it out of the wax, checked the wax to see if it was conductive (shouldn’t be, but you never know), and discovered that now everything was working perfectly. Maybe I goofed somehow on the light test.

So, instead, and especially for this one where I am still taking it apart and putting it together again (mostly to swap out the microcontroller), things are held in place with elastic cord. I’m not entirely happy with the bulk, though part of the problem is that the bike I am testing on has no water bottle cage. An 8-pack of AA cells is probably too big, especially given that the batteries are only used intermittently.

The rear light is a win. That is a P-clamp, plus some aluminum angle stock, plus a bare LED on puck for a taillight, all but the lens painted with nail polish to keep the weather out.

IMG_0352.JPG

I think the front light would be acceptable if I had a better place for the cylinder-o-circuits. The light bracket is made from two bell mounts, two longs bolts or screws, some aluminum stock, a mirror (to cut off some glare from other cyclists and pedestrians) and some mounting nuts. The cutoff is not good enough; I think that low beams (amber, either down low or aimed low, mounted on aluminum angle stock) will be necessary.

IMG_0355.JPG

Side view:

IMG_0353.JPG

Head on:

IMG_0354.JPG

I imagine it would be tidier if the blue, orange, and green wires came out the bottom of the circular PCB, through aligned holes in the bottom, additional (blue, red, black, white) ran up to the battery switch, and then an AAA battery pack was cradled in something squishy below the switch.

Wow. (Been experimenting with tweaks.) I think a few noise-reducing capacitors might be in order. Sometimes a few taps on the bike are enough to turn the lights on.

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.

Read the rest of this entry »

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

It’s a power supply, AND A BEER COASTER!!! It will fit in a container that will fit in a bottle cage, yay packaging.

(Click to zoom.)

IMG_0153.JPG