Spice code for dynamo output?

BobRoss

Newly Enlightened
Joined
Jan 13, 2013
Messages
31
Has anybody written any Spice code to simulate a dynamo output that seems to work well (and that you are willing to share)? I'm trying to pick up Spice and have plenty of coding experience, but limited EE experience, so a minimal working example with a dynamo output, rectifier and LED would be nice to have.
 

Steve K

Flashlight Enthusiast
Joined
Jun 10, 2002
Messages
2,786
Location
Peoria, IL
I've used LT Spice to run some simulations to debug a bike light circuit. The model is based on experimental data, as are most models. Here's the spice circuit:
http://www.flickr.com/photos/kurtsj00/8480800746/in/photostream

and here's the raw test data, obtained from Nick Ray from the old BikeCurrent list...
http://www.flickr.com/photos/kurtsj00/6104886750/in/set-72157617009273346

This is my bike light project that I used the simulation for....
http://www.flickr.com/photos/kurtsj00/sets/72157621965148305/
It also has a photo of the hardware simulator I made for Schmidt hub dynamo... a sine wave generator, an amplifier, resistor, and a big coil that I pulled out of a shaded pole motor that just happened to be the right value of inductance.

Of course.... a different dynamo will have somewhat different component values.
 

ianfield

Newly Enlightened
Joined
Jan 7, 2012
Messages
97
I've used LT Spice to run some simulations to debug a bike light circuit. The model is based on experimental data, as are most models. Here's the spice circuit:
http://www.flickr.com/photos/kurtsj00/8480800746/in/photostream

and here's the raw test data, obtained from Nick Ray from the old BikeCurrent list...
http://www.flickr.com/photos/kurtsj00/6104886750/in/set-72157617009273346

This is my bike light project that I used the simulation for....
http://www.flickr.com/photos/kurtsj00/sets/72157621965148305/
It also has a photo of the hardware simulator I made for Schmidt hub dynamo... a sine wave generator, an amplifier, resistor, and a big coil that I pulled out of a shaded pole motor that just happened to be the right value of inductance.

Of course.... a different dynamo will have somewhat different component values.

Do you have any curves for dynamos (spice or otherwise)?

I have a theory that applies to Sturmey-Archer hubs which are designed to regulate into filament bulbs without blowing them as speed picks up.

According to my theory; if the current draw is backed off, the voltage will rise in greater proportion - to accomplish this, a buck converted can be used to step down the increased voltage while drawing lower current, simple math would then indicate an increased power output.

Using this arrangement to charge a 6V 1.2Ah SLA would certainly power lights constructed with strings of ordinary wire ended LEDs - and probably a 3W star for worthwhile periods of time, for navigating unlit cycleways.
 

Steve K

Flashlight Enthusiast
Joined
Jun 10, 2002
Messages
2,786
Location
Peoria, IL
Do you have any curves for dynamos (spice or otherwise)?

I have a theory that applies to Sturmey-Archer hubs which are designed to regulate into filament bulbs without blowing them as speed picks up.

According to my theory; if the current draw is backed off, the voltage will rise in greater proportion - to accomplish this, a buck converted can be used to step down the increased voltage while drawing lower current, simple math would then indicate an increased power output.

Both my raw data and the spice model show that when less current is drawn (i.e. a higher resistance load is used) the dynamo output voltage increases. The is what allows a dynamo system to extract more power by adding a second headlight in series (with certain limitations). This is a very well established idea and does work. A switching converter is another way to modify the resistance seen by the dynamo, and has the advantage of not having to add a second bulb or LED (as well as another optic).
 

ianfield

Newly Enlightened
Joined
Jan 7, 2012
Messages
97
Both my raw data and the spice model show that when less current is drawn (i.e. a higher resistance load is used) the dynamo output voltage increases. The is what allows a dynamo system to extract more power by adding a second headlight in series (with certain limitations). This is a very well established idea and does work. A switching converter is another way to modify the resistance seen by the dynamo, and has the advantage of not having to add a second bulb or LED (as well as another optic).

At some point I'd like to sit down and devise a buck specifically for this purpose, the project is on the back-burner ATM while I attend to something else - but in the meantime, I'm on the lookout for any dynamo data that might be out there.
 

BobRoss

Newly Enlightened
Joined
Jan 13, 2013
Messages
31
I found this from http://www.electronics-related.com/usenet/design/show/304923-1.php

I'm not sure how to evaluate whether or not this is a nice approximation.


****************************************************************************

************ Hub Dynamo Subcircuit by Jim Thompson 2011_01_11**************
*** KUQRMS = Voltage Coefficient RMS at 1 KM/H
*** RPS1KMPH = Revolutions per second at 1 KM/H
*** LI = Internal Inductance
*** RFE = Iron Loss Equivalent Resistance
*** RI = Internal Series Resistance
*** POLES = Number of Dynamo Poles
*** Node KMPH = Voltage Input at desired KM/H.
SUBCKT HubDynamo KMPH OUTPUT COM PARAMS: KUQRMS=1 RPS1KMPH=0.139
LI=107.6mH
+ RFE=76.581 RI=7.3633 POLES=28.PARAM RT2=1.414214
L_LI VUQ N_1 {LI}
R_RI N_1 OUTPUT {RI}
RNOFLOAT1 KMPH 0 1G E_E1 VUQ COM VALUE {
+ KUQRMS*V(KMPH,0)*RT2*SIN(pi*V(KMPH,0)*RPS1KMPH*POLES*TIME) }
R_RFE N_1 COM {RFE}
.ENDS HubDynamo
****************************************************************************
 

ianfield

Newly Enlightened
Joined
Jan 7, 2012
Messages
97
I found this from http://www.electronics-related.com/usenet/design/show/304923-1.php

I'm not sure how to evaluate whether or not this is a nice approximation.


****************************************************************************

************ Hub Dynamo Subcircuit by Jim Thompson 2011_01_11**************
*** KUQRMS = Voltage Coefficient RMS at 1 KM/H
*** RPS1KMPH = Revolutions per second at 1 KM/H
*** LI = Internal Inductance
*** RFE = Iron Loss Equivalent Resistance
*** RI = Internal Series Resistance
*** POLES = Number of Dynamo Poles
*** Node KMPH = Voltage Input at desired KM/H.
SUBCKT HubDynamo KMPH OUTPUT COM PARAMS: KUQRMS=1 RPS1KMPH=0.139
LI=107.6mH
+ RFE=76.581 RI=7.3633 POLES=28.PARAM RT2=1.414214
L_LI VUQ N_1 {LI}
R_RI N_1 OUTPUT {RI}
RNOFLOAT1 KMPH 0 1G E_E1 VUQ COM VALUE {
+ KUQRMS*V(KMPH,0)*RT2*SIN(pi*V(KMPH,0)*RPS1KMPH*POLES*TIME) }
R_RFE N_1 COM {RFE}
.ENDS HubDynamo
****************************************************************************

Thanks - looks like there's some useful follow up comments on that page, so I did a CutePDF dump of the page.
 

Steve K

Flashlight Enthusiast
Joined
Jun 10, 2002
Messages
2,786
Location
Peoria, IL
I found this from http://www.electronics-related.com/usenet/design/show/304923-1.php

I'm not sure how to evaluate whether or not this is a nice approximation.


I see two options:

1. find the person who developed the model, and ask them if it is a good model for your hub dynamo, or whatever dynamo you are trying to model.

2. measure the characteristics of your desired hub dynamo, and compare them to the model.

A secondary issue is: what are you trying to do with the model, and does this model have enough (or too much) complexity and detail?
 

BobRoss

Newly Enlightened
Joined
Jan 13, 2013
Messages
31
A secondary issue is: what are you trying to do with the model, and does this model have enough (or too much) complexity and detail?


I think this is an issue that comes up a lot - modeling components without having to test them out. For example, with Martin's circuits (http://www.pilom.com/BicycleElectronics/DynamoCircuits.htm), I've seen a few people ask about how to find tuning capacitor values without trying every capacitor they can get their hands on. It would be nice to have a general model that approximates all dynamos (where a given dynamo can be well approximated with some specific values that can be set by the user). That way, the guess work doesn't require having the components on hand to switch in and out.

The model I showed earlier has dynamo output as a function of speed, which I think would be really handy.
 

Steve K

Flashlight Enthusiast
Joined
Jun 10, 2002
Messages
2,786
Location
Peoria, IL
so what do you want to do with the model???

Having spent a lot of time with spice, I can tell you that models are usually based on actual devices and it's usually necessary to keep the model as simple as possible in order to get the simulation to work (mostly when doing a transient analysis).

As far as a general model, the only real difference is the component values. Making the open circuit voltage change with speed is simple enough, but the important part is knowing what the coefficient is. As any text on generators or rotating machinery will tell you, the open circuit voltage is directly proportional to speed. Spice is a handy tool, but it's just a tool. Without the knowledge of the underlying physics, and the ability to either generate or validate a model, Spice isn't that useful. If you just want to fiddle around with Spice, that's fine, but be prepared to hit a wall now and then. It's a standard part of getting a design to work, and knowledge of the fundamentals is very useful.
 

BobRoss

Newly Enlightened
Joined
Jan 13, 2013
Messages
31
so what do you want to do with the model???

Having spent a lot of time with spice, I can tell you that models are usually based on actual devices and it's usually necessary to keep the model as simple as possible in order to get the simulation to work (mostly when doing a transient analysis).

As far as a general model, the only real difference is the component values. Making the open circuit voltage change with speed is simple enough, but the important part is knowing what the coefficient is. As any text on generators or rotating machinery will tell you, the open circuit voltage is directly proportional to speed. Spice is a handy tool, but it's just a tool. Without the knowledge of the underlying physics, and the ability to either generate or validate a model, Spice isn't that useful. If you just want to fiddle around with Spice, that's fine, but be prepared to hit a wall now and then. It's a standard part of getting a design to work, and knowledge of the fundamentals is very useful.

My experience with other programming is a little different - I'm thinking of Spice as a learning tool as well as a validation tool. I've already hit a few walls... That said, it's much easier to swap capacitor in a spice model than it is to accurately model the dynamo.

My current problem is figuring out an ideal way to use a 555 timer (for which there are spice templates available) with a blinky rear light, given the limited materials I have. I've been playing around with it, and I found that, when I put an electrolytic capacitor in parallel with the 555, that it starts blinking appropriately at low speeds, using the bottle dynamo I have sitting at my desk. Before I did that, the 555 timer didn't really seem to do anything when running the circuit off of a dynamo. I imagine that is because the pulsed DC coming out of the rectifier doesn't play well with the 555, but I don't have any way to know that (that I know of). I do enjoy figuring these things out, rather than always bothering all of you geniuses on CPF to come up with a solution for me.

Of course, this is a completely back-a**wards way of going about things, but I never really learned the theory, so I don't have much of a knowledge base from which to validate a model of my dynamo. I'm also looking for a spice template that directly relates to circuits I (more or less) understand, which is limited to simple LED bike lights, at the moment. I think you may be underestimating my ignorance.

It's good to know that you have had troubles with Spice, too... I'm not used to programs that require so much coaxing to behave.
 

Steve K

Flashlight Enthusiast
Joined
Jun 10, 2002
Messages
2,786
Location
Peoria, IL
Spice is very useful when trying out different component values as long as it would be hard to change the physical capacitor. It's also useful when you can't get your hands on the actual hardware. When I had to design a peak power tracker (or "maximum power point tracker") for a 3000 watt solar panel, it was a lot more practical to come up with a model for the panel than to use an actual panel and control the sun hitting it. It helped that I had plenty of solar panel data to generate a model from.

In general, though, it's better to have actual hardware than a spice model. The actual hardware will always behave correctly, whereas Spice can veer off into the weeds or come to a screeching halt (or just not start). An intermediate solution is to create a hardware model, like I did with a sine wave generator, a power amplifier, and a large resistor and large inductor to simulate the dynamo's internal impedances. A lot of people have had good luck with just using an electric drill to drive their dynamo.
 

Steve K

Flashlight Enthusiast
Joined
Jun 10, 2002
Messages
2,786
Location
Peoria, IL
I stumbled across a nice long tutorial on using LTSpice:

http://www.ieca-inc.com/images/Spice-Simulation_Using_LTspice_Part_1.pdf

On the section for DC-DC switching converters, they do include this caution:

These circuits use complex simulations and realistic inductance properties because an oversimplified inductor
model will cause errors or simulation aborts in many applications. Very expensive simulation software versions
use special (and secret) tools to avoid these problems, but we have only the normal Berkeley SPICE kernel......
With the following rules you can avoid most of these problems:
a) Never use an ideal inductance -- always add a series resistor (even 0.01 can do the job!).
b) Every inductor has a winding capacitance, and often the circuit has additional stray capacitance. This
always gives resonance effects with (sometimes) unexpected results and problems during the
simulation. So use damping resistors or long simulation times to get correct simulation results.
 

ianfield

Newly Enlightened
Joined
Jan 7, 2012
Messages
97
I think this is an issue that comes up a lot - modeling components without having to test them out. For example, with Martin's circuits (http://www.pilom.com/BicycleElectronics/DynamoCircuits.htm), I've seen a few people ask about how to find tuning capacitor values without trying every capacitor they can get their hands on. It would be nice to have a general model that approximates all dynamos (where a given dynamo can be well approximated with some specific values that can be set by the user). That way, the guess work doesn't require having the components on hand to switch in and out.

The model I showed earlier has dynamo output as a function of speed, which I think would be really handy.

In the case of Sturmey-Archer (& probably others) speed is largely irrelevant once over that required for rated output (actually not very fast at all) - The coil has inductance; l and inductive reactance; Xl, which iincreases with the rotational speed/frequency of the AC. This is a part of the inbuilt regulation that prevents bulbs blowing when you pedal like the clappers down a steep hill.
 

ianfield

Newly Enlightened
Joined
Jan 7, 2012
Messages
97
My experience with other programming is a little different - I'm thinking of Spice as a learning tool as well as a validation tool. I've already hit a few walls... That said, it's much easier to swap capacitor in a spice model than it is to accurately model the dynamo.

My current problem is figuring out an ideal way to use a 555 timer (for which there are spice templates available) with a blinky rear light, given the limited materials I have. I've been playing around with it, and I found that, when I put an electrolytic capacitor in parallel with the 555, that it starts blinking appropriately at low speeds, using the bottle dynamo I have sitting at my desk. Before I did that, the 555 timer didn't really seem to do anything when running the circuit off of a dynamo. I imagine that is because the pulsed DC coming out of the rectifier doesn't play well with the 555, but I don't have any way to know that (that I know of). I do enjoy figuring these things out, rather than always bothering all of you geniuses on CPF to come up with a solution for me.

Of course, this is a completely back-a**wards way of going about things, but I never really learned the theory, so I don't have much of a knowledge base from which to validate a model of my dynamo. I'm also looking for a spice template that directly relates to circuits I (more or less) understand, which is limited to simple LED bike lights, at the moment. I think you may be underestimating my ignorance.

It's good to know that you have had troubles with Spice, too... I'm not used to programs that require so much coaxing to behave.

I do hope you're using some form of regulation between your bottle dynamo & the 555!

AFAICR those are the worst offenders for outrageous off load output voltage - bear in mind if you use a series type regulator, those dynamos can easily top 200V.

Usually the best bet is a shunt regulator, forget 400mW zeners - they won't handle it! You might get away with a TL431 programmable zener - they can handle 100mA, but you'll most likely need to buffer it with a power transistor.

The MAX Vcc for a 555 varies with manufacturer, between 16 - 18V - there's a funny story though; I once stuck a MOSFET on the output of a 555 to drive a flyback/boost inductor/diode to boost its own Vcc just to see how much I could get from 5V. When I measured it, the Vcc pin had risen to about 30V - and the 555 didn't blow.

It was a Hitachi part BTW.
 

BobRoss

Newly Enlightened
Joined
Jan 13, 2013
Messages
31
In the case of Sturmey-Archer (& probably others) speed is largely irrelevant once over that required for rated output (actually not very fast at all) - The coil has inductance; l and inductive reactance; Xl, which iincreases with the rotational speed/frequency of the AC. This is a part of the inbuilt regulation that prevents bulbs blowing when you pedal like the clappers down a steep hill.

I'd like to eventually build a mountain bike wheel with a dynamo hub, in which case the speed is very relevant. For my current use (on the road, commuting), it's not really all that important.
 

BobRoss

Newly Enlightened
Joined
Jan 13, 2013
Messages
31
I do hope you're using some form of regulation between your bottle dynamo & the 555!

AFAICR those are the worst offenders for outrageous off load output voltage - bear in mind if you use a series type regulator, those dynamos can easily top 200V.

Usually the best bet is a shunt regulator, forget 400mW zeners - they won't handle it! You might get away with a TL431 programmable zener - they can handle 100mA, but you'll most likely need to buffer it with a power transistor.

The MAX Vcc for a 555 varies with manufacturer, between 16 - 18V - there's a funny story though; I once stuck a MOSFET on the output of a 555 to drive a flyback/boost inductor/diode to boost its own Vcc just to see how much I could get from 5V. When I measured it, the Vcc pin had risen to about 30V - and the 555 didn't blow.

It was a Hitachi part BTW.

I have 2 white LEDs in parallel (because that's what I had sitting around) with the 555-> MOSFET -> 2 red LED circuit, which limits the VCC to ~ 6-7V. That way, I get something out of the voltage regulation. It seems to work pretty well at low speeds, but i haven't done any testing other than hand spinning a wheel with a bottle dynamo. I'll eventually replace the 2 white LEDs with a couple series of surface mount LEDs that will blink to the sides of the bike. The next step will be to include a switch that bypasses the 555 so that I don't strobe my riding buddies into seizures.

The basic circuit has two white LEDs in series with the (555+2red)|2white circuit. The two series LEDs don't blink, while the rest do. I'll post a circuit diagram once I think I've prototyped something feasible, just to see if there are obvious flaws that more experienced CPFrs can identify.
 

BobRoss

Newly Enlightened
Joined
Jan 13, 2013
Messages
31
I stumbled across a nice long tutorial on using LTSpice:

http://www.ieca-inc.com/images/Spice-Simulation_Using_LTspice_Part_1.pdf

On the section for DC-DC switching converters, they do include this caution:

These circuits use complex simulations and realistic inductance properties because an oversimplified inductor
model will cause errors or simulation aborts in many applications. Very expensive simulation software versions
use special (and secret) tools to avoid these problems, but we have only the normal Berkeley SPICE kernel......
With the following rules you can avoid most of these problems:
a) Never use an ideal inductance -- always add a series resistor (even 0.01 can do the job!).
b) Every inductor has a winding capacitance, and often the circuit has additional stray capacitance. This
always gives resonance effects with (sometimes) unexpected results and problems during the
simulation. So use damping resistors or long simulation times to get correct simulation results.

That looks like an excellent resource. Thank you!
 
Top