While reading about motor drivers I'm getting somewhat confused on how commercial stepper motor driver actually work to regulate power going into motor windings.
Here's a few things that seems clear to me. H-Bridge drivers like l293d, l298 and others are constant voltage drivers in a way that if the motor try to pull 4 amps at 12v it will probably burn quickly those drivers.
A chopper driver should be able to keep a constant current to the motor. So if we use a 1.7A motor, the driver will regulate the voltage to the current is always around 1.7A.
I've read that one way to regulate the current would be to PWM the windings to regulate the voltage. I imagine a constant voltage power source of 50v could be regulated to 25v on average. Here I also read that the length of the PWM might matter so the motor doesn't flicker too much.
From what I understand, PWM is simply burst of 50v for a short period of time.
Now the thing I'm not sure is how the current is then regulated with PWM. If the voltage is sensed on an average. It might seem logical that Amps are also sensed as an average.
In other word, if a motor is pulling 6A but the motor if fed with a duty cycle of 50% we'd sense 3A.
Taking the l298 datasheet we can read this for the max current:
Peak Output Current (each Channel)
- Non Repetitive (t = 100μs) 3A
- Repetitive (80% on –20% off; t on = 10ms) 2.5A
- DC Operation 2A
From my understanding, the shorter the burst are, the more amp we can feed into the the driver. So if we were to configure PWM for 100μs we could at most 3A. In other words, we could have burst of 6A with a duty cycle between 0-50% on a 200μs cycle and not break the l298 chip.
Now if this is right, we have to put some sensing device at the output to measure how much current is consumed by the circuit. When the current is measured, we can adjust the duty cycle of our PWM to fit the constrains we chose.
So how risky this constant current power source is is how fast you can regulate the PWM to not burn anything. If we can only sense current at 300us this could leave a 100us at which the current could too high. It's probably a good thing to keep a good margin to prevent disaster if the PWM adjustment aren't reactive enough.
In short, this is just the basic Ohm law at play. As the motor resistance may change on load and that we fix the current to I. We have to compute the voltage for a fixed R and I. So all we have to do is sense the resistance of the motor. For example, if the motor with no load had 4.5ohm, the voltage should be set at 7.65V for a 1.7A current but if the load increase the resistance, to say 10ohm the voltage could be set to 17V and then for a resistance of 50ohm it could be set to 85V.