New DIY dynamo light project

For discussions about bikes and equipment.
edocaster
Posts: 475
Joined: 10 Apr 2013, 10:43pm

New DIY dynamo light project

Post by edocaster »

A few years back, I made a couple of DIY dynamo bike lights (or rather, conversions). The last one can be seen at viewtopic.php?p=820630#p820630

I'm now attempting a new light, and hope to use this thread to cover progress, and maybe get some advice if I get stuck.

The last light was a variation on the Pilom circuit 9 (see: http://pilom.com/BicycleElectronics/DynamoCircuits.htm). It made use of five Cree XM-L LEDs, switchable between full-wave rectifier (full power) and voltage doubler (half power). Amazingly, it all worked great. But this project will try to make a more road-specific beam, using a donor Lidl bike light which I've disassembled (more on that in a later post). It will also take advantage of the fact that multiple discrete LEDs are not required, as a single Cree XHP35 is a 12V LED, sized small enough to collimate.

I also plan to use an online service (EasyEDA) to actually make a PCB, using largely surface mount parts. This is a completely new experience, and I'll see how well it goes (and how costly it gets).

This is the initial circuit:
dynamo-light-2023s.jpg
...which is the left-hand side of circuit 12 on the Pilom site (so, minus the complicated automatic switching). The plan is to eventually switch it between the two modes electronically, rather than using a mechanical switch.

I'll update this thread as I progress.
rjb
Posts: 7250
Joined: 11 Jan 2007, 10:25am
Location: Somerset (originally 60/70's Plymouth)

Re: New DIY dynamo light project

Post by rjb »

Very nice, Will follow your progress with interest. Theres a few people on here that tinker with lights. I don't understand anything beyond the basics of electronics. I'm a nuts and bolts man. :D
At the last count:- Peugeot 531 pro, Dawes Discovery Tandem, Dawes Kingpin X3, Raleigh 20 stowaway X2, 1965 Moulton deluxe, Falcon K2 MTB dropped bar tourer, Rudge Bi frame folder, Longstaff trike conversion on a Giant XTC 840 :D
edocaster
Posts: 475
Joined: 10 Apr 2013, 10:43pm

Re: New DIY dynamo light project

Post by edocaster »

I'm relearning most of what I forgot from last time! Hopefully this thread will be useful for me too, as I have huge gaps in my knowledge.

To help those stumbling on this who need a primer on how dynamo lights like this work:
- Modern lights use LEDs, which only run on DC, while bike dynamos typically produce AC. So the circuit needs to rectify the AC to DC, which is what the diodes at the top and bottom left (and two other points) in the circuit do.
- Most '6V 3W' bicycle dynamos (hub dynamos at least) can actually produce higher voltages and more power. They tend to want to offload around 500mA of current, and if a load doesn't soak up this current, voltage will keep rising (with speed). This behaviour is similar to a current source, in contrast to typical voltage sources (batteries, etc). This allows multiple LEDs in series to draw more power, albeit no real power is produced at lower speeds. No driver circuitry is needed for the LEDs too, providing they can comfortably take 500mA.
- The magic of the more advanced Pilom circuits is to add a voltage doubler mode, which allows the dynamo to produce half the current at lower speeds, rather than nothing.

My original plan was to build this new light into a Lidl STvZO-compliant (i.e. German road-legal) bike light. I actually picked up two - a 70 lux version and a 60 lux version (someone was selling the latter for £3.50). They're pretty decent lights, but disassembly was difficult. I had slightly better luck than the fellow in this video: https://www.youtube.com/watch?v=Yj5lmfiL6po - but the light is glued together - no clips, no screws - with no easy reassembly. The main issue is I underestimated how small the space is in the light. The circuit board is about 7cm long.

I'm trying to avoid a project box and separate lamp head this time.

In any case, at least I have the reflector, and for housing it, that's something to figure out later. Might have to learn CAD and 3D printing...
Greystoke
Posts: 482
Joined: 8 May 2018, 7:41am
Location: Lincolnshire

Re: New DIY dynamo light project

Post by Greystoke »

Very interesting.
My own bikes use various dynamo lights, I still use 2 halogen lights in series switched at speed to give double the light.
I've also used 2 or 3 mr11 led bulbs but although these give good light the beam isn't really suitable for road use....no cutoff.
Getting light is easy, focusing it to avoid glare is the hard part.
Carlton green
Posts: 3726
Joined: 22 Jun 2019, 12:27pm

Re: New DIY dynamo light project

Post by Carlton green »

Thanks for sharing your project and for the update of the thread, I am following your progress with interest.

How things will work out with optics, the light source and its proper focusing, seems to be one of the bigger problems - how the produced light is directed is important.

If asked then I’d advise a separate box for the electronics.
Don’t fret, it’s OK to: ride a simple old bike; ride slowly, walk, rest and admire the view; ride off-road; ride in your raincoat; ride by yourself; ride in the dark; and ride one hundred yards or one hundred miles. Your bike and your choices to suit you.
edocaster
Posts: 475
Joined: 10 Apr 2013, 10:43pm

Re: New DIY dynamo light project

Post by edocaster »

The next step was to build a prototype. Largely to test the concept, which deviated from the Pilom circuit 12 by foregoing the complicated right side of the circuit (which has a chip to handle automatic switching between voltage doubler and full wave rectifier - i.e. low and high speed). Manual control would be far simpler, and preferable when minimising drag (a 6W light isn't always desirable, as the power isn't free).

The output of the LM2907 chip used in circuit 12 is an internal transistor, which acts to bridge (across a resistor) the two bases of two BJT transistors Q3 and Q4, turning both on, which in turn, turn the MOSFETs Q1 and Q2 on. This activates voltage doubler mode (i.e. low speed mode).

For prototyping, I planned to bridge Q3 and Q4 simply (with a mechanical switch I already had - eventually the plan is to use an electronic latch).

While I could figure out how to lay this out on veroboard (a kind of prototyping board that has strips ('tracks') of copper with holes every 0.1 inches), it gets a bit complicated (you have to 'cut' the tracks to avoid unwanted conduction) like some electrical game of Minesweeper. So, seeing as I would use EasyEDA for final layout I used it for this prototype:
Schematic_Dynamo light V4 proto mk 1_2023-08-04.png
EasyEDA lets you export a netlist, which is basically a file indicating all the 'nodes' - i.e. which components directly connect to which other components. And there is another piece of software I found, called VeeCAD (https://veecad.com/), which handily accepts netlists, and gives a helping hand when making a veroboard layout - i.e. you just keep moving components around and cutting traces until the software indicates no errors. Assuming the original circuit you've made is sound, the VeeCAD layout will be sound. (In practice, the netlist wasn't quite smooth sailing, and required a bit of search and replace to change terms, etc). Which ever way you approach it, the key is when you start cutting traces and putting components on a board you have a reference so you don't get confused.

The prototype is fairly large as the veroboard layout isn't really optimised:
Prototype 1 (plan 1a - initial build)s.jpg
(I had some of the parts already lying around and compromised on a few others - I also didn't follow the schematic entirely - and as this is only for a proof of concept, I'll probably desolder and salvage them at some point.)

I was only able to test briefly - it's not really made for mounting - and the good news is it works as planned. The LED (temporarily mounted on an overkill CPU heatsink) switches between the two modes via the mechanical switch. Voltage doubler works immediately on wheel rotation, full wave rectifier needs a bit more speed.

Next step is to test replacing the mechanical switch with a 'bistable flip-flop'. I had looked up a few flip-flop circuits online, but they all seemed confusing, and possibly unstable when dealing with a somewhat fluctuating voltage. In short, I've ordered a pre-built flip-flop on eBay, and will then see if that works to replace a mechanical switch.
edocaster
Posts: 475
Joined: 10 Apr 2013, 10:43pm

Re: New DIY dynamo light project

Post by edocaster »

An update on this light project, largely focusing on a sub-assembly where I got to try out making a PCB.

With the main concept of the light sound, I moved on to thinking about the standlight. Most commercial dynamo lights have used 'supercapacitors' to store the energy required for a standlight (although I'm sure this is changing, with some moving to lithium-ion), and I happen to have 2x1.5 Farad capacitors left over from a previous project. Like most of the commercial lights, these are coin-type supercaps and not the more powerful cylindrical ones (which often have capacitance in dozens of Farads). The benefit of these coin type supercaps is they allow up to 5.5V, whereas the bigger ones are usually limited to 2.7V. Too high a voltage and the supercaps die.

In previous lights it was possible to put one supercap parallel to 2 LEDs (even if the string had more LEDs in total), plus one or two diodes. This would charge the supercap to the forward voltage of the 2 LEDs minus the diode(s), helping keep it below 5.5V.

However, for the present light the single 12V LED made charging the supercap a lot harder. I could put the supercaps in series, but balancing them is apparently a challenge. Dropping volts with a transistor or lots of diodes is also possible, but very wasteful especially when charging the supercap from near empty (when current would be highest - power lost would be current * voltage).

Instead, the most efficient way is to use a switched mode regulator. Initially, I looked at car cigarette lighter USB chargers, which contain the necessary circuitry to convert 12V to 5V. These seemed pretty promising, given that the goal was not to pull high currents. In fact, what turned me away was a specific preference to actually limit current to a fairly low figure. Because, when charging any capacitor it will follow a curve which has maximum current when charging from empty. Not quite a dead short, in the case of these coin-type supercaps, but enough that it would rob the LED of much of the 500mA current 'budget'.

A bit of searching brought me to the L6902D chip, which has a current limit: https://www.st.com/en/power-management/l6902.html

And on the EasyEDA software, parts which exist with their PCB maker/parts supplier, JLCPCB, they can assemble on to a board for you. For a fee. Fortunately, this L6902D was in their inventory. So I put together a circuit closely following the regulator's datasheet, aiming for around a 5.4V output, and a maximum current of 0.2A:
L6902D charger diagram.png
(The additional diode, which perhaps I should have included inbound of the final capacitor, was in the hope of preventing the supercap from discharging backwards)

I then laid out the circuit. Layout for switching power supplies is apparently very critical, and sadly I may have made a few errors here (such as having the feedback circuitry too far), but hopefully this won't be too critical for a low power circuit.
L6902D charger.png
Fast forward a couple of weeks, and the boards arrived:
L6902D boards.jpg
Five boards is the minimum. A quick note regarding costs: boards alone cost little, SMT assembly (i.e. getting them to solder parts) adds quite a bit, plus each part's price. And then some parts are classified as 'extended parts' which they add extra surcharges for. I aimed to minimise such extended parts (the L6902D was the only one, I think), and used SMT assembly for the minimum number of boards, which was two (hence, only the two on the right). New customers seem to get some 'coupons', and the whole thing was rather confusing, but clocked in at under £13 including delivery.

Note I also left a few components off, preferring to add them myself. Namely a capacitor and inductor. Here is a board fully assembled:
L6902D populated.jpg
So far, I've only been able to test this at hand spun speeds, but it seems to output a solid ~5.4V. This will now make it a bit clearer how the rest of the circuit design may progress, and at least I know the board assembly process seems to be viable. Next step is to decide on the discharging part of the standlight.
Greystoke
Posts: 482
Joined: 8 May 2018, 7:41am
Location: Lincolnshire

Re: New DIY dynamo light project

Post by Greystoke »

Very interesting :D
User avatar
andrew_s
Posts: 5795
Joined: 7 Jan 2007, 9:29pm
Location: Gloucestershire

Re: New DIY dynamo light project

Post by andrew_s »

I had a go at a DIY dynamo light back in the day, when there was no off the shelf alternative.
The electronics and getting a good amount of light was easy (not that a halogen bulb was much competition), but what was difficult was a moderately sized and neat housing, and the optics.

Looking at the foregoing, I would suspect that the problem will be fitting your circuit board in the scavenged housing.
Last edited by andrew_s on 10 Sep 2023, 9:14pm, edited 1 time in total.
User avatar
plancashire
Posts: 571
Joined: 22 Apr 2007, 10:49am
Location: Düsseldorf, Germany

Re: New DIY dynamo light project

Post by plancashire »

I have just thrown away a burnt out B+M Toplight flat. It has a standlight supercap behind a 2-sided PCB with a few tiny surface-mount components and a LED in the centre. Apparently it has no over-voltage protection according to a German forum discussion. Maybe the bike it was on went too fast downhill? Junk. I hope your homebrew has protection.
I am NOT a cyclist. I enjoy riding a bike for utility, commuting, fitness and touring on tout terrain Rohloff, Brompton M3 and Wester Ross 354 plus a Burley Travoy trailer.
edocaster
Posts: 475
Joined: 10 Apr 2013, 10:43pm

Re: New DIY dynamo light project

Post by edocaster »

Actually, there probably won't be any particular protection. As this is just a personal project and will never be combined with a dynamo taillight - my understanding is that overvoltage protection (at least in the LED era) was only supposed to protect taillights (which are not designed to take the full dynamo current) if the headlight failed.

The LEDs should sink all available current and keep voltage under control. If the LEDs disconnect, then it's game over anyway. Pilom circuit 12 does actually show an optional crowbar, but I understand it can cause more problems than it solves.

Regarding housing, yes, the original housing won't be usable (it was glued together, and tiny). I might use this as a chance to learn a new skill, like 3D printing.

My last update forgot to mention the little bistable flip flop I bought, which you can see at the right of the circuit:

PXL_20230826_163729106s.jpg

It seems to work as expected, switching between voltage doubler and full-wave rectifier via a momentary switch, even switchable for a few moments after input has stopped while the smoothing capacitor is still charged - the indicator LED on the circuit shows which mode is active. And it retains a memory of the latch state. So, all in all, it looks like the goal of using this in place of a mechanical switch is viable.
edocaster
Posts: 475
Joined: 10 Apr 2013, 10:43pm

Re: New DIY dynamo light project

Post by edocaster »

Keeping this alive, this is still slowly progressing. Lots of fun theory in this one.

After completing the supercapacitor charging sub-assembly I had to think about how to discharge the standlight. In my previous lights I simply used a resistor. This works fairly well for a typical power LED. But efficiency is low when the supercapacitor is full, as around half the power is dropped across the resistor. Secondly, the discharge curve is steep (exponential decay) - so not entirely ideal. Thirdly, a decent portion of the supercapacitor is never used, as the voltage will never drop below the minimum forward voltage of the LED (around 2.6V).

In any case, this wasn't an option as I'm using a 12V LED, unless I add an extra 3V LED (more on that later).

So that got me looking at LED driver circuits that can boost around 5V to around 12V. Plus, it would be an interesting challenge. One which came up quite a bit is quite old - the Zetex ZXSC310: https://www.digikey.co.uk/reference-des ... -dc-in/229

It's interesting as it claims to work down to a 0.8V supply voltage. It's also fairly well documented in forums, but isn't in JLCPCB's parts inventory, so if I used it I would have to get it and solder it myself.

So I bought some. They are absolutely tiny - SOT23-5 packages are basically less than 3mm long. To test these on a solderless breadboard I had to mount them on adaptor boards. You can see them below, and another board for the transistor (an equally small SOT23 package).

Standlight breadboard.jpg

Unsurprisingly, a breadboard will not make the circuit perform accurately, as high-speed switching parts with small voltage tolerances don't sit well with jumper leads. The circuit is drawn from the ZXSC310 datasheet:

ZXSC310 circuit.png

What's of interest to a novice like me in these topologies is it needs a current sense resistor for R1. Basically, the chip detects when the voltage across R1 exceeds 19mV. It then switches off the transistor for a set period (about 1.7 microseconds). During that time the inductor dumps its current towards the LED. At least, that's the way I understand it. A larger R1 means the 19mV threshold is reached faster, at lower current, and the transistor will spend more of its time off (i.e. lower duty cycle).

I used a 0.25 ohms resistor, which the datasheet indicates could give about 20mA to 4 LEDs (which is equivalent to one 12V LED). In practice, the output only got to around 4mA. This is almost certainly due to the higher resistance of the breadboard and jumper wires. It's pointless to get this right on the breadboard and the only way to optimise this would be in the final circuit, by having space for two or three current sense resistors in parallel, and experimenting with multiple low value resistors.

The breadboard does validate that the boost driver works, and the charging circuit shown in an earlier post also worked to charge up the supercapacitors. One thing which didn't work however - which shows the value in building this up in prototype first - is having the supercapacitor charging circuit and the ZXSC310 output across the same LED rail. In short, the standlight doesn't light when the charging circuit is connected. This was somewhat predictable - the standlight discharge is going straight back to the charging circuit, which takes the current before the LED can be lit. Disconnecting the charging circuit allows the standlight to work.

Ways to work around this are probably: a) Put a diode above (in series) the LED, and feed the standlight discharge at this junction, so it can't go back up the circuit to the charging circuit. But this wastes a diode drop. b) Put a 3V LED above the main LED. This raises the voltage by almost another 3V, but at least produces more light. c) Use an entirely separate LED/LED string for the standlight output. This has a certain attraction, but may be getting messy, space-wise. Or maybe some other solution I haven't thought of yet.
axel_knutt
Posts: 2929
Joined: 11 Jan 2007, 12:20pm

Re: New DIY dynamo light project

Post by axel_knutt »

edocaster wrote: 19 Sep 2023, 12:55am Unsurprisingly, a breadboard will not make the circuit perform accurately, as high-speed switching parts with small voltage tolerances don't sit well with jumper leads.
You're right that breadboard (and Veroboard for that matter) are pretty useless for high frequency circuits, which is why RF engineers build prototypes 'birds nest' fashion on a piece of copperclad. I've only used a breadboard once, as a student, and found it a bit hopeless at any frequency - the leads kept falling out and shorting out, and the contacts were intermittent. Your circuit's only a few hundred kHz, not VHF/UHF, but the edges have harmonics into the MHz range, and you're dependent on sharp edges to maintain efficiency.
edocaster wrote: 19 Sep 2023, 12:55am What's of interest to a novice like me in these topologies is it needs a current sense resistor for R1.

I used a 0.25 ohms resistor, which the datasheet indicates could give about 20mA to 4 LEDs (which is equivalent to one 12V LED). In practice, the output only got to around 4mA. This is almost certainly due to the higher resistance of the breadboard and jumper wires. It's pointless to get this right on the breadboard and the only way to optimise this would be in the final circuit, by having space for two or three current sense resistors in parallel, and experimenting with multiple low value resistors.
This isn't particularly a frequency problem, you have the same issue at DC. Your problem is the resistance of connections that are common to both the circuit loop that you're sampling the current in, and the sensing circuit that's measuring the sample. The solution is to remove the common resistance:
Common Res.png
At the top, the connections in red are common connections, and the resistance of them is adding to the resistance that you're using to sample the current so that the voltage you measure is the sum of that across the resistor and the connections. Below, these common leads have been removed, with each circuit having its own separate connection, so the voltage you measure is that across the resistor alone, and not the voltage dropped in the leads carrying the current.

The problem is exacerbated even more if the common connections include the resistance of breadboard contacts, and/or inductance.
“I'm not upset that you lied to me, I'm upset that from now on I can't believe you.”
― Friedrich Nietzsche
edocaster
Posts: 475
Joined: 10 Apr 2013, 10:43pm

Re: New DIY dynamo light project

Post by edocaster »

Thanks - yes, that makes a lot of sense. The most direct connection of the sense resistor would probably be straight across the ZXSC310's sense and ground pins, above or below the chip, with pieces of solid wire to span the gap. I'll leave it for now as I can't hack soldering it again, while I see if I can scavenge other sense resistors in a similar range.
edocaster
Posts: 475
Joined: 10 Apr 2013, 10:43pm

Re: New DIY dynamo light project

Post by edocaster »

As a slight detour, I set about a far simpler circuit to reuse a defunct Axa Pico 30 I had, which failed in some, not entirely clear way. This is just a side project, but gets me a 'new' light as the days shorten, plus some practice and testing of concepts. After tearing that light down and gaining insight from this forum years back, I could see the circuit was simple, but fairly wasteful. It used one LED and a 3 ohm resistor in series (plus rectifier, etc).

So I redesigned it to use two LEDs in series (technically three, but two are in parallel with each other). It should still reach around the same voltage (although I won't be using this with dynamo tail lights, just in case - there's no overvoltage zener now).

Anyway, the boards arrived:

Pico 30 boards.jpg

The old Pico 30 is the black board on the left. Unfortunately, I could only get the board in green in the thickness I wanted (0.8mm) without extra charges. Why 0.8mm? The original board was 1.6mm thick, and had the (possibly fatal) flaw of mounting the LED with no real heatsinking opportunities. Power LEDs are often mounted on metal core PCBs separated from the main PCB, but the Pico 30 was just one standard FR-4 (fibreglass) board. Making the entire board an MCPCB isn't compatible with through-hole components like the standlight capacitor and switch.

But while FR-4 isn't good for heat, I found a Cree document (https://downloads.cree-led.com/files/da ... hermal.pdf) giving some design guidelines. In short, if you have a 2-layer PCB you can connect both layers with vias (small conductive holes from one layer to the next) spreading heat to a large copper back layer. And the thinner the PCB, the better the conduction. The original Pico 30 did none of this, being a 1-layer board. Additionally, I could make up the 1.6mm space by a second PCB, doubling the copper layers (hence the exposed copper layer at the back, which can be in contact with the second PCB's central LED pad via some thermal paste). It seemed a useful way to make use of the minimum order size anyway (five boards), and none of the second board's connections would cause a problem.

Other than that idea, the purpose was also to test the accuracy of dimensions, particularly things like the central LED placement having to match the original hardware, and one apparent big no-no - having two LEDs in parallel with no current-limiting resistor. This is heavily frowned upon as it can cause one LED to hog current, although none will burn out in this case.

The parts moved over fine:

Pico 30 with LEDs.jpg

(I added a smoothing capacitor as a preference - there's just enough room to tuck it in at the back.)

This was also a chance to test soldering LEDs, which has to be done by 'reflow' rather than a traditional soldering iron. Just about managed that OK.

Pico 30 assembled.jpg

So far, there were a couple of rattles which I had to file some plastic to resolve (thickness is slightly over 1.6mm, unsurprisingly). The Pico 30 does have a really bad mechanical enclosure, being held by one screw - no tabs, clips, etc. In any case, it seems to work, although sustained testing will be needed to see if heat or mechanical issues arise. The beam is OK - the Pico 30 never really had a cutoff, but rather just the hotspot further up, and this seems the same, possible a touch softer as the emitter is larger. As for the extra LEDs, they only really serve the purpose of some extra visibility, especially from the sides (and less wasteful than the original circuit). So far, the parallel LEDs seem to both light up evenly but, again, further testing is necessary.
Post Reply