Tuesday 29 September 2020

Electronics design project - Bicycle Dynamo maximum power and battery charging manager

Changed; 28-11-2023, 29-11-2023

This electronics design exercise develops circuits that optimise the power taken from the dynamo above the quoted power to run bicycle lighting and battery charging.  Including USB charger output or charging input, data outputs, controls, and settings.  These additional features require the development of phone, tablet, and desktop computer applications.  This project will show how much more of the available power output from the Dynohub can be obtained. 

There is also a no-microcontroller solution.  The design includes controls and potentiometers for calibration made available, that would have been carried out in software otherwise.  This is a good solution with just a speedometer, power out, and a few controls. 

This blog goes into much greater depth than would occur in a real design project, in a real design project many avenues would not be explored and developed in such detail.  This blog has been written going back and developing earlier ideas put aside until a solution is clearer.  Eventually, the whole picture can be seen but in better detail is a realistic way to carry out design work. 

The LEDs could be fitted within the unit and run white light-optimised fibre-optic cables to the lamp units.  The light from the fibre optic would be dangerously bright.  The output of light instead of pulsed current reduces the risk of electromagnetic interference. 



1970's Eveready front light, Pifco rear light, unknown age Eveready rear light.  The Eveready lamps are fitted with 2.7V 420mA bulbs that could be modified by wired in series and run from the dynamo.  The Pifco lamp's bulb is 2.5V 300mA so this lamp could not be used with the dynamo without expecting bulbs to fail occasionally.  Eveready lamps are clean and corrosion-free inside so wires could be soldered to the brass contacts.  The switches are wired to short the lamp out in case a bulb fails so that the other lamp will operate. 

 

Evaluate alternatives - an early design step is to evaluate what is already available, and whether you can buy it but with additional features.  This alternative is very new and appears to have good power take optimisation but other alternatives are available.  

This bottle dynamo and unit does some of what this project aims to do; https://pedalcell.com/ there are graphs on the website.  PedalCell allowed me to see the power output spreadsheet, thank you, for the dynamo outputs 3W from 6 MPH (road speed) and the power does not show a greater rate increase initially as more of the sine-wave output is used but one data point may be wrong?  In any case, it looks as if a higher output voltage four-phase (6-wire) stepper motor is used as a generator.  The output voltage therefore power increases linearly with speed as a textbook permanent magnet generator theory.  The traditional drawback with a bottle dynamo is their high friction losses due to high gearing but some of this criticism may have been mitigated in some cases by using a larger diameter pickup wheel.  The pickup wheel has a replaceable o-ring contact to the wheel rim instead of the smaller ribbed metal pickup wheel in contact with the sidewall of the tire to pick up the power of a traditional bike so-called bottle dynamo. 
 
Review of some bottle generators; http://www.myra-simon.com/bike/dynotest.html


LED lighting sets such as Bikemate branded (pictured right) front and rear lighting will function when powered from a USB charger.  
  • Aldi product ref. 086287232202700 (discontinued)
  • Rear 3.7V 300mAH and Front 1050mAH lithium cell,
  • Specified to run for 3-5 hours (<100mA and <350mA),
  • Found to run perhaps 20 hours flashing low intensity (15mA and 50mA), 
  • Charge 3-4 Hrs and 4-5 Hrs (<100mA and <350mA). 
That is <2.5W lights, lights and charging <4.5W.  Lights set low-intensity flashing mode; 50% of 800mW.  No figure for losses is included and I have not examined what is inside each unit but 20% to 50% is likely. 

The AC component from the Dynohub regulated to 5V, may not affect the battery charging function.  But if there is an AC component in the supply with the light on will cause lots of small battery discharge and charge cycles shortening the battery's life.  Waterproofing, when mated around the USB connector, is required.  A disadvantage of this plan is that the lights will not dim in a useful way when the power is low but will turn off and remain turned off until the cyclist switches the light on again. 

This bicycle light set has a good light level and provided the power required figures for this project but is not well suited for use with a bicycle generator. 

Estimated capability
LED lighting similar to Bikemate units above but suitable for operating from a bicycle Dynohub (permanent magnet generator).  With no battery and no power switch preferably. 

Expected of this project, is that a slow cyclist could run lights on a low-intensity setting.  A regular cyclist could run and charge lights on a high-intensity setting and a fast cyclist could also run a USB device with a vintage 6V, 8V, or 12V Dynohub, more light and power to spare with a modern bicycle generator. 

By comparison, the simple regulator (AL-0035-01?) near the bottom of this page would run lighting similar to Bikemate lighting in a low-intensity mode with a vintage dynamo (GH6, GH8 or GH12).  More light with modern dynamo. 
 
The video below tends to cloud the issue as well as make options clearer;
The source blog is clearer but is not English language. 

I was surprised to hear that many modern hub generators generally consume power when there is no load, I have spoken to someone who has one on his bike and thought the loading also increases with speed which it should not.  I guess that the iron is not laminated to the same degree as a mains transformer or a motor.  The eddy current losses and the magnetising losses are less than 1%, typically, I have been advised these hub generators as well as a vintage Dynohub are all good.  This video SON hub generator is the exception of the ones tested and is very good, but the graphs are complex and indicate that the system being measured is more than the generator. 

Guessing what the added complexity is from a note on some graphs - It looks as if the extra circuit component may be a tuning capacitor, this increases the output voltage to 6V at resonance but then causes the voltage to not increase further with generator speed.  The power factor then becomes poorer and the main loss is copper losses regardless of power used.  At resonance and maximum power is taken with a simple rectifier, the efficiency will be good.  My design should improve because only the required power is taken and the power factor is better. Guessing again the extra component in the generator might be a shunt regulator (2 x  22V Zenner diodes anti-series) to prevent high output voltage (24V say) by returning power to the wheel and wasting power but the graphs do not look like that.  Where my design should improve is by using a Triac or transistor crowbar regulator that returns more power to the wheel wasting less power.  Guessing that the SON hub generator might use a feature like this but disconnect the output to prevent over-voltage output instead and thereby minimise interaction with what is connected to the generator? 

Stepper Motors are typical of many motors that generally have good magnetics designed for low loss and because of the higher frequency, the copper losses are lower.   A stepper motor used as a generator in modern rim generators turns out to work well. 

The battery chargers and power managers may first charge a battery system that can cope with variable input power and then output is a constant power over a minimum period of time to a USB charger.  This is no doubt done in order to avoid shortening the life of the connected device's lithium cell. 

Links  connected with this video;
 

I think Sturmey-archer used to claim their dynohub added no noticeable extra resistance to the cyclist?  Vintage Raleigh/Sturmey-Archer product was always very understated but a friend told me you could feel the difference.  The total extra loss is very small at 1.8W for the lights plus 0.45W due to copper losses and a little more for magnetising and eddy-current losses?

Sturmey-Archer's logo dynOhub for their bicycle hub dynamo does not appear to be a registered trademark but would be copyrighted.  Bicycle dynamos do not have a commutator and brushes so it does not output direct current, to be correct is not a dynamo.  More correctly called a single-phase permanent magnet synchronous generator or a magneto.  The symbol is a sine-wave generator signal source. 



Plan for a bicycle dynamo lights and battery manager

Microcontroller-based bicycle dynamo light and battery manager with a speedometer.  Design idea and exercise with STM32 microcontroller.   With interface by USB cable to a tablet or any computer.


The dynohub (such as a Sturmey-Archer GH6, made 1944-1983) is rated at 6V 1.8W and will output up to 20V when the bike is ridden fast I understand.  If we assume the dynamo will deliver 300mA then the output power is up to 6W.  To get the maximum power from the dynamo, the current taken needs to be limited so that voltage does not drop severely. 


I also understand that modern bicycle hub generators work from 2 MPH, produce up to 30V out and are rated 3W at 6V (0.5A).  That is up to 15W.  The firmware should include calibration of its measurements as well as optimising the generator's maximum power transfer and storing these calibration constants. 

  • Manage two-cell NiMH battery charging using a coulomb counting method.  Other circuit variants for Lithium-Fe-PO cells were also developed. 
    • It is best not to remove the batteries so that the battery state of charge and capacity information is retained.  Therefore use the USB port charging input preferably to take the battery out for charging. 
    • A lithium cell's state of charge can be determined by the voltage and charging current between low, medium, and high.  NiMH batteries can only be determined by the voltage and charging current between low, medium or overcharged. 
    • Recalibration of the battery's state of charge and capacity if the battery is removed.  The coulomb counting system with voltage sensing of a high state charge and discharge limits.  An assumption is made that a replaced battery is charged and its capacity is low allowing the unit to charge a replaced discharged NiMH battery a little, quickly and the remainder of the capacity reached slowly 0.03C (50 hours).  Alternatively, a replaced lithium cell can be fully charged at a fast rate. 
The 1960's Mini Couper has lots of lights.  Running the battery down should not be an issue unless you have lots of lights on your bike more than the dynamo can supply.  The Mini holds the road exceptionally well in some ways like a sports bike with a good high tensile steel frame.  It could be that flexibility in the frame and independent wheel car suspension came from bicycle frame technology in the 1930s?  However, the idea was applied to electronics and the stiffness of using the metal frame 0V in valve design gave way to a flexible star point strategy in transistor electronics design in about 1960.  By 2000 stiff 0V the strategy was reverting to stiff solid 0V plane in PCB design but with flexibility. 
    • It is important that the Lithium cell holder or a connector should not allow the cell to be fitted with reverse polarity. 
    • NiMH cells fully charged is usually determined by fast charging with a high current and detecting a small voltage increase (or temperature rise), which occurs when the cell is overcharged slightly.  The dynamo power is too variable to use this method but the coulomb counting method instead also monitors for overcharging.  This method can be used to characterise a replaced battery if a USB power source is connected. 
    • Lithium battery is more efficient only requiring charging 110% more power put back rather than 150% that a NiMH requires. 
    • Rapid charging LiFePO4 is not possible but they charge at 0.3C, 0.5C or 1C (1-3 Hrs) depending on the type chosen.  By comparison, NiMh cells can be charged at up to 0.4C (2.4Hrs) [Some Varta button cells 2C or higher}  or NiCD 2C to 4C (15 or 30 minutes) depending on the type chosen. 
    • Lithium-ion Phosphate (LiFePo4) - is a slightly lower capacity Li-ion, with fewer raw materials used. 1.2Ah or higher.  Fewer safety precautions are required. 

    • None of the circuits supports Lithium-ion (Li-ion) - these require additional safety circuits within the battery that disconnects the battery if the supply voltage is too high or the cell voltage drops too low. 
    • A 5V supercapacitor is also a good choice the charging is simply constant voltage at as high a current as the power supply can deliver.  10F would deliver 100mA and drop 3V for 300 seconds (5 minutes) with progressively diminishing light output.
  • The USB port can also provide dynamo power output. 
  • On PCB bootloader switch for fast programming via USB port plus software debug connector. 
  • Software functions; 
    • Switches to set Dynamo output power or USB battery changing power input.
    • Switch to turn the lights off/on/flashing. 
    • Battery charge status LED. 
    • USB connected status LED.

The tilt sensor is used to reduce or increase the power taken from the dynamo using parameters set by the cyclist, such as when going up or downhill plus speed. 


LED lighting is much brighter than incandescent lights, such as pictured.  These lights do work in the dark if placed low down to light the curb, but the lighting law changed and this is not done now I guess because the light could be mistaken for a tail light?  In any case, a light should be placed higher so the cyclist can be seen.  Red rear lamps are difficult to attach to the rear rack if you have pannier bags fitted. 


Software note;
LED dimming or intensity programming is to be handled using a pulse width modulator (PWM) running at 100Hz to 300Hz. 


The first proposal for the dynamo power input

Could be based on an industrial motor control system similar to that found in factories but also used to manage power from a wind turbine.  In this case without a power dump of excess power from slowing machine motors generating power.  These circuits will only start operating when the dynamo's output voltage is 10V (about 6.5Vrms) with no current drawn, which is a little under the rated speed.  The input boost section from the dynamo should be very efficient and ensure that the unit will continue to run at a lower bike speed once started up.  These solutions are software-driven; 

AL-0036-01F Power diagram based on motor control to operate at low-frequency boost switch mode using the inductance of the motor.  Most function blocks and parts are not shown and part values are not correct.  Expect the dynamo to whistle when running in the same way that the inverters and motors in some modern electric trains whistle.  CAD used: OrCAD cadence. 


A dynamo power management based on an industrial motor control system but scaled down looks promising but a solution based on standard IC-type power supplies will probably be cheaper. 


It turns out that the dynamo's inductance is too high for this configuration to output any significant power when the voltage is boosted.  That is because the period of the chopping oscillator needs to be about a second to reach full current but the period of the AC output is much shorter 10mS at a reasonable speed consequently the power output would be very low.  Alternatively boost to a few thousand volts at a very low current in a millisecond would be impractical, and the losses would be too high. 


The Generator model is not simple - The series inductance is so high but the open-circuit voltage is not so high, that very little power should transfer.   A modern motor drive and permanent magnet motor/generator are usually wound for lower voltage, high current, and consequently lower inductance.  The motor drive supply or output voltage is high, and the current regulating chopping frequency is lower, for lower losses and higher current.  The high inductance of the bike dynamo does not suit working with a chopping current motor drive. 


A GH6 dynamo has 5 ohms series resistance consequently at 6V, 300mA output that is 7.5V = 6V + (5R * 300mA) with no load.  The peak voltage is no-load is 10.5V = 1.4 * 7.5V, at a rated 6V minimum cycling speed ??.   For maximum power transfer, the maximum current drawn is <=300mA, and the load is presented by>5R. 


Electromagnetic emissions and sensitivity;

Note the additional 0V screen cable bonded to the bike on both ends, the controller, and the dynamo to minimise electrical emissions.  This measure is fairly essential, with the above strategy. 

  • There is a risk of electrical interference generation with home-fitted and wired units.  Precautions such as using a paired wire should be mandated. 
  • But with the circuit proposals below a screened pair bond to 0V and the dynamo case both ends need not be required but recommended if a vintage AM radio be used nearby consequently better than CE mark is required.
The two and three-phase boost regulators below the EMC profile are different but they are likely to have the best EMC performance of the power factor optimised options.

The above diagram is a 2-phase boost converter with a polarity switch (electronic commutation) AL-0036-02E driven by two PWMs 180' out of phase.  This is a lower input/output noise and ripple current voltage step up.  PWM mode is less efficient under light load conditions.  Another pulse-width-modulator (PWM) is used to step the high voltage down to 2-5V (Vdd).   At start-up, all drivers are switched off and the substrate diodes act as input rectifiers providing start-up power.  The component values are not correct or complete

Motor driver ICs are comparatively more expensive, have lower frequency operating and therefore require larger inductors.  The benefit is the main source of electromagnetic emissions is reduced to <50% for this 2-phase design compared to the other strategies below at the same operating frequency.  For a 3-phase boost, the RF emissions drop to <33%.  There are other sources of radio-frequency emissions, such as the switching transitions of the power supplies that need to be addressed.


There are advantages to using a buck regulator IC rather than the software above, they are self-starting, self-protection, efficient, good regulation, and good value for money.  The diagram below does not have to be a three-phase boost one inductor need not be fitted if cost-saving and lower switching losses of running one less phase are more optimal.  

The diagram AL-0036-03D is a 3-phase multiphase boost pre-regulator.  Multiphase regulators have lower radio frequency emissions.  Changing the driver IC to DRV8955 will operate down to a lower voltage of 4.5V which works out that it will start up <50% of dynamo-rated voltage/speed.  Both drivers are rated at 100KHz maximum so the inductors would need to be large.


The bridge driver proposed would be operating at maximum speed so are likely to have high losses.  By comparison, the buck converter IC is optimised for high-frequency operation so is a more efficient function block compared to the previous diagram.  It should not be necessary to use a screened cable bonded on both ends a paired cable should be adequate to minimise radio frequency emissions. 

 

These multiphase converters should be more efficient than the motor driver ICs they use external transistors - but may be unnecessary cost and complication;

LTC3871-1 may do 5-30V and possibly 1.2-100V (4.5V) two or more phases boost.  

LM5170 8.5V to 100V two-phase boost. 

ISL78227/9 5V to 55V two-phase boost.

ADI, Renesas, STM and On-Semi make several multiphase buck controllers (NCP4200, NCP81143,  PM6773, ISL6312) inverting the outputs and many other changes still do not look promising. 



Comparison of motor drive or gate drive ICs;

  • L6201 ST 1-4A Motor drive bridge driver - 12V minimum, Operates up to 100KHz. This driver can only hold an output high briefly so it may not be suitable.
  • L6205, L6206, L6207  ST 8-52V (8-52V) 100KHz 2.8A dual bridge motor driver with various protection and current control options. These operate down to DC due to the Vboost charge pump.
  • L6225, L6226, L6227  ST 8-52V (7-52V) 100KHz 1.4A dual bridge motor driver with various protection and current control options. These operate down to DC due to the Vboost charge pump.
  • TLE9201SG Infineon 6A half-bridge motor driver - only operates to 20KHz, 8 - 28V.
  • L99MOD51XP, L99MOD54XP ST motor drive 3x half-bridge drivers 6A, 7-28V. 
  • BTN8962TA Infineon Half-Bridge motor driver - 30A, 8-18V or 5.5V-40V de-rated current.  The maximum frequency is unknown and is oversized.
  • DRV8844 TI, 8-60V, 2.5A dual half-bridge motor driver.  The maximum frequency is not specified but is probably 100KHz?
  • DRV8955 TI, 4.5-48V, 2.5A, dual half-bridge, <100KHz. --- This is a reasonable solution because of the lower starting-up voltage possible but the over-voltage protection would operate often with a newer type of dynamo.
  • DRV8412 TI, 11-50V, 6A, dual half-bridge, <500KHz. But for the high start-up voltage, this driver has a good operating frequency.
  • DGD05463 Diodes Ltd. ISL6208, ISL6208B Renesas - Gate driver and discrete transistors. No significant frequency limit (500KHz) but requires more parts and is an expensive option. 

For Vbatt (1.8V - 3.5V) to 5V bidirectional - TC78H653FTG Toshiba dual half-bridge up to 2A, 1.8V - 7.5V, 500KHz.  Provides the option for a better power path with the shortest paths to and from the battery.  Unfortunately, the IC can not be configured as simple half or full bridge drivers but only as a motor driver or use just two of the four drivers. 


 

Improved dynamo input power supply;

Putting aside a motor drive IC solution, but boost pre-regulator is drafted further below in AL-0002-02 to -05.  These solutions do not use a PWM mode synchronous rectifier but use a simpler boost and rectifier in software.  Beneficially these circuits start at a lower bike speed and take all the available power from the dynamo. 


Another variation is investigated - this circuit is efficient but does not take the maximum power available from the dynamo but does take more of the available power than would be taken wired to traditional bicycle incandescent lights.   An efficient input bridge-rectifier is considered, and using transistor switches plus many discrete parts and ICs is possible.  A boost stage is not included and the risk of producing electrical interference, with care, is low. 

Simplified power diagram AL-0038-01E.  This design features no large step-up and smaller step-down voltages.  The microcontroller is powered directly by two rechargeable NiMH cells.  The rectified dynamo output ripple voltage will cause the LEDs to flicker slightly which may be perceivable at low speed.  CAD used CADSTAR.


This solution is similar to AL-0002-01? below, in that design Vgen capacitor is much smaller and the current taken is varied with the alternating current input so that more of the available dynamo power is taken.  That is because the power factor is better.

The first buck regulator could be replaced by a buck-boost regulator to improve the operating voltage range.  The power is taken from the dynamo also needs to be optimised under software.  A transformer-based flyback convert is investigated in AL-0038-02? further below. 
 

Buck-boost configuration; https://www.ijedr.org/papers/IJEDRCP1401022.pdf


One magnetic part is saved but costs many other parts.  The buck-boost configuration is an efficient solution that seems possible but difficult to implement using microcontroller timers, software and half-bridge drivers but likely to be more costly and turn out not to be so efficient.  Here are some buck-boost controller IC's; 

 

LT1810, ADI               4.5V to 100V (2.8V)
MAX20048, Maxim    4.5V to 36V (2V)
LM5176-Q1, TI          4.2V to 55V (2.5V) 
LTC3779, ADI            4.5V to 150V (1.2V)
ISL81601, Renasas    4.5V to 60V (0.8V)
ISL81801, Renasas    4.5V to 80V (0.8V)
 

Software for power input;
The dynamo current control software is likely to be difficult with a switch-mode power supply IC.  
  •  The power used must be adjusted continually with the AC input so that;
    • When the power is reduced the USB power output should be turned off,
    • The battery charging rate is reduced and turned off without current being drawn from the battery,
    • The LED drive is reduced and turned off when there is adequate average dynamo power,
    • Enough power must be provided for the microcontroller at all times.
Versions that use a PWM boost supply should be a lot more straightforward because changes can be made more slowly.  The control of the boost voltage should be straightforward.  Measure boost rail voltage if;
  • Hardware over-voltage protection occurs at >55V, and may cause electrical noise?  Will return surplus power to the dynamo. 
  • Software over-voltage >50V then turns on both boost transistors, to return surplus power to the dynamo.  This software may not be required but the power factor should be overridden to prevent over-voltage from occurring.
  • An efficient low side of a bridge rectifier is implemented by turning on the low side transistor alternately synchronously with the dynamo AC input.  This reduces voltage drop in the bridge rectifier low-side diode.   The other PWM drives the other transistor boost regulator.
  • The boost voltage be set so that at minimum the troughs are above 10V, say? 
  • PWM for boost voltage creation is set proportionally with voltage.  This carried on steps to minimise the processor's workload.
  • If the current taken from the dynamo is above the optimum, its voltage will fall sharply, then reduce the current taken by setting the buck regulator power clamp DAC lower. 
    • Intelligent nudge up and down control - That is do not nudge the set-point if no more power is available but do nudge down to find out if more power can be taken.  That is take care to prevent set-point runaway.  Use indicators such as Pgood output.
    • If necessary, ask a support question to find out the voltage sensitivity and voltage range of the compensation pin.  Note that the simple transistor clamp circuit has a temperature coefficient.
  • The power priority is the same as the non-boost above but the adjustment and switching off do not need to be done quickly because power is stored in the boost rail reservoir capacitor that tides over the AC voltage ripple.
  • The dynamo current is:  = I_out * V_boost / V_dynamo
 

Implementing a low-loss rectifier;

The high side rectifier is implemented using Schottky diodes or more efficiently using ICs such as; TEA1993TS, TEA1999TS, UCC24612 or SRK1001.  But with the boost, pre-regulator options further below the voltages are higher and the benefit is small and not worth implementing.

Dual synchronous rectifier ICs; TEA2095T, TEA2095TE.

Low side and bridge rectifier controller ICs; TEA2206T, TEA2208T, TEA2209T.  These parts are new and fairly expensive but would save one boost inductor or transformer, but a discrete solution using transistors for a high side gate drive and a small reservoir/filter capacitor should be the best option.  The high-frequency parts are better priced and suitable.

The low voltage drop rectifier on the low side could be implemented using a cross-coupled, bistable-multi-vibrator. This feature would save 200mW compared to using a Schottky diode bridge rectifier.  Alternatively, this is implemented in software. 

Diagram right SiMetrix model; AL-0034-01B - dynamo battery lights manager Synchronous rectifier controller - outputs inverted to drive MOSFET gates (small Red and Green waveforms).  Unlike a diode rectifier, this circuit ensures that one of the two transistors is nearly always on. 


The SEPIC converter option used in the no microcontroller solution below (AL-0038-02?) is not efficient but as good as can be done.  This synchronous rectifier is for consideration before placing it in that circuit.  Generally, there is no license issue using an IC from one manufacturer then switching to another manufacturer or using a discrete transistor solution.  But a company I worked for received a number of patent challengers, all claiming something was copied which we had not done but had come at the problem from an entirely different and better way.  The patent challenge probably is a pretext to find out what you do instead.  Components; amplifiers, and motor makers all give you a license to use them for anything you can use them for.  They do not want to stop you from using a motor as a generator for example but they will compete on price or suitability. 
 
Diagram; AL-0034-02B - CADSTAR 18, synchronous rectifier using SRK1001.  Power consumption is high because of a linear regulator from the high voltage supply to power the IC.  


Table of Voltage and current input from the dynohub plus estimated bike speed 10-30MPH, 5V output.

Vin        Iout     Power     Vgen (MPH) Diode W Synchronous rectifier IC W Transistor W SR+Tr W

1.5V      300mA  0.45W 3.0V  (4.5)     0.03W=0.4V*0.08A    0.11W=17mA*(5+1.5V)   0.006W=0.08A*0.07R     0.12W

5V        300mA  1.5W       6.5V  (10)     0.12W=0.4V*0.3A    0.17W=17mA*(5+5V)       0.02W=0.3A*0.07R 0.19W

10V      600mA 3.0W       11.5V (18)     0.24W=0.4V*0.6A    0.26W=17mA*(5+10V)    0.04W=0.6A*0.07R 0.3W

15V      900mA 4.5W       16.5V (25)     0.36W=0.4V*0.9A    0.34W=17mA*(5+15V)    0.06W=0.9A*0.07R 0.4W


5V        0.5A    2.5W  modern hub generator    0.2W=0.4V*0.5A    0.17W=17mA*(5+5V)       0.035W=0.5*0.07R 0.21W


Where the switching loss in the transistor gate drive is;  7.5mW = 5nC * 300KHz * 5V 

Where the transistor switching time constant is;  10nS = 5nC *  10R / 5V about 0.3%

These are approximately some of the switching losses they are small but should be added to the table above.


Power and dynohub speed based on a Sturmey-Archer tester, assuming; 26" wheel, GH6, first 1.5V@300mA required to overcome the dynohub (5R) resistance loss.  The synchronous rectifier transistor and gate drive switching losses have not been included, see AL-0042-01? further below.  I have approximated the duty cycle cancels out I^2 losses or constant diode voltage drop. 

 

No significant benefit is observed in using the IC.  If the comparison is done with the boost converter, the diode is more efficient because the current-carrying part of the duty cycle is shorter, and the IC is also more efficient because the ICs Vcc would be derived from 5V and the comparison with 5V input is relevant. 


      

Figures 11 and 3, TEA1993TS, (TEA1998TSTEA1999TS) datasheet NXPcut down to show just the relevant detail.

TEA199?TS can operate high side, for a SEPIC converter, with xv connected to 0V (otherwise IC power input) it is not clear from the datasheet what the minimum Vdrain needs to be but it may be 4.7V at much lower power than SRK1001 (further above).  Consequently, the IC will only operate when at a higher voltage part of the input sinewave, unless a regulator is added to supply the xv input.  The disadvantage with this IC is that there would be a high reverse current caused by the 40nS delay before switch-off, it is likely that this is not as severe as it would appear?  When fitted to the low side the component count is reduced but the converter would operate in flyback rather than SEPIC which recovers power from the leakage inductance.  

AL-0034-03B to go with my questions.  The Schottky diode and the gate series resistor may not be required?

A reply to my NXP support request suggests that TEA1998 would be best but this part is only rated to 60V drain but is a lower Vxv part (10V).   Although the transistors are rated at 60V they incorporate a little higher voltage avalanche diode to protect the transistor and is too high for this IC.  Some efficiency curves are also provided, for a 25W flyback converter showing this part has fewer losses at light load. The differences between ic types and operating mode are small but the advantage over a Schottky diode is significant;  https://community.nxp.com/t5/Power-Management/TEA1993-or-TEA1999-Vdrain-min-V-with-Vxv-0V/  


The losses; 
  • TEA1993 plus the transistor from the table above are small from; 1.7mA * V, <8.5mW +Tr.  
  • TEA1999 plus the transistor from the table above are small from; 1.4mA * V, <7mW +Tr.
  • TEA1998 plus the transistor from the table above are small from; 1.3mA * V, <6.5mW +Tr.
 These losses multiply by Tr_Vdrain(SR) / 5. 


Vintage Raleigh Industries Sturmey-Archer DynoHub tester - Very Rare! | eBay

Design output files

 

Maximum power transfer;

Software and electronics combined diagrams with a mixture of flow diagram symbols, electronic symbols and wires. The resistor-capacitor (RC) average is a simplification to show function but it is not correct a sliding average of half or one cycle should be used.  Other signals that are not shown such as Pgood signal low can be used to indicate whether the main regulator is limiting. The proportional part of the loop gain due to the amplifiers as a guide should be <50, that is a 2% change in any signal should result in less than 100% change in the output voltage. 

Below 1.5V the dynamo's power output substantially looks like a voltage generator with series resistance in this case of 5 ohms.  The power obtained by implementing this would be largely lost in other losses such as diode voltage drop loss.  This feature is to be added to the diagram. 
Maximum power transfer strategy diagram AL-0043-01A.  Potentiometers set the maximum dynamo current and the output voltage limit, for battery charging.  The dynamo maximum current potentiometer should only be increased when the main power supply is limited by that control to prevent the set point from running away. Similarly, the voltage output control is only effective when the power supply is limited by that control.  The potentiometers represent controls from other software functions.


Intelligent nudge - Calibration at the maximum power output;

  • At a steady speed test by increasing the current taken to see if the power increases or decreases - then adjust the maximum power accordingly.
  • The test can be carried out under varying speed conditions by testing using power x frequency or voltage.
  • A dummy load may need to be added.  Alternatively, keep the calibration strategy simple under variable speed and loading conditions available. 
  • The normal operation requires that the power factor be good when maximum power is required and that not too much current is drawn from the dynamo. 
I have drawn this diagram after developing circuits because I can now see more clearly how to show in a diagram what I am aiming for.   Consequently, the diagram is clearer than my earlier abandoned attempts but also more closely fits with the circuit variants below.  It is also part of cross-checking those circuits AL-0002-???


Next step - build test rigs and test some of the functions


http://minisystem.blogspot.com/2011/11/ has carried out some of these tests with dynamo LEDs and discovered that the dynamo will produce at least 5V peak operating down to 12KPH the current is low though because much of the output will be under 5V. The circuit above and circuits AL-0002-01? should operate down to <3V and <10KPH although with very poor efficiency. 

The graph right does not belong to me, so I have asked if I can use it? The green line is relevant so disregard the blue line.   I have cropped the graph. 


The current was presumably measured in series with the  LED with a 5V drop so increases as the on-to-off duty cycle increases with the higher voltage generated by the dynamo. 



User Interface and refinements;

The diagrams below are mostly worked through but for a software assessment of their viability.  The low-speed crystal oscillator is not used so four port pins including 2* 0V screen pins were made available.  Each PCB could be calibrated for temperature change using the on-chip temperature sensor, oscillator and microcontroller's oscillator trimming registers. 


Some basic functions are provided but more controls and features such as the distance travelled log require a tablet or other computer to be connected to access those features. 


Smiths BL/BMC (the 1960s-1970s) Mini speedometer, 

odometer, fuel gauge with other indicator lights 

Thank you for the photo https://www.digital-speedos.co.uk/

  • Battery charge rate and surplus power for USB power output control,
    • The tilt sensor senses the bike's inclination to determine if the bike is moving up or downhill so change the strategy between taking maximum or minimum power from the dynamo.  Programmed using:
    • When the battery's charge is very low the inclination control is overridden and the battery is charged at a higher rate.   
    • Learn mode to program the dynamo power taken strategy.
    • Control switches, LEDs and speedometer proposed;
      • Switch Dynamo power;
        • ON 1 Minimum dynamo power and minimal charging current.
        • OFF 2 Managed dynamo power for lights, managed battery charging and surplus for USB.
        • ON 3 Maximum dynamo power with the surplus to USB (out). 
      • Switch to turn on USB charging/Learn/Set 
        • ON 1 USB (in) to provide charging current.
        • OFF 2 USB (not in), Learn dynamo use strategy.
        • ON 3 USB (not in), Use learned dynamo use strategy.
      • Switch to turn the lights on. 
        • Lights off
        • Lights on
        • Lights high or flashing.
      • Red/Yellow/Green - battery charge status LED. 
        • Red, Red/Yellow, Yellow, Yellow/Green, Green.
        • Steady indicates charging or dynamo power,
        • One colour flashing indicates discharging.
        • All colours, Red - Yellow - Green, flashing; Fault USB and dynamo charging or battery.
      • Blue - USB connected status LED.
        • Steady indicates charging and connected,
        • Flashing indicates connection.
      • Speedometer and possibly an odometer LCD display.
  • Alternatively;
    • LCD display and push buttons.

Display types;
  • LCD Transflective, 25x50mm (128x64 dots),  LED backlight 60mA 3.2V (switched off in good daylight), 64128K Display Tech systems.
  • OLED 55x27mm (128x64 dots),   20mA 13V,  I2C bus, W12864XA Electronic Assemblies. 
  • EPD 27.5x27.5mm (152x152), 2mA 3V, I2C bus, MT-DEPG0154BNS800F5 Microtips technology - no illumination.
  • 2x Seven-segment LED displays plus bar graph and LEDs <100mA, 2V.
Alternatively, use a traditional needle-type meter or a moving coil meter could be used.  Fitted with a shunt resistor or large capacitor to damp the movement would only require 50-500uW (10uW for the movement). Eddy current and Air damper types are more robust.  These are not robust but the type in the car fuel gauge, above, is a hot wire type they are robust but they consume too much power.  Taut band types and also with damping are more robust. 

 

Speedometer circuits AL-0041-01C. 
 
1-3. Simple a series resistor with the meter from PWM output to VDD - the PWM will need to be set according to speed and measure VDD.

2-6. A resistor or capacitor is included to dampen the meter.  A damped meter is a better option.

4-6. With regulators so do not require measurement and calibration for fluctuations in Vdd. These are more expensive options and (6) is the most expensive option.

1-4. A buffer transistor may be required because the open-drain output of the microcontroller is fairly high resistance and may introduce a significant temperature coefficient when driving a higher current or shunt-damped meter from a low voltage.


Software;
The switches selected are three positions on-off-on and they are red by;
  • Turn on the pull-up and test the port pin for a low state. 
  • Turn on pull-down and test for pin high state. 
  • If neither of those then the switch is in the open state. But if the microcontroller port pin can not be configured with pull-down on the port output low drive be used instead.
  • The LEDs are driven from a high drive.  The blue LEDs from an open-drain configured port.
STM32 Cube MX software project files; 
  • Some of the meter drivers above require that the PWM be output from a high-drive open-drain port but the project files do not seem to allow this to be done? 
    • Options requiring a high current open-drain port (6). 
    • Options requiring the output port to be set to high drive; all except for (4) and (5). 
Journey log recorder in the serial EEPROM;
The information is formatted and is for access via the USB port. The microcontroller keeps a count of the time since it was last powered up until the battery runs down.  It does not keep actual time. 
  • A record of various parameters is stored once every 10 seconds. Would be a 133M location resolution for a top cyclist who can achieve 60KPH briefly. 
  • A log is kept with record number 2^15 stored which is the last record number plus 1 and rolls around to zero.  The oldest record is overwritten by the newest record and so the next record would not be consecutive marking the start and end of the circular log.  The most significant bit indicates a new journey. 
n = MOD (n+1), (2^15)
  • Data stored, journey number, distance, direct change and gradient travelled since the last entry.  Additional information stored; supply voltage, current, battery state of charge, dynohub current and voltage. 
  • The 6-axis accelerometer in three plains, rotation in three plains and gravity by an external sensor, inertial sensor; 6 words (12 bytes).  LSM6DSR, ST.COM (there are newer better value parts available $3ea/3000).  This may be a cheaper part and a 3-axis accelerometer such as IIS2DLPC should be adequate and would be a cost-saving. 
    • Alternatively, in many ways, a more suitable part is; FXOS8700CQ, NXP (not recommended for new design $1.60ea/1,000) This is a 6-axis accelerometer X, Y and Z and magnetometer X, Y and Z. so can measure absolute tilt and acceleration.  NXP makes many two-axis accelerometers that are less suitable and do not operate below 2V. There are many other makers and some are 9-axis.
    • There is a risk that with a new design, a key part suddenly becomes unavailable for a number of months.   The manufacturer may be persuaded to release sample stock so that the design can be made.  That is preferable to using unknown source products, PCB assemblers are very reluctant to do that.  It could be possible to change the circuit board design to accommodate two or more lC types in case it becomes necessary to use an alternative.  
  • Calibration data for the time and all variables be stored.  Calibration systems need to be developed.
Note the number of write/erase cycles of the serial EEPROM is minimised by storing data consecutively but not including an index count pointer word.  Consequently, the record counter increments by one rolling over 7FFFH to 0000H but the last record is determined when the count does not increment but jumps in value.  The oldest record will be overwritten, data first then the new record number.  
  • A 2Mbit serial EEPROM has been included on the circuits AL-0002-??? that is; 256Kbytes but if we do some arithmetic to estimate what might be a useful size. 
    • Record number; 2 bytes, the most significant bit indicates the first of a new journey.
    • Different information is recorded, at the start or continuation of a journey;
      • Time since last entry; 2 bytes, over 100 hours. (360 * 100),  to a resolution of 10 seconds.
      • Journey number 1 byte (depending on how the battery copes with start/stop cycling), 
      • Other data stored; switch settings, pre-power fail or restored, if these change a different information record be stored during a journey. 1 byte.
      • Average Vcc, 1 byte, 
      • Main buck regulator output current, 1 byte,
      • Battery state of charge; 1 byte,
      • Dynamo current; 1 byte. 
      • Dynamo voltage; 1 byte.
      • The remaining bytes are not used. (11 bytes used)
    • The usual information recorded, once the journey has started is as;
      • Distance Dynohub pulses (up to ~2M per 20 cycles) previous entry; 1Km/ minute, 10M/second, 5 revs/second, 100 cycles second, <2000 cycles. 2 bytes.
      • Gradient, direction and acceleration travelled since the last entry 2*6;  12 bytes. Would need interpreting from x,y, and z acceleration information. 
      • Average Vcc, 1 byte, 
      • Main buck regulator output current, 1 byte,
      • Battery state of charge; 1 byte,
      • Dynamo current; 1 byte. 
      • Dynamo voltage; 1 byte.
  • 21 bytes per record. EEPROM 256,000 bytes. No. records; 12,190 = 256,000/21.
  • 33.8 hours = 12,190 * 10 seconds / 3,600.
  • A 2Mb serial EEPROM should be replaced with the largest size 4Mb.  Alternatively, the amount of information stored may be reduced or compressed.
Some filtering included preventing the log from filling with insignificant movements.  Data logged be analysed and the Dynohub power-take constants adjusted for improvement. 

If it is desired the real-time be set via the USB and retained.  This is a good PCB design from an old design that has been superseded;

The microcontroller 32KHz crystal oscillator seems to be fairly tolerant if a good PCB design is practised.  Neighbouring ports and vias in the oscillator tracks can be used by a user reported on the ST community.  I would still connect the port pins on either side of the oscillator pins to 0V or an NPO/COG capacitor to 0V.  A NiMH two-cell battery, or a 3V Lithium primary cell is connected to the uC battery pin.    Even so, many design engineers do not anticipate the sensitivity warning to take care about using a crystal oscillator design leading to many support requests to IC makers.

       
    AL-0002-02D old design version based on conventional recommendations for a crystal oscillator.  The crystal is surrounded by capacitors a 0V copper area outline has many vias to the internal 0V plane.  The draft view does not show copper area or track widths. 


      The variants of the detailed circuits to choose between

      It took a long time to find the parts for what I wanted to do originally which is investigate using bridge driver ICs.  Most of the ICs can not be configured as simple drivers instead of motor drivers.  The solution based on power supply ICs is good and was found more quickly.  

       

      The final design is likely to be based on a high frequency, inaudible, input boost power rail but using a bridge Power factor correction and power supplies will do the job well.  The dynamo's output could be boosted to 7W when cycling fast.  But is the non-boost variant similar to AL-0002-01? would work well although testing needs to be carried out before a final decision is made.  AL-0002-02? can be modified to work without the boost pre-regulator and is the best first design option.  There is little reason to have more than one of the variants priced and made in this case.

      Picture right Sturmey-Archer, AG - 3-speed dyno-hub, dated July 1953;  3-speed wide variable gear hub and 6V, 2W generator.  40 spoke.
       
      Anticipated behaviour based on a voltage-limited current source in series with a 5-ohm resistance but discounting the 5.5H inductance in the case of a GH6-type dynamo. The 5.5H inductance is not functionally in series with the generator but there is a small series inductance called leakage inductance that I do not know the value of? The test should also be carried out by the unit to characterise the dynamo fitted. USB power input be considered and battery power be used, the over-voltage clamp (version -02? to -05?) could be used. Therefore monitor the frequency, light or no-load measure voltage and short out the dynamo to measure the maximum current.
       
      Software implications;
      No pre-regulator solution requires fast power management (see AL-0002-01? and -02?).  The buck regulator compensation pin clamp voltage needs to increase and reduce with dynamo voltage increase and reduce to ensure that the limit of current is optimal but it must change continually.  A temperature coefficient is expected of (-01?) and a continual calibration process needs to be carried out under varying output conditions consequently but  (-02? configured without the boost pre-regulator) has an additional circuit function that partly takes care of this.
       
      The drawing right, Rectified sine-wave input half-cycle - optimum power take controlled by managing the power demand.  The white regions are where power is unavailable, an increasing angle/area of power that is unavailable as the speed and the voltage drops.  From 2V power for the lights and the microcontroller, 3.5V is a high enough voltage to fully charge the battery.  The graph shows that the dynamo outputs maximum current by phase angle or proportion of the average voltage;  420mA at 90', 270' and 300mA at 45', 135', 225', and 315' but the voltage increases with bike speed.

      This solution is the most efficient but takes less of the available power from the dynamo at low bike speed.
      ---------------------------------------

      An analogue solution for power limiting is necessary to achieve maximum power transfer (see AL-0038-02?).  No microcontroller is required if a manual calibration system is provided.  Uses a fly-back converter but there is a trade-off with the transformer inductance selected; 
      • Fitting low-value inductance with high current pulses and better power factor could have high electromagnetic emissions and higher losses (4.7uH, 270KHz), works from less than 6VAC, 500mA to 20VAC, 300mA but the Power factor begins to deteriorate at 30VAC, 500mA,  Or 
      • Higher-value larger inductance (as a conventional fly-back design) but the power transfer would not be the highest and would be more efficient (22uH, 270KHz).    Alternatively, the pulse width would need to change continually to correct the power factor, achieving more modest losses and lower electromagnetic emissions.  A current-mode boost controller probably would work better if this inductor value were used. 
      • This simulation shows that with a low-value inductor (4.7uH, 270KHz) a good power transfer efficiency at rated voltage with any bicycle dynamo.  At higher bike speeds or with a higher value inductor (10uH, 270KHz) less than maximal power can be taken from the dynamo.  10uH was a calculated value that was a good starting assumption that 5V peak in and 5V output would be the worst case.
      It is probably best to stop with a less optimal solution.  Alternatively, a higher inductor value could be used to incorporate with the Power Factor current limiter section of circuit AL-0002-02n below.  This control system sets the maximum dynamo current to; dynamo current <= dynamo voltage/regulator output current and consequently, is roughly constant average current at peak load, as required.  That is the power limit increases arithmetically with dynamo voltage input. 

      The diagram is right; AL-0042-01D power simulation (LTspice).  Slowly varying the PWM drive gives a good Power Factor.  The transistors alternate between switch mode power supply or synchronous rectifier function to save power.  Sharing the input rectifier function with D3 and D4.  The transistor and gate drive and switching losses should be taken from the simulation.

        

      The simulation above; is AL-0042-01D (LTspice) of a transformer-coupled flyback converter. - Slowly varying PWM drive and a low-value inductor give a good Power Factor except when the bike speed is higher but then less than the maximum power available needs to be taken. 
      • The power factor is good with the first graph even with a higher power dynamo (4.7uH, 270KHz, up to 30VAC, 300mA or 20VAC, 500mA). 
      • The second graph (4.7uH, 270KHz, 30VAC, 500mA) shows when the power used is high that the inductor transitions from pulses of current to continuous current mode as the voltage * current input increases. 
      • In the third graph, the inductance (22uH, 270KHz) is much too high in this case but would be correct for a conventional flyback switch mode power supply in which the drive pulse width varies. 
      The requirement is not necessarily for the power factor to be good but that the current is taken to be always below the optimum maximum.

      The transformer chosen inductance of 4.7uH but the part selected works well but a different size part could be used optimised for low losses at lower bike speeds.  Wurth, Murata, TDK, Vishay, and  CoilCraft have good part selection tools and models.  CoilCraft also has web tools that create efficiency graphs for the comparison of parts. Either of the two transformers selected is close enough and we can stop there.

      ------------------------------------ 


      Boost pre-regulator 
      variants AL-0002-02? to 05? with a microcontroller control of boost transistors.  If the pulse width modulator (PWM) were varied slowly then in a boost configuration most of the current will be drawn at peak voltage input.  This is efficient but less power will be available.  Consequently, the microcontroller should continually adjust the pulse width and period.  Adjustments are made in steps perhaps once a millisecond or so;

      Simulation AL-0042-03B (right) shows a higher current transistor than is likely to be optimally efficient for the boost configuration but is suitable for the SEPIC design.  The gate drive is particularly fast and this Toshiba MOSFET'S gate threshold is a little higher, requires 5V and is well suited.  For the boost design, the other On-semî transistors listed may suit better? 


      The simulation graph left - of a boost pre-regulator driven by a fixed PWM shows the pre-regulator's current peaks (light blue, averaged) more sharply compared to the input voltage waveform so the power factor is poor. The other waveforms are two dynamo inputs, transistor drains, Vcc and the polarity detector.

      Boost regulator inductor only carries a proportion of the power, the inductor operates in the continuous current mode so the peak current is lower.  Consequently, this regulator is more efficient than the flyback converter above.  Conversely, the high boost voltage followed by a large step-down buck is less efficient but should be quite good overall. 
      -----------------------------------------------------------------------

      In all variants, the maximum current take is a sine wave matching the voltage waveform.  A compromised control by changing the PWM's period and mark-space ratio in steps and power take management is proposed.  The power limiting needs to change quickly say at 1mS intervals.

      The diagram right AL-0042-02A LTspice XVII simulation boost input pre-regulator LT1812 IC.  To show approximately what is to be implemented in software instead of this ic.   This solution can draw too much current and does not limit current taken as required.
       
      This simulation shows that an input filter, similar to the input inductor shown but using capacitors followed by two inductors, needs to be added to all of these circuits.

      This power factor controller IC does not limit the current (light blue) in the way required, but the diagram shows approximately how the current should follow the input voltage (Green and blue) for the most efficient power transfer from the dynamo. The right-hand side of the graph shows the pre-regulator has settled and the power taken from the dynamo is optimal.


      The graph left lower; Would be driven by microcontroller PWM outputs in a series of steps rather than in a smooth transition shown.  The simulation shows that this type of IC responds slowly and is unlikely to respond quickly enough in this bicycle case to be useful.  The output voltage (red) fluctuates after the switch-on. This simulation is not very useful.


      The left top graph; is of the two transistor drains showing that they are driven alternately continually but if you were to magnify the time (X-axis) you would see the pulse width varies continually.

      ---------------------------------------

      Control of the buck regulator compensation pin is likely to be difficult in AL-0002-??? because of its voltage feed-forward feature.  Consequently, the power limiting mechanism is likely to be unstable when the current drawn is near the optimum maximum. 

      This is because the regulator with feed-forward or current mode will tend to take more current as the input voltage drops before software or other control has had time to react to restore and reduce the current taken.  If more current is drawn from the dynamo when the current taken is maximum then the dynamo output voltage will drop severely and could cycle on-off.  This instability may be negated if the control is fast, which the additional circuit below is intended to provide.  These components can be omitted so that the function is not provided.

      The diagram right; Power Factor current limiter section of circuit AL-0002-02n.  Is designed to save software load, and difficulty and potentially take the maximum dynamo current more smoothly.  This circuit is only required when the boost pre-regulator is not used and is an option.  The input current at the rectifier is limited by adjusting the Comp pin clamp to a percentage of the measured Vgen+ peak, calibrated in software that has a setpoint output DAC (PWM_per_lim).  A resistor between Vgen- and 0V (buck regulator), not shown, monitors the dynamo current.  The matched transistor pair forms a voltage-controlled potentiometer.



      Design files for all variants;

      • AL-0039-01F Op-amp Ibatt resistor and LED PSU resistor networks.ods spreadsheets.
      • AL-0040-01B  Dynamo Battery Manager - Microcontroller select - Software.odt  --- Updated document to follow.
      • AL-0042-03B LTspice power simulation - improved transistor switching circuits with graphs generated.  More functions are included in this simulation so consequently, the simulation runs more slowly. Usually, the simulation would be better to break into smaller models but the purpose of the diagram is to put the refinements together this larger simulation tests important functions operating together as well.
      • List of files; There is a spreadsheet list of files.

       

      The decoupling strategy is to place 100nF ceramic decoupling capacitors close to each IC power pin's, internal power planes 0V and Vdd for the microcontroller.  I/O has 1 - 10nF COG/NPO capacitors near the connector pins.  The 0V power plane provides screening for good EMC performance.

       

      There are no thermal reliefs in the power and thermal planes. This also provides better electrical conductivity.


      The part libraries are to an old standard that changed more than 25 years ago so many footprints should have the index in the centre but CADSTAR libraries have many parts with the index at pin 1. It is necessary to fix this before using the footprint or creating a footing. PCB assemblers can correct small discrepancies they have but they can not correct for this error necessarily.



      --- AL-0002-01 Basic bicycle dynamo battery and lights manager - Draft ---

      • AL-0002-01M Circuit and PCB's - draft.  The design should fit under 100 x 100mm.
      • AL-0033-01F.ioc Micro-controller selector and configuration project file draft. ---
      • STM32L072C - 48 pin one test point and one spare pin.
      This type of moving coil of meter pictured right is clear to see 
      100-0-100uA, but a left-hand zero type is required as a speed-o-meter.

      Advantages and Disadvantages of this design; 
      • The input capacitor should be small (1uF) for good power factor therefore efficient power transfer but options to fit higher value capacitors in case electromagnetic emissions turn out to be high or it turns out that the buck regulator becomes unstable.  If a higher value capacitor is used then the power factor will be poorer and less power can be taken from the dynamo which is the trade-off. 
      • A large capacitor is fitted to VCC, the main power to ensure that the microcontroller's power is not interrupted almost regardless of the battery's state of charge or whether a battery is fitted.
        • After providing power for the microcontroller software is required to manage the modulation of the LED current next priority, then USB output current if there is the power to spare.  The LED flicker may not be very noticeable but care needs to be taken to ensure that the brightness modulation frequency does not beat with 2x dynamo output frequency.  That is led brightness modulation frequency be set to a multiple of two times dynamo frequency or be a much higher frequency.
        • The battery will provide lighting power when the dynamo speed is low thereby allowing the lights to dim a little but preventing the lights from flickering severely at frequencies that are a health issue.  Perhaps dimming the lights but not allowing the lights to be off for more than say 10 mS?
      • This is an efficient solution with basic functions.
      • There is no input boost supply rail so the circuit will not operate at as low bike speeds as other versions below do.  
      • The switch-mode power supply IC includes feed-forward compensation could cause a problem to occur with more current attempted to be drawn when the dynamo's output voltage is lowest and the least current is available.   
        • The main regulator's power is controlled by DAC and a transistor AND-ing the soft-start function.  This circuit is very simple and low cost consequently has a large temperature coefficient that must be continually corrected for in software.  Alternatively, the main regulator's output voltage is set using a PWM output be used.   
      • Speed-o-meter output - will drive a 0-50uA moving coil meter.   Scale illumination output needs to be developed. 
        • This is driven from an open drain PWM port pin will be compromised a little by the temperature and VDD coefficients of the port pins on-resistance (~50 ohms).
      • Replace the diode bridge rectifier with a bridge rectifier controller and transistors will save power at low input voltage.  This will save 15% losses at 6VAC input.
      • At the start of power input, the batteries are charged at a moderate rate until Vdd reaches a high enough voltage for the microcontroller to start up and take control.  In this case where at startup the battery is found to be low voltage and charging then an assumption be made that the battery was fully discharged, and the coulomb count is zeroed.  
      • Although batteries can be changed there is little protection against the batteries being fitted reverse polarity and in this case, the current sense resistor would burn out.  

      ---  AL-0002-??? As above (01?) But with a different main regulator --- not developed --
      • Changed the main regular to lm76002-q1 TI, this is a more expensive IC,
        • Start-up down to >3.5V rather than > 4.3V with better external bias supply or-ing for lower start-up voltage.
        • Also, the compensation pin can be over-driven to reduce the power output similar to driving the soft-start pin in version -01?  The IC is internally compensated.
      • LTC3649 ADI, 4A, 60V
        • Start-up down to >3.1V rather than > 4.3V with better external bias supply or-ing for lower start-up voltage.
        • Also, the compensation pin and current programming pins are available.


      --- AL-0002-02?  Software-driven with PFC input or software-driven with PFC boost supply for lower voltage operation --- Draft ---


      PCB size under 120x100mm 4 layer components on one side.
      • AL-0002-02N Circuit and PCB
      • AL-0033-02F CubeMX software project file. 
      • Vgen is boosted by PWM so that power is stored in the capacitor long enough to ensure that the LEDs do not flicker at 2x dynamo frequency.  
      • The circuit can also be operated without the boost pre-regulator and includes a power factor limiting circuit to save processing power and software work.  The electrolytic reservoir capacitor also needs to be removed.  But if the boost regulator is used, the limiting circuit should be disabled by shorting the soft-start pin driving transistor E to B.
      • STM32L052C6Tx 48 pin, microcontroller.  With one test point and one spare pin.
      • The meter driver is for the highest current type with a 240' movement.   The movement is 500uA so the power taken is ~8mW = 2.5mA * 3.3V.
      • This design and layout are to be refined after software review. 

      Advantages and disadvantages;
      • Power Factor Correction is approximated by the software-driven varying Pulse Width Modulator boost supply.  But the drawback is that boosting to a high voltage and then dropping to a low voltage is less efficient.  Conversely, if the reservoir capacitor is large then the boost voltage can be lower than the boost followed by buck regulators can be efficient topologies at low bicycle speed.
      • Current regulators for LED drives instead of voltage regulators to improve efficiency have not been implemented.  This could be implemented in the lamp units from the 2-3V light output, with the addition of PWM outputs. 
      • An earlier version of this design (AL-0002-02D) used the ucc29910A PFC IC, which only requires a 5V power supply, but this design looked unnecessarily expensive and was abandoned.
      • This version is suited for evaluating both with or without a boost pre-regulator strategies, whereas version -03 is more efficient.  This version -02 but without boost pre-regulator is more efficient than version -01. 
      • The unit should have some power for lighting for up to the storage life specified by the battery perhaps, one year.  Dynamo power is available immediately regardless of the condition of the battery.
      • The battery could be changed the unit is protected against the batteries being fitted with reverse polarity.  In addition, the unit will still run lights first priority.
        Improvements;
        • To be refined after software review.
        • Add buck-boost SMP LED current drivers.  
        • Change the microcontroller to a larger;  STM32L072R - 64 pins and has two DACs.
        • Add input filter capacitors followed by series inductors.
        • Implement the modifications provided to remove the input boost pre-regulator and thereby the circuit to become an improved version of -01? (above). 
          • The circuit may not operate to as low voltage but the risk of EMC non-compliance can be reduced if the large reservoir capacitor is fitted.  In that case, there would be no PFC and the power taken from the dynamo would be reduced.
          • Keep the input rectifier and over-voltage protection formed of low-side software-driven transistors which have lower losses than diodes used in version -01?. Therefore short boost inductors. 

        -- AL-0002-03 This variant uses a better low-side battery power switch. -- Draft ---
        • AL-0002-03o circuit and PCB. - This variant is similar to version -02?.
        • STM32L052C - 48 pin.  There is one spare pin and one test pin.
        • This variant has a more efficient battery charge/discharge power switch because an n-channel MOSFET is used that is driven from the higher boost 3-5V supply.  But the battery current drain is higher although not too significantly when switched off because more functions remain connected.
        • This variant will operate if the battery cells become shorted (I do not know if this is a serious issue with NiMH cells compared to the older NiCd type).   Software is required to turn off outputs when Vcc voltage is low to keep the microcontroller powered from the reservoir capacitor. 
          • If it is found that a battery cell is shorted a low-intensity warning such as slow rate flashing of the battery state of charge LEDs when dynamo or USB power is available.
        • A circuit is included that limits the battery charge current;
            • Vcc maximum is controlled by the battery current monitoring amplifier but this function has not been fully developed.  A diode is shown "do not fit", to disable this function. 
            • The amplifier's gain would need to be calculated and resistors selected for the chosen battery.  There is no software adjustment of this current limit.
            • The additional circuit could cause instability in VCC, poor current monitoring and unnecessary complications.  Conversely, the circuit is more responsive and likely to have better than software-controlled current limiting.
            • The Ibatt amplifier does not include switch gain and current range for charge rating measuring but is suitable for measuring current and coulomb counting. 
          • Power-consuming peripherals and the microcontroller modes are set to low power or turned off when there is no dynamo or USB power.  
          • This circuit can operate like version -01? without the boost pre-regulator, but power management must be well developed.  That is because the microcontroller is powered by the Vdd capacitor in which software must manage the loads to retain enough power for the microcontroller during the zero voltage part of the AC input from the dynamo. 
            • In this case, the power limiting circuit in version -02? could be pasted into this circuit (scroll up this blog to see).
          • This design may offer a small improvement on version -02? in handling a higher battery charging current. 
            • The battery switch transistor when turned off still provides a little power for the microcontroller.
            • Unfortunately, there is a small but significant current drain from the battery to the buck regulator consequently the battery may be run down over winter where a bicycle is only used in the summer.  Whereas other variants the NiMh battery should have some power for up to a year so the lights can always be used and the battery would have a little more life. 
          • The meter driver is simple but the most expensive variant or the most efficient.   The movement is 100uA but would work with a 30 or 50uA movement with better damping and lower voltage VDD.
          • The battery could be changed the unit is protected against the batteries being fitted with reverse polarity.  In addition, the unit will still run lights first priority.

               

              -- AL-0002-04 This variant uses Lithium rechargeable (LiFePo4). Uses the micro-controller op-amp which is good enough but must be turned off when the unit is inactive to save power. -- Draft ---

              • AL-0002-04J  PCB and circuit. 
              • AL-0033-04C  MXcube microcontroller project. -- To be updated
              • Uses STM32L052C 48 pin. - One test pin and one spare pin.  
              • Lithium protection is less demanding than for a laptop because the cell is a safer LiFePo4 type.
              • In this case, the uC be permanently connected to the battery and software manages the battery protection.
              • The power path is more efficient because the voltage is higher and the currents are lower so I2R losses are smaller.
              • VCC power supply is disabled to save power when there is no USB power in or dynamo AC input.
              The Moving coil meter pictured right above is not so clear to see that 0-1mA is not ideal as a speed-o-meter.
              • Speed-o-meter output - to drive a 0-30uA moving coil meter.  There is also a scale illumination output but this needs to be developed.
                • This is driven from an open drain PWM port pin will be compromised a little by the port pins' on-resistance temperature coefficient.
              Advantages and disadvantages;   
              • The second lights regulator provides up to 400mA at 1.2V to 5V and is described scroll down below. 
              • Although the battery could be changed and the unit used to charge batteries there is little protection against the batteries being fitted reverse polarity and in this case, the current sense resistor would burn out. 
              • The lithium cell holder or connector must include protection against reverse polarity connection.

               

              -- AL-0002-05 This variant uses Lithium rechargeable (LiFePo4).  Uses the on-micro-controller op-amp and another more accurate op-amp which is good enough but must be turned off when the unit is inactive to save power. -- Draft ---

              • AL-0002-05G circuit and PCB
              • AL-0033-05D.....ioc  STM32L151RCTx 64pin microcontroller project file -  has unresolved clock issues.
              • This variant is similar to -04?
              • Uses STM32L151R - 64-pin microcontroller.
              • This version uses a microcontroller with op-amps;
                • There could be a cost-saving.
                • Small signals are tracked across the PCB rather than amplified at the source then large tracked across the PCB.  This may not be an issue.
                • The op-amps are not optimal and the input current is quite high.
              • A speed-o-meter moving coil meter output is provided.  The LED illumination drive needs to be developed.
              Pulse counter for mileage counting with set and reset. This counter
              is heavy, requires 24V pulses, counts down and so is unsuitable.
              • Although the battery could be changed and the unit used to charge batteries there is little protection against the batteries being fitted reverse polarity and in this case, the current sense resistor would burn out.
              • The lithium cell holder or connector must include protection against reverse polarity connection.
              -------------------------------
               
              -- AL-0038-02 no battery, no microcontroller. 5V outputs for lights, USB power output plus a speedometer. --
               
              A combination of the above versions AL-0002-01? and -02? to -05? but using two transformer-coupled two-boost regulators (SEPIC).
              • Circuit and PCB AL-0038-02D
              • The output capacitor is of a modest value consequently Vcc will have a high ripple voltage.
              • A boost voltage mode type switch mode power supply controller that has no feed-forward and is not current mode control would be the most manageable for optimum power transfer.
                • Buck controllers but using the high side driver to form a boost regulator, NCP1589A, NCP3020, NCP5269B, A6727, L6726A  - that manufacturers On-semi and ST confirm.
              • The synchronous rectifier at the output to save power would make this an efficient solution.   Because this option is not implemented on the high side this is a flyback converter instead of a more efficient SEPIC converter, a capacitor is shown to not fit, therefore requiring a snubber network that will waste some power.
                • It is possible that the synchronous rectifier won't work efficiently due to the cross-conduction prevention mechanism not configured for this application, so there is an option to use a diode rectifier instead.
                • An integrated circuit high side synchronous rectifier circuit could be added to replace the diode option.  Using a transistor and a high-side synchronous rectifier controller based on ICs such as; TEA1993TS, TEA1999TS, UCC24612 or SRK1001. 
              • The dynamo current is calculated from the regulator output current to limit the average dynamo current.  Consequently, the dynamo power taken is limited in a simpler and more efficient way.
              This design idea could be developed as a quick but dead-end development demonstration, using evaluation boards and Veroboard prototyping.  Alternatively, a PCB be made by completing the design with or without connectors to mount a microcontroller evaluation board.

              Circuit diagram and incomplete PCB (CADSTAR).  Starting to place and group the parts by function.
              • The design is incomplete, and component values and footprints are wrong.  The PCB shows an early design step of grouping functions together placing those groups and some routing to help to improve the placement.  Some footprints need to be defined to replace the temporary single inline connectors placeholders.
              • The optimum current limit is set using a voltage clamp on the boost regulator compensation pin programmed with a potentiometer.  The output current is set as a proportion of input voltage, up to about 3A.
              • A switch allows the speedometer meter to be used to calibrate maximum power transfer.  
              • Switch the switch to calibrate maximum power transfer.  The dummy load is also connected;
                • Keep the wheel spinning steady speed that puts the meter needle about mid-scale.
                • Adjust the potentiometer for maximum meter deflection which is maximum power.  It will be necessary to let the wheel speed reduce in order to keep the meter reading about mid-scale.  The potentiometer should then be reduced slightly.
                • You will observe that the power will increase or reduce with wheel speed.  The power will drop severely at very low speeds.  This poorer low-speed performance may be improved by reducing the potentiometer a little if required.
              The Speed-o-meter section shows a trimmer potentiometer to calibrate the speed-o-meter for wheel diameter.  A jumper and several resistors for different wheel diameters could be provided instead. 

              The alternative switch position is for optimising the dynamo power, there is another potentiometer for this.  This shows some of the extra cost and complication is added in this case instead of using a microcontroller solution.
              • Many of the analogue functions are likely to be unstable and some circuit modifications may be necessary if this is a problem.
              Improvements and outstanding changes;
              A hub generator would be improved if it were a two-phase (4-wire) or three-phase (3-wire) the extra wiring cost is mitigated by integrating the rectifier, overvoltage protection and power management plus speed output into the generator.  However, the single-phase generator was the most cost-effective and good solution in the 1930s to the 1990s that set the standard for voltage output.
              • Define missing PCB footprints, which have SIL connectors as placeholders.
              • Complete PCB layout, including adding more decoupling capacitors.
              • The circuit does not slightly increase the current taken with dynamo voltage increase.  This would have contributed a little extra power output.
              • The circuit does not ensure the load is >5 ohms.  Consequently, not all available power will be gathered at low dynamo speed.
              • Battery and charging circuit are not included but a Lithium cell and L6924U, L6924D and probably other IC battery charging controller IC will work with AC ripple on the power input.  Other IC battery charge controllers such as bq25017 have more features. 
              -------------------------------
              Design output files


              ToDo - list all variants of AL-0002-??? and AL-0038-02?;

              • The microcontroller needs to be changed to a 64-pin device.  To provide function or design revision flexibility.
              • Add backlight power for the speedometer. 
              • Consider using smaller batteries. Therefore change the battery holders.  
              • Consider removing the variable voltage control of the 5V USB output.  Software be configured to use the battery to fill in fluctuations in supply to the 5V USB output but leave reserve for the lights.
              • Consider replacing the battery with a super-capacitor, (This is simpler to manage)
                • It is unlikely that the microcontroller needs to be kept running because there is an EEPROM for logging data.  But a small two-cell NiMH button battery, to maintain microcontroller Vdd and run the lights initially could also be added possibly?
                • If the time and date clock were required then the microcontroller's 32KHz crystal oscillator should be added and a NiMH two-cell battery should be connected to the uC battery pin.     
              • Main power supply compensation needs to be calculated. It is roughly based on the datasheet examples. 
              • The input filter stage needs to be added, for the dynamo power input.  A screened cable would also resolve the issue, this is catered for but could not be relied on to be connected properly.
              • Select suitable boost inductors to replace the placeholder parts used. Depending on the selected operating frequençy for example 68uH at 100KHz.
              • Consider replacing rectifier diodes with synchronous rectifier IC circuits such as TEA1998 or TEA1999.
              • Consider adding a buck-boost LED current source for all lights or at least for the front light for all AL-0002-xxx variants.  As AL-0002-04? or AL-0002-05?.  Alternatively add a PWM output for the power supply to be located in the light unit to form a 2-5V input light unit, instead of the PWM-driven power output.
              • Change the accelerometer to a cheaper or likely better availability 3-axis part.
              Right; From Dynamo Maintenance blog  AL-0035-04B Phase control Dynamo to 5V DC a regulated power supply such as USB power output.  The design returns surplus power back to the dynamo and therefore back to moving the wheel forward.  By comparison, the maximum power output is only; 1.5W = 300mA x 5V.  ST.COM recommends that an over-voltage transient absorber (TSV) such as SMBJ13A be added to this circuit.  I should say I think the issue is addressed well without the addition of a TSV. 

              No load loss due to the crowbar-shunt regulator is less than; <1
              W= 0.3Ag*1.5Rg + 0.3Ag*1.6Vt

              This simple regulator would run Bikemate lighting pictured near the top of this page in low-intensity mode.

               
              Which design to go forward with;

              The cost and benefit of using a more expensive microcontroller with more functions on-chip Some people cost things on 5p per pin used whereas other high volume users tend to simply avoid integrated circuits where cheap discrete parts can be used.   It is not clear-cut without asking a PCB maker and assembler to price some variants in the volumes you are likely to use.


              STM32L072R or STM32L052R are probably good choices along with using an external dual operational amplifier.  For the Ibatt monitoring, it will be necessary to periodically turn off all major current inputs to calibrate the battery current measurement.   The A-to-D converter reference is VCC with a 1.25V internal reference connected to one channel to measure VDD.  This works over the entire voltage range of a two-cell NiMH battery.

               

              STM32L0??? And STM32L0??? Do not have op-amps and better-suited external op-amps are used. 

               

              STM32L151, by comparison, is more expensive and has two op-amps but the cost of the extra parts saved may break even.


              The op-amp PGA feature is only a simple 0V-referenced set of fixed gain settings for the op-amps.


              STM32L433 some variants with 64 or more pins have a buffered reference output, so the A to D converter can be referenced to that instead of VDD, which varies.  In addition, there is an op-amp. 

               

              STM32L475 (two op-amps) variant with an on-chip reference buffer.   This microcontroller comes low down in the selection tool, so may be a poorer value for money than the newer microcontroller below.


              STM32L552 have two op-amps, and a buffered reference output but in both cases, if the buffered reference is used it is only accurate with high VDD otherwise it reverts to tracking VDD.  This is one of the faster newer low-power microcontrollers that may be more suited to the variable PWM controller of the boost regulator.

               

              STM32F303 (four op-amps) or STM32F072 (no op-amps) are lower cost, without the low power and lower voltage features.  Is low enough power to be used with any variant with the boost regulator or lithium cell to provide VDD.


               --- STM32L072R is probably the best choice in all variants. ---

               

              Another possibility is to have several variants developed and made.  Then have one or two of each variant on a panel of PCBs and put as many different PCBs on a panel as possible.  But this may not be worthwhile PCB makers now put as many different jobs together on one panel in any case so it is necessary to check?


              Have at least two PCBs made but not assembled but the cost difference of assembling just one or all may now be comparatively small.   That depends on whether pick-and-place or manual assembly is chosen.  It is necessary to ask each PCB supplier/assembler the same combination of questions?


              PCBs that are not assembled can be stored for up to 18 months and be assembled successfully.  After this period of time, the metal pads may have oxidised too much for the contact to be reliably made. 



              Prototype and ad-hoc development;
              Is now more common than, plan, model and building right first time as above.  Taking the design process in smaller steps shows something working early.  The disadvantage is that you are not necessarily testing the nearest to the final version early particularly the PCB layout.   Also if a design is not fully understood then why it works then fails later is not predicted.

              The all-analogue solution AL-0038-02A could be developed or combined with a microcontroller and avoids a lot of software work.  Software developers often ask for more hardware to save work.  A less optimal power transfer bridge rectifier, large input capacitor and SEPIC regulator instead of AL-0042-02? pre-regulator would reduce the risk of electrical interference.  It may not be much more than expensive but makes development possible in easily compromised steps for example.   Lithium cell and charge bq25017 or L6924u also be added with very little software work required. 


              The generator
              A hub generator would be improved if it were a two-phase (4-wire) or three-phase (3-wire) because the current is output continually.  Ripple would be 40% for a two-phase generator and just 15% for a 3-phase generator when full-wave rectifier.  


              Evaluation of a home-made bottle generator;

              See appendix in the blog; https://blog.andrew-lohmann.me.uk/2019/07/bicycle-hub-dynamo-maintenance-project.html

              Picture right; Astrosyn motor bottom left.

               
              There is no power factor correction and less than optimum power is taken between 0' 45' 90' 180' 270'.  But with a simple reservoir capacitor would output <2/3rds of the possible power.  Roughly calculating for 5V or 6V out, buck SMP ICs; 

              • L7987L st.com; 4.2W = 55V x 1.7 x 2 x 23mA,
              • LMR36510 ti.com; 4.6W = 60V x 1.7 x 2 x 23mA 
              • LMR36506 ti.com; 3W at 5V out.

              AL-0035-03C 4-phase stepper motor as a generator and input rectifier is centre-tapped and can be used with circuit variants AL-0002-??? with some adaption.  In this case, the over-voltage protection is unnecessarily efficient; the OverV- diodes could be removed and the OverV- connected to 0V.

              A low power mains voltage power supply IC such as mains to USB or phone charger probably could be adapted to start at lower voltage with the addition of current limiting taken from AL-0038-02  the IC use could be similar too; TEA1723 nxp.com would take half the available power 20mA and require >20V to startup.  

              ------------------------------------------------------------

               

              LED power supply for one or many identical LEDs connected in parallel.   An LED running at 100mA is very bright and the maximum current available probably could be reduced.  White LED's voltage drop is 2.8V - 3.2V or <3.5V - 4.2V depending on the type but Red LED's voltage drop is about 1.7V.


              Average current limited set by pulse width modulator for diving any LED.  The LEDs used if connected in parallel in the same assembly and from the same manufacturer batch.  Alternatively, lower voltage drop red LEDs can be paired in series then multiple pairs connected in parallel. 


                     
              This current regulator could be situated in the lamp with the addition of input protection.  The output current is set by R17.  AL-0002-04J sheet 5 is the small red square near the centre of the PCB.
               
              The lights regulator provides an average set by pulse width modulator proportion of the set current at 1.2V to 5V.  The voltage is not so high that damages an LED if the LED is reverse-connected.  Operates 2V - 5V input.
              • Using an STBB3JCC buck-boost switch-mode current regulator
                • This regulator's current output could be re-configured by changing the programming resistor (Resistor = 100mV / Current_required).
                  • 100mV Feedback +-10mV.
                  • The current is set by a resistor to 400mA.
                  • The current is reduced by Pulse-width-modulation
                    • 100-300Hz, with <300uS turn-on time when the current output ramps and the output capacitors determine the ramp-down rate. Determine the average current and any LED colour change.
                  • If the input power has an AC ripple component from the dynamo the frequency may beat with the PWM frequency causing the LEDs to flicker.  Therefore in this case use the highest PWM frequency 300Hz.  [This warning is applicable to AL-0002-01? and other variants with no pre-regulator]
              • The LED lamp is connected between Lamp- and Lamp+ 

              • Alternatively, a regulated 5.2V can be taken from Lamp+ and 0V.
              The 2V to 3.5V output is suitable for a red LED + series resistor but the brightness will change depending on the state of battery charge and dynamo output. That brightness can be managed in software by Pulse Width modulating the output alternatively the programmable current in the data-sheet below BCR421U Diodes Ltd. will keep the current more stable over the voltage range.

              Data-sheet right; A single red LED will drop 1.7V consequently the LED current will reduce below 2.7V but not so severely as if a simple series resistor were fitted.  In any case, a simple resistor would be fine a 7:1 current change would be noticed but would not be severe but a 2:1 current change would not be noticed.  BCR421U's current should be programmed by fitting a suitable external resistor between 10mA and 100mA but can be set to a higher current.


              LED lights; - see section of Bicycle-hub-dynamo-maintenance-project


               ---------------------------------------------------------------------------------------------------


              Conclusion

               

              I have used this project as a design exercise to learn and formularise myself with some of the STM32 series microcontrollers and keep myself up to speed using CADSTAR 18 and other CAD tools.  I have not been paid for support just now on that circuit and PCB CAD tool because I am not working.  For example, there is a feature to click on a net and move promptly to other locations where it is used that I would like to use.

               

              I have not explored whether I have chosen the best combinations of the microcontroller's peripherals for the functions required, particularly timers.  This is partly why the design options are marked draft, they require software review write draft software for some function blocks.


              I have also considered software solutions by drawing a solution in electronics, which software engineers tend to call hardware. A hardware model in springs, levers and wheels is good but the software solution could be very different.  A springy Reynolds steel sports bike frame can be applied in inductors capacitors and resistors but electronics work better with the stiffness of bonding 0V everywhere for screening but uses springiness as well, both giving immunity to road vibration or electrical interference and efficiency of power transmission.  Transmission line theory applies to electronics. Maths such as averaging a signal over one cycle of the dynamo output are easy in software. 

               

              Technical discussion on the electronics community.st.com/s


              Related blog Bicycle-hub-dynamo-maintenance-project


              Tony Hadland - How to repair old Sturmey-Archer hubs


               ---------------------------------------------------------------------------------------------------------

               

              Power for a low-power wireless long-range device.

               

              For smaller Internet of Things a D-Cell lithium primary cell may last up to a decade,  alternatively, an energy harvesting strategy can be used.  Depending on the power required.

              AL-0035-02C,  single, 2, 3 or 4 phase stepper motor used as a permanent magnet generator.  A generator with a high number of poles should operate requiring less gearing, therefore lowering frictional losses.  The motor is a two-phase stepper motor but if the windings had centre-tapped connections the motor would be called a four-phase stepper motor but is otherwise identical.  A 3-phase generator should be wired star or delta with three wires and connected to three of the four phases of the bridge rectifier inputs.  A three-phase generator connected full-wave rectifier has the smoothest output power.  Using Thyristors rather than Triacs (in version -3?) might make this circuit a little cheaper but is a little less efficient.


              A much smaller sized variation of the above design could be developed.   http://www.rotalink.com/ http://www.rotalink.com/our-products/10/ac-motors-optional-gearboxes.html make geared motors with strong ball-bearing bearings.  For example;

              • 4116 synchronous motor (48V or 24V) + 227 gearbox (25:2) with ball bearings.
              • SB2513 bipolar 24V stepper motor + 222 gearbox (~7:1) with ball bearings.

              The bearing is strong enough to stand having a pendulum and weight fitted to create up to say 1W.


              A lower power, power supply based on a higher voltage say 24V 48V  motor based on the circuit AL0002-01? above may be suitable using a low power switch mode power supply. Power factor correction would be an unnecessary complication in this case but is not required with a multi-phase generator anyway.

              • 60V input, 50mA output switch mode power supply such as ADP2360 may be suitable?
              • L7983, 300mA output switch mode power supply 4-60Vin, 2.3 µA shutdown current.
              • LMR36506 ti.com; 600mA output switch mode power supply 3-65Vin, 2.3 µA shutdown current. 
              --------------------------------------------------------------------------------------------

              Final note;
              I use spell checkers, grammar checkers and the web browser to check the spelling.  Grammar checkers vary in usefulness Grammatic 5 was very good over 30 years ago and Grammarly is a good one just now.  I use the free version of Grammarly which works on many but not all combinations of web browsers and wiki websites;  https://www.grammarly.com/  My grammar and spelling readability have improved but creating and refining a blog is very a slow process.  I similarly find embedded programming a chore moving from assembler to writing in C and using pclint (lint tools) helped but I stopped doing that over a decade ago. 

              IF A=B THEN /* Is bad programming because is cluttered, ambiguous and wrong in C */

              if  (A == B) 
                  ; /* condition true but lint would give fewer warnings */ 
              else
                  A = B;