Switching power supply with battery and dynamo
Dynamos generate a DC voltage between their terminals with polarity depending on direction of rotation. Most bicycle 'dynamos' are, in fact, alternators giving out AC. Normally we would use diodes or bridge rectifiers to convert this to DC as required by your LEDs. Unfortunately the voltage drop across the diodes will subtract from your precious 3 V and leave you with little to power the LEDs.

One option might be to put a second LED in reverse parallel. This will work when the alternator output is reverse polarity and the LED on the left will work on battery and when the alternator top terminal is positive.







simulate this circuit &ndash; Schematic created using CircuitLab

I've put separate resistors on each supply so that you can optimise the brightness individually using Daniel's formula.

One thing to be aware of is that dynamo / alternator voltage will be speed dependent. Many alternators are designed so that the impedance of the internal inductance of the windings limits the current to a safe value to prevent blowing an incandescent light bulb. i.e., As you accelerate the bicycle the lamp turns on at fairly low speed. It does get a bit brighter as you speed up but the voltage and current don't increase linearly with speed. An internet search should give plenty of further reading on this. The LED loading may not be enough to benefit from this technique.

Note Daniel's other point that 3V is not enough to drive 3 LEDs. If you want more than one LED (pair) you will have to connect them in parallel.