Welcome! Log In Create A New Profile

Advanced

Flyback diodes

Posted by Anonymous User 
Anonymous User
Flyback diodes
July 11, 2007 03:21PM
I've been reading through a lot of app notes trying to come up to speed on stepper motor driving, and I've noticed quite a few of them mention that when you're doing high-speed switching, you should use "fast" diodes. I think we're PWMing the stepper at around 14kHz, but we're using 1N4005 diodes which have a relatively slow Trr (somewhere between 1us and 30us, depending on who you ask). Looks like the obvious replacement would be an UF4005, which is in the neighborhood of 50ns. Mouser lists them at $0.12 each.

I don't know if this is worth worrying about or not, but I figured I'd throw it out there...
Anonymous User
Re: Flyback diodes
July 11, 2007 03:52PM
That's one reason to use mosfets. They have the diodes built in. And when using integrated drivers you get smart current decay and synchronous rectification which eliminates even more heat from the mosfets. Look at the A3959 from Allegro for details.

--Blerik

(And yes, I keep fanboying the Allegro products because they are the most advanced out there at the moment...)
Re: Flyback diodes
July 11, 2007 03:55PM
Yep, Allegro has some great stepper controllers out there. The buggers are all surface mount, though and tiny as well. They can handle huge amperages, but they also demand pretty much industrial levels of accuracy in putting them onto a circuit board. eye popping smiley
Re: Flyback diodes
July 11, 2007 04:39PM
Yes I noted the diodes should really be fast recovery in my blog. I used some I recovered from a blown up PC power supply on my machine. I quickly recovered 8 fast recovery rectifiers from it winking smiley but that would only do one RepRap board I think.

Yes all new interesting devices are surface mount and the trend is to not even have legs, e.g BGA, QFN and DFN. If RepRap is not to be left behind on the electronics front I think a means of constructing SMT circuits is a priority. More important than trying to synthesis our own components for example. Those PMOS FETs with a negative supply rail that were discussed the other day remind me of the technology level around the time I built my first computer in the late seventies. It would be neat to be able to make our components but I don't think they will measure up performance wise to modern components which are after all incredibly cheap when bought in volume.


[www.hydraraptor.blogspot.com]
Anonymous User
Re: Flyback diodes
July 11, 2007 04:57PM
I agree! Not going SMT is going the way of the dodo. Through hole components are very quickly dying away everywhere.

SMT components are not that difficult really, it's just the IC's that are hard. But with a good PCB with solder resist and some solder paste and a hot skillet they are manageable. They practically solder themselves. Or get the QFN parts and a QFN through-hole socket (only works for mosfet drivers though, with the built-in drivers you'll melt the socket).

And SMT passives are easier than their though-hole cousins (not the 0402s obviously, try some 0805s first). No clipping of wires, no messing with multilegged components that just won't fit through the holes, just some flux paste to glue them to the board temporarily, and a normal soldering iron and solder.

--Blerik
Re: Flyback diodes
July 11, 2007 05:31PM
Okay first on switching resolution and the flyback diodes:

I think we should make the physical resolution as high as possible. As we progress, it will be important that we can extrude with high resolutions (first millimeters, then micrometers), and this is partly dependent on the capabilities of the electronics and motors.

Regarding emf's suggestion: Can UF4005 be used as a "drop in" replacement? If so , this would be a great idea because we are increasing Trr by 10^3, which is fantastic improvement!

And regarding SMT:

[en.wikipedia.org]

What are the preferred methods of mounting DIY SMT components? blerik says "solder paste + hot skillet" ... are there other methods? Can we get SMT boards from China?

-savecore
Anonymous User
Re: Flyback diodes
July 11, 2007 05:59PM
The advantage of using solder paste is that you could use a reprap to put it on the boards. Then use a pair of tweezers to put the components on top of that, put the PCB in the hot skillet for a minute and you're done. No soldering skills required. The disadvantage of solder paste is that it is very expensive. $2 per gram or so (although a gram goes a long way, plenty for one board for instance).

There are lots of other ways to do SMT as well. Using a traditional soldering iron and resin core solder work too. Put some solder on the pads, then use a pair of tweezers with the soldering iron to tack the component to the pad.

The boards the rrrf is getting from china have silkscreening and a solder resist layer. There should be no problems at all getting SMT boards from there. Might be cheaper even because of the lack of holes.

And SMT helps with DIY boardmaking as well. Jumpers and vias are a pain to do, but with SMT you can use the special 0 ohm resistors as jumpers. You can easily fit 2 or 3 traces under a 1206 jumper. This allows for easier to make single sided boards (both the boardmaking and the populating is easier).

--Blerik
Re: Flyback diodes
July 11, 2007 06:35PM
OKay, great, thanks for the details!
Anonymous User
Re: Flyback diodes
July 11, 2007 08:23PM
nophead Wrote:
-------------------------------------------------------
> Yes I noted the diodes should really be fast
> recovery in my blog. I used some I recovered from
> a blown up PC power supply on my machine. I
> quickly recovered 8 fast recovery rectifiers from
> it winking smiley but that would only do one RepRap board I
> think.

Thanks for the pointer. I still haven't made it through everyone's blogs, but there's a lot of good stuff in them.

savecore Wrote:
-------------------------------------------------------
> Regarding emf's suggestion: Can UF4005 be used as a
> "drop in" replacement? If so , this would be a great
> idea because we are increasing Trr by 10^3, which is
> fantastic improvement!

They should be drop-in replacements, it's available in the same DO-41 package as the 1N4005 uses.
Anonymous User
Re: Flyback diodes
July 11, 2007 09:37PM
Here is a link to a method of home brew smt soldering. it is the toaster oven method.

[www.seattlerobotics.org]

Best,
Dan
Re: Flyback diodes
July 11, 2007 10:21PM
Okay, thanks

I'm gonna drop the UF4005 into my Reprap PCBs. Oh UF4005 !!, you are the Cadillac of diodes...
Re: Flyback diodes
July 12, 2007 12:11AM
Cadillac? Big, expensive and poor handling? Porsche of diodes, maybe? :-)

If someone could record a 'scope trace of the waveforms using a UCB with 1N4005 dioes and one with UF4005s, it might be interesting to "see" what difference they make with the current firmware, the currently recommended stepper (or a cheaper one!) and the L298N.

It's not clear to me from the above discussion if UF4005s are only of value with higher frequency PWM driving of the motors than the current setup uses, or whether they would make a real life difference if used as a drop in in a current "officially recommended" Darwin setup. Does anyone know for sure?

Jonathan
Anonymous User
Re: Flyback diodes
July 12, 2007 05:36AM
They are just free wheeling diodes to protect the Bridges from kickback, (VL=-Ldi/dt) from the stepper coils. Besides, as speed increases, current and torque drop off because of the 5 time constants to reach full current, that is you limiting factor. Adding resistance helps, (Lt/R) but only if you can raise the voltage to compensate for Vr=IR. Brushless Dc have come a long way and this is the technology for the next version. Combined with optical encoders for repeatable accuracy, every time. You should be getting the motor today. I didn't insure it, even the post office couldn't damage it unless they really tried hard and there Government, so you don't have to worry about that!It is in a 1-800 pets box and I sent it by Priority mail through the post office
Re: Flyback diodes
July 12, 2007 08:38AM
The 1N4005s obviously work as people are succesfully using them. As the only high speed switching is PWM to control the torque I expect the only effect is increased switching losses leading to slightly hotter components.

These drives are certainly not optimised for speed, but with belt drive that probably isn't necessary. For high speed running needed for screw drive then you would use low voltage / low inductance motors, a high drive voltage and constant current chopper drives. In that case I think the speed of the diodes may affect high speed running.


[www.hydraraptor.blogspot.com]
Anonymous User
Re: Flyback diodes
July 12, 2007 10:30AM
nophead Wrote:
-------------------------------------------------------
> The 1N4005s obviously work as people are
> succesfully using them. As the only high speed
> switching is PWM to control the torque I expect
> the only effect is increased switching losses
> leading to slightly hotter components.

I'm still not sure I really understand this stuff, but that's the impression I've been getting too. The slow diodes seem to work fine, it just looks like we're going against conventional wisdom by using them.

Here's my electronics newbie understanding of what's going on, tell me if I'm on the right track (and try not to laugh too hard): say we have the torque setting at 65%. This means we're driving the motor with a 14kHz PWM at a 65% duty cycle (that's the number I'm using on my non-standard motor), which is roughly 45us on, 25us off. During the off period, the motor's winding is generating a high voltage, and the diodes are conducting this back to the power supply like they should. At the instant we switch to the "on" part of the PWM cycle, these diodes are still conducting, so they're effectively acting as a short between 12V and GND. It takes them a certain time, trr, to switch between acting as a conductor and blocking current like you want it to. During the time the diode is conducting current, it's generating heat and sucking all or part of the current you were trying to get into the motor's winding.

If the reverse recovery time for the 1N4005 is on the higher end of the numbers I've seen, say, 20us, this sounds pretty significant. That would mean that for almost half of the 45us of the PWM's on cycle, the diode is stealing some of the motors current. If trr is on the lower end, it's probably fairly insignificant in the 2-4% range.

Edited 1 time(s). Last edit at 07/12/2007 10:30AM by emf.
Re: Flyback diodes
July 12, 2007 01:23PM
interesting. i think i'll order some of these diodes, solder up a universal board with them, and then give them a try. if they drive the motor smoother, or better in some way, then its definitely a good idea to switch to them.

i really think this open source engineering stuff is great!
Anonymous User
Re: Flyback diodes
July 12, 2007 07:34PM
I=(1-exp(-Lt/R))V/R at t=0, I=0 Time Constant= Tau=L/R, at 5XTau exp()=0 and I=I
If the switching frequency is higher than 5Xtau, it never reaches full current and torque drops off. The faster it is switched, the lower the Imax becomes until it stalls. If you increase the R, reducing the time constant BUT Lowering Imax for a given voltage. Thus V and R must be increased to increase speed. This is off course, wasteful
Anonymous User
Re: Flyback diodes
July 13, 2007 01:18AM
OK, I need a translation into layman's terminology... I am currently running my steppers at a speed setting of 243 in the preferences - if I go a few points higher, the motors just buzz instead of turning, and at my current speeds, I get occasional skipping, and the torque is pretty weak. If I were to swap out my current diodes for the UF4005s, what would be the chances of increasing my torque at the current speed, and perhaps being able to run at higher speeds with more turning and less buzzing? Hopefully if those that know the formulae involved don't know the frequency of the signals at speed setting 240+, those that know the software/hardware can pitch in with the frequency for a collaborative reply. smiling smiley
Anonymous User
Re: Flyback diodes
July 13, 2007 02:58AM
We were discussing this on IRC the other day, so I've got some numbers handy to fill in the details. But I think it's safe to say the diodes aren't your problem. If your torque setting is at 100%, you won't be getting the constant 14kHz switching, the diodes will only be working at the much slower rate of normal stepping.

The motor is a Sherline's NMB model. From the datasheet, it's a 6-wire unipolar deal, rated at 3.2V, 2A, 1.6 ohm, 3.6mH, 9.7kg-cm. Eric has it wired bipolar-serial, with 1.8 ohm current-limiting resistors. The datasheet doesn't list ratings for bipolar operation, so my guess is it would look something like 4.5V, 1.4A, 3.2 ohm, 14.4mH.

When I tried to figure out what speed = 243 corresponds to, I wound up with something a bit less than 325 steps/sec. That would be around 2mm/sec, is that in the right ballpark?

The thing that jumps out at you is the L/R time constant is 4.5ms, or 1/222 sec. That's gonna make it pretty hard to get any torque at high speeds. You're driving it at a voltage a bit above its rating (6.4ish? my brain is getting slow) so that helps develop some torque, but not enough to get any real speed out of it.

Some ideas, half-baked or otherwise:
- drive in high torque mode. Each phase will have twice as long to build up some measurable current. And it'll keep your house warm in the winter.
- get rid of those resistors. it won't help much, but it's something. hack the firmware to drop the torque setting when the motor is standing still to prevent meltdown
- try driving just half the coil bipolar. This should let you go a lot faster, but I don't know what it will do to your torque.
- switch to a 24V supply :-)
Re: Flyback diodes
July 13, 2007 05:00AM
emf,
I had a hand in calculating Eric's series resistors. I didn't realise they were six lead motors. The resistors are correct for 2A into 1.6R from 7V (the drive chip loses around 5V at 2A). If they are six lead motrs then Eric should be using one end and the centre tap.

Eric,
If you are using the two end connections of each coil switching to using the centre taps will reduce the inductance by 4 giving you higher speed running. The current with the two coils in series and the 1.8R resistor will be a about 1.6A. Swiching to using half the coil will up the current to 2A but halve the number of turns so low speed torque will be less: 2/1.6 * 0.5.

Also, since we now know the PWM rate is much faster than the motor time constant you could dispense with the resistors as long as you don't set the PWM duty cycle too high.


[www.hydraraptor.blogspot.com]
Anonymous User
Re: Flyback diodes
July 13, 2007 11:06AM
Yes, 2mm/sec seems about right.

OK, lemme see if I got this right:
The torque setting in the software is roughly a PWM setting, is that correct? So by saying 'don't set the PWM duty cycle too high', you mean keep the torque setting in the preferences low? If so, if i set it too high I get excessive heat, right?

As for the coil connections, let's say A, B, and C are the coil connectors, and B is the center tap. I am currently using A and C, and ignoring B - you're saying that by using A and B instead, I can switch faster? How will that affect my torque?

As it stands right now, I can't go any faster because the Y axis starts skipping (apparently not enough torque), and I can't go any slower because if I run the extruder any slower it will stall, so I need to make sure I understand what's going on before I make any changes. smiling smiley

Thanks for the help guys.
Anonymous User
Re: Flyback diodes
July 13, 2007 11:49AM
It take 5 time constants to build up current. If you are switching the coil on and then off before the 5 tau, only part of the max current is flowing, thus the mag field strength is lower and no torque! Example R=10 ohms L= 50milihenries so 0.05/10= 0.005 or 500 microseconds 5X is 2.5miliseconds say that switching speed the coil was on for 10 microsecond or 1/50 tau 1-exp(-1/50)= 0.02 or 2% of the max current, thus a weak mag field The PWM applies to the bridges, controls the time the bridges are on juicing a coil. Switching speed controls speed, but magnetic field strength controls torque. As you switch faster, your coils are fully saturated with current and magnetic field strength is proportional to current.
Anonymous User
Re: Flyback diodes
July 13, 2007 12:05PM
So since the full coil takes too long to fully 'power up', I'm only getting a fraction of the torque out of it, but if I use a half coil instead I will get more resultant torque even with less windings, since the half coil will come up to 'full power' more quickly?
Re: Flyback diodes
July 13, 2007 12:35PM
Eric,
Yes the current will build up 4 times quicker and to a higher value, 2A instead of 1.6A, but you have half as many turns so the final steady state torque is lower. However, once you get to a speed where the rise time is the limiting factor you will gain torque. If you can step slowly without skipping then you have enough torque to overcome the friction. If you can't go faster its because the torque is falling off with speed.

Alternatively you could leave the coils in series and remove the resistors. The current at full PWM duty cycle would then be 7V/(1.6R+1.6R) = 2.2A. As emf said the max current for the motor is likely to be 1.4A in this mode. This is because the heating effect is proportional to I^2 * R. R is double so I reduces by root 2 to get the same heat. So I would guess you should not increase the torque setting above 70% in this mode.

I think the first alternative will probably work best.


[www.hydraraptor.blogspot.com]
Anonymous User
Re: Flyback diodes
July 13, 2007 03:00PM
I really enjoy the crazy character on the helping hands, looks like he just got a prostate exam! Where did you get him? Tell him that jacking the voltage up and adding resistance to reduce the Tau will help, but it is wasteful. Magnetic field is proportional to the square of the flux links (current coils) so using the full coil gives the max torque.
Anonymous User
Re: Flyback diodes
July 13, 2007 03:27PM
So long as you're willing to live dangerously, why not do both. Chuck the resistors and switch to half a coil. You'll be targeting 2A, 100% torque would give you 4.3A with a side order of smoke, so I think you'd want to be in the neighborhood of 45% torque max. Putting a 2A slow-blow fuse inline with each phase might give you some comfort while experimenting with settings.

I'm also curious how big a difference it would make if you drove in high torque (two phases energized) mode, I think it would make a noticeable difference.

We might be able to hack the firmware to be a little smarter. I think ideally we want it to blast the motor with 100% duty cycle for a while when you first energize a winding, then fall back to the torque setting you specified once the current has built up. Seems like we could offload enough of the tough work to the PC that the PIC could do the rest.
Re: Flyback diodes
July 13, 2007 03:29PM
I don't know where "Oh no" man came from, it was a present. When he is dropped he says "oh no". Probably a comment on my negativity!

I am pretty sure magnetic flux is proportional to ampere turns, not the square. It is inductance that is a square law on turns.

Yes the full coil gives 1.4 times more static torque for the same heat, assuming that the magnetics don't saturate. They may well do as they are designed for 2A into half the coil. But the half coil has one quarter of the inductance with the same initial voltage across it. dI/dt = V/L so the rise rate is four times faster. Above a certain speed this effect will dominate.

Yes using a resistor is wasteful but with a PC PSU Eric has plenty of power to waste.

The fastest drive would probably be with half the coil, no resistor, and use PWM to keep the current below 2A however this is a bit risky because if the PIC crashed or the PWM current was set too high the drive chip my fry.


[www.hydraraptor.blogspot.com]
Re: Flyback diodes
July 13, 2007 03:47PM
Looks like my post crossed with emf's.

A slow blow 2A fuse is not much good as fuses only blow in a reasonable speed at twice their rated current. It may protect the motor but I doubt it would protect the L298. A quick blow fuse might be more appropriate because the current should never go much above 2A with fast PWM.

I agree using two coils is a good idea. Its only a one line change to the firmware and gets you about 1.4 times more torque. A slight downside is that the resting position of the motor is determined purely by pole piece alignment when one coil is energized, but also depends on the balance between the coils when two are used. We are only talking about fractions of 0.1mm here so I don't think it matters.

Yes the firmware delaying the onset of PWM after each step would be a good idea but people would have to tune it to their motor characteristics. It would then be emulating a constant current chopper drive but would be open loop rather than closed loop.

Switching to a CC chopper chip for the next generation would be a lot better because then a much wider range of motors could be used with just a change of sense resistors.


[www.hydraraptor.blogspot.com]
Anonymous User
Re: Flyback diodes
July 13, 2007 04:23PM
nophead Wrote:
> A slow blow 2A fuse is not much good as fuses only
> blow in a reasonable speed at twice their rated
> current.

Thanks for the correction, I was too lazy to look that up. My second board has resettable fuses on it which have about the same problem. At least they'll prevent a catastrophic meltdown. On the bright side, we know his motor can take a little abuse since we've been over-driving it already :-)

> We are only talking
> about fractions of 0.1mm here so I don't think it
> matters.

Especially for his (and my) threaded-rod based designs. One full step is 0.006mm.

> Yes the firmware delaying the onset of PWM after
> each step would be a good idea but people would
> have to tune it to their motor characteristics.
> It would then be emulating a constant current
> chopper drive but would be open loop rather than
> closed loop.

Right. It might be worth the effort since it looks like people will be using a wide variety of steppers.

> Switching to a CC chopper chip for the next
> generation would be a lot better because then a
> much wider range of motors could be used with just
> a change of sense resistors.

Agreed. I guess we need to get a realistic assessment of whether servo motors will be viable by 2.0 before worrying too much about that.
Anonymous User
Re: Flyback diodes
July 15, 2007 03:07PM
I was just looking at the specs for my motor which gives torque vs speed characteristics for both bipolar and unipolar operation. Up to about 600Hz, the torque is stronger with bipolar (serial) operation, but not by much. After that, unipolar wins hands-down. In bipolar mode, you get about 40 oz-in up to about 400Hz, then it begins dropping off: 28oz-in at 1kHz, 20 at 1.5kHz, 14 at 2kHz, 6 at 3kHz. Unipolar starts at 35oz-in, dropping to 30 at 1kHz, 27 at 2kHz, 20 at 4kHz, 10 at 6kHz.

These numbers assume a 24V constant current driver, I think you would expect the bipolar configuration to have an even smaller range where it was better than unipolar with our 12V source. The electrical characteristics of my motor aren't that different from yours, but mine is smaller and probably weaker. With a constant volatage drive (bipolar serial), it seems to do pretty well in the 600-700Hz range with no load, by 800Hz it starts getting pretty flaky. Looks like I'll be re-wiring my motor in the near future.
Sorry, only registered users may post in this forum.

Click here to login