This is the plan, anyhow. N-1, I designed long ago, finally built, and with the exception of broken wires, a confuso (OVERFLOW vs OVERVOLTAGE), and a units error (4000Hz “ticks” versus 1Hz “seconds”), it appears to work. The only remaining mystery is why not all the zero crossings are detected; I went so far as to determine that the cause is on the analog side, and I think before I worry too much about it I will check to see if it matters, or if I can fix it in software.

So, why do I think this one is better? First, it is not sensitive to the LED load; it just runs whatever you put there, pulling the right amount of current form the hub. Second, it has a switchable doubler, so the lights come on at low speeds, but then the doubler turns off at high speeds for more efficiency and less need to limit current. Third, you can do whatever the heck you want with timing and flashing patterns. Fourth, on the advice of Wiley, it uses screw-down terminals, which is a good thing (most first controller just died, from a corroded+broken wire) and allows easier repairs in the field. Fifth, it has “everything”; it can be reprogrammed in place, it can supply at least a half-amp of 5V current for phone charging, it has an optional input for solar panels if that’s what you want, it has a shunt for overvoltage protection, and it has a switched optional input for batteries (or capacitors) for a standlight.

The prototype (which proved most of this would work) has several flaws; among them, I was still suffering from the delusion that I could stick it in side a frame tube. That’s not such an awesome idea. Making it in one compact lump allows all the capacitors to be lashed down tight, allows the screw terminals, and reduces the need for extra wires. The whole thing is relative compact — 5cm by 10cm, with a bit of the BuckPuck sticking off the end, and the capacitors piled about 3cm high.


And there’s a wee bit of software….
Read the rest of this entry »

Lights for a beater bike

December 23, 2013

A first effort at writing this up, if you’re interested and it’s unclear, ask questions.

I’ve never been 100% happy with the packaging on home-made lights, but glueing power LEDs to aluminum angle iron with a mirror on top works pretty well and gives you some options for mounting (for example, using long bolts to bell brackets). On a bike with a front basket, however, the basket itself is a natural place to mount not only the light, but also most of the wiring, so inferior packaging is not such a big deal.

To start, here’s what the bike looks like with lights installed, showing the basic arrangement of the basket, hub, wires, and tail light.

Beater bike with hub-powered lights mostly mounted under Wald basket.

Note that there’s no off switch and no way to disconnect anything but the hub without wire clippers or a soldering iron. Why build it like this? #1, eliminating connectors and switches eliminates sources of failure. #2, daytime running lights turn out to be useful. From the OECD, Cycling, Health and Safety, p. 170 (pdf):

The safety effect of daytime running lights on bicycles was tested in a Danish study in 2005 (Madsen 2006). Nearly 2,000 cyclists in the town of Odense used the new induction lights (flashing type) for one year with, while 2,000 others continued with ordinary bike lights, which were only switched on during dark hours. The accident frequencies of the two groups (based on self-reported accidents) were then compared and analysed. … The main result was that use of daytime running lights was associated with a reduction of the number of crashes by more than 30%. The number of related crashes (crashes in daylight and with a counterpart) decreased by 50% approximately. Both results are statistically significant. There are indications that the study may have not controlled for all factors – for instance it is unclear to what extent the control group’s crashes included single vehicle crashes (this type of crash is hardly influenced use of induction lights). Also, the study makes no finding as to the safety effect of flashing versus steady lights.

The photo below shows the basket from the other side, and on Flickr it is annotated with notes on some of the parts, but the basic idea should be clear; there’s room under a basket, and plenty of stiff wires that can be used for mounting zipties. The little wooden stick is intended to adjust the level; ideally some of the light is visible to approaching traffic, but it is better if most of it is kept down low and out of people’s eyes. One problem with “beater bike” systems is that it’s not clear how much money to put unto them; for another $25, it’s possible to add a second set of LEDs on a switch that are aimed lower and with a color chosen not to be so deadly to night vision (e.g., amber, or perhaps warm white).

Side view of LED lights under Wald basket

The photo taken from below in the front shows the LEDs, lenses, mirror, wiring, and aluminum angle on which the LEDs are mounted. Note that one lens is a spot, and the other spreads its light out horizontally. The goal for the spread lens is to ensure visibility from the sides and to fill in the near part of the road.

Headlights and mirror

The “better taillight” is made from stuff I had lying around because “you never know, that might be useful”.
The clear tube is acrylic with one-inch inner diameter, and the round top is an acrylic hemisphere, held on with superglue. There’s a fancy holographic diffuser film in there from a sample sheet; not clear that is really necessary, some vertical sanding on the inside/outside of the tube might have been just as effective.

Better taillight.

Front LED: could be CREE XTE, XPG2 or XML2.

Rear LED: could be red or red-orange. Red-orange is a fudge to make the taillight be slightly brighter, but the modern red LEDs are probably adequately bright. It’s even possible to use deep red.

Lenses: Taillights don’t need lenses, but headlights do. I like to use a spot for one and an oval for the other.

Lense holders are necessary for the headlights and their lenses.

PCB for rectifier/doubler.
Or this improved PCB for rectifier/doubler.

Diodes: SB540

Small capacitors: 1000 uF, 16V

Large capacitors: 6800 uF, 35V

Wire: I use marine-grade, 2-conductor, 18 gauge.

Mirror: 1/8″ Acrylic mirror from US Plastic

Acrylic tube

Acrylic hemisphere

Assembly hints/gotchas:

First cut mirror and aluminum angle. I sized the aluminum to fit to one side of the support under the basket — the middle seems symmetrical, but it will get dirtier there. Next drill aluminum. Next glue mirror to aluminum, then drill through mirror. I always roughen surfaces before gluing and use 5-minute epoxy because I am impatient.

It’s good to clip the LED hexagons to a heat sink while you are soldering them, except for the tab being soldered. That protects the LED from being overheated (I ruined one that way once, though I didn’t ruin about a dozen others being careless).

Use nail polish on all the exposed electrical connections (but not on the LED lens itself) to help protect against the elements. It’s not required, but it helps.

Glue the hexagons and lenses in one operation, clamping the entire assembly. The lenses have a larger diameter than the LED pucks, this prevents you from gluing them on too close to the mirror. Be aware of the orientation of the oval beam lens — you want it wide from side to side, not from top to bottom.

Work some tape in around the headlights to help keep water splashes off the LED.

When wiring, always think about strain relief. Vibration on a bicycle is the enemy of all electronics, including wires.

The taillight is always ad hoc and depends on what your mounting options are. Gluing hemisphere to tube uses superglue in a pretty large quantity, and the superglue vapors tend to fuzz the acrylic surface (which is okay for a taillight). A bare LED works, but a little protection from bashing and the elements is better, and a larger-than-point light source is also better.

An investment proposal

March 13, 2012

First, credit where credit is due. I read Mike the Mad Biologist. His post pointed me here, which mentioned an atrociously written Washington Post article (bad arithmetic, erased without comment, then corrected, with no reflection of the vastly different results in the text). This got me to think about buying efficient light bulbs as an investment, and so I did some interest calculations, as if the bulb were paying a mortgage.

I’ve long been interested in LED lighting, and have installed some myself in places where it was a clear win (underneath cabinets and on bicycles). I’ve been wary of “LED light bulbs” for some time, because to be fair, diplomatic, and objective, up till now, most of them have been overpriced crap. But last weekend or so, I was at the Home Despot, saw some LED light bulbs, read the labels, decided that it was worth my while to try one of them. I got a 14 watt bulb claiming to be the equivalent of a 75W bulb, installed it, and so far, so good — it’s bright, good color temperature, and instant-on, as expected. Lifetime is TBD; claims to have a 5 year warranty (but did I save the receipt? Whoops, need to remember to do that when I buy more), also claims to have a 25000 hour life, which is reasonable for LEDs. Also claims to be dimmable, but the reviews consistently say “no, not really, not like you’d expect”.

So, if I view this bulb as an investment, what is the rate of return? Let’s benchmark it against an incandescent bulb, since that is what the Post did. I initially decided to assume that I was saving 60 watts per bulb (15 instead of 75), running it 6 hours a day, and paying $.12/kwh for electricity (actually, I pay $.15, I just checked last month’s bill). Electricity savings come to about $1.30 per month.

Assume, also, that an incandescent bulb costs a dollar, and has a lifetime of 1500, so include the cost of the bulb in each month’s savings. At 6 hours per day, the bulb savings are 12 cents per month. Total savings are $1.42/month.

Assume the bulb will last 10 years (21600 hours at 6/day). I paid $30 for the bulb, plus sales tax, rounded up, is $32.

So, supposing I made an investment of $32, and it paid me back $1.42 per month for 120 months, at which point, no more payments, just as if I were loaning money to someone else for an itty-bitty mortgage. Spreadsheets have a “RATE” function that will determine the interest rate given a present value, future value, payment amount, and number of payments; in this case, -32, 0, 1.42, and 120. And out pops 4.4 percent. Not very exciting, though it helps that it is free of taxes, since it is money saved, not money earned. And if you only ran a bulb 3 hours a day, and only saved 45 watts, and only paid $.10 per killowatt hour, only 1.2%. That’s not much of an investment, is it?

But those interest rates are PER MONTH, not per year. So really, 1.2% — that’s 14.4% return, per year, tax free. If you return to the original assumptions, the $32 investment in an LED light bulb pays out at 52.8% per year.

What’s the risk in this investment? I see three possible risks that could cause it to fail to pay out.

First, you can only save money that you have; if you go bankrupt, then it’s not interesting that you aren’t paying money to the electric company, because you’re already not paying money to the electric company. However, all investments are vulnerable to bankruptcy risk.

Second, electricity in the next few years could become incredibly cheap (pigs could fly, too).

Third, the bulb could fail. Obviously, it pays to save your receipt; that gives you insurance of some sort for up to 5 years. If the bulb fails in five years instead of lasting ten, then the payout is not as impressive. If electricity is too cheap, or if you don’t run the bulb enough hours per day, it won’t pay out (3 hours per day, $.10/kwh, 45 watt savings, 5 years, will not pay off). But, if a bulb is on even 4 hours a day at $.10/kWH, the interest rate is 7.4%, or 3 hours at $.12/kWH, is 5%. Where I live with $.15/kWH electricity, 3 hours a day, 45 watts less, failing at 5 years, pays off at 14.8%. At 6 hours a day, 45.8%. I really like the idea of an investment that pays me 14.8% annual interest, tax-free, when it “fails”.

Did you notice that the Washington Post thought it was more important to tell you about the terrible government-subsidized light bulbs, when they could have been giving you this useful information instead? Says something about their priorities, doesn’t it? Hard to believe that anyone would think time spent reading that would be well-spent.

USB charging on a bike

February 20, 2012

I’ve spent way too much time and money tinkering with bicycle electronics, but I am so incredibly pissed at off at the high price and mediocre quality that you get if you buy retail instead of DIY. I had a clever idea yesterday that would allow easy, simple combination of a USB charger with a cheap, brain-dead rectifier/doubler.

Read the rest of this entry »

It has to digest a wide range of input voltages, and it has to be efficient enough to deliver 2.5 watts of power.
This version has several flaws (spec’d wrong buck diode, holes were not large enough; needed to bias D+ and D- to make iDevices happy about charging), but with some tinkering, it works (tested with iPod Classic and Nano). Further research needed to figure out why it won’t charge my Motorola phone. Further research: mini-USB is a 5-pin connector, and pin #X (they call it that) is shorted to pin 2 and connector to pin 4 (GND) with a 200k resistor. For now, I will just buy a cable that claims to work for this purpose.


Not to be confused with this post.

Trying two new things, and one of them certainly worked in a prototype.

Thing #1, is to make the printed circuit board fit in a 1-inch tube. That means I can stuff it either in my steerer tube, or in my seat tube, out of sight and mostly protected from the weather.

Thing #2, which is a little bit trickier, but made a little bit easier by the amazing op-amps we can buy nowadays, is to build a current monitor that works from a few-millivolt signal above ground. This means that no matter what is attached in the way of lights, it will pull “the right amount” of power from a hub dynamo. Read the rest of this entry »

LED Color rendering

February 26, 2011

A quick and half-assed comparison, inspired by an argument on SlashDot.

I took (more than) five pictures, of my hand, holding a bunch of different colored wires, in indirect daylight, under neutral, cool, and warm LEDs, and under the light of all three LEDs combined. Camera was Canon SX100IS, ISO 100, Cloudy white balance, let the camera pick aperture and shutter.

Executive summary: true daylight is best of all, then mixed LEDs, then neutral, then you’re probably not happy with your light.

Read the rest of this entry »

This is pretty much a copy of what I did in the upstairs kitchen, but with more attention to detail because there’s no molding to hide behind. It’s a little heavy in its use of aluminum.

Read the rest of this entry »

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.




Bottom view:


Stacked on the larger box:


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 »