Hello, all. I'm trying to build my first stepper motor controller and I have two questions. In trying to learn about stepper motors and controllers I read the document AN907 from Microchip among other documents and sites:
In that document the author writes about current limiting a stepper motor that is purposefully driven at a voltage that is higher than its designed voltage in order to get the current up more quickly (overcoming the inductance of the coils) and then using current limiting to prevent the motor from being run at higher than maximum current. Several methods are discussed including PWM and using a current-sense resistor.
I think I understand the reasons why a current-sense resistor is not ideal (cost and heat dissipation). PWM sounds great and I've used a PWM circuit for controlling the speed of a DC motor in the past. However, let's say the motor is rated at 5V and I choose to drive it with 10V so I'd need to limit the duty cycle to 50%, what happens when the winding is first energized? Let's say that I'm using a frequency of 31kHz or so, it seems that, when the winding is first energized, the voltage may need to be applied longer than the 50% pulse to get the current to the maximum the motor is rated at, and then run it at the 50% duty cycle once the current is at the maximum. If you look at the document you will see that Figure 21 shows a longer-than target pulse at the beginning of the power cycle and then short pulses (lower duty cycle) to maintain the target maximum current in the winding. Therefore, I must conclude that the circuit is requiring some kind of current detection in the winding. And if I rely soley on calculated duty cycle for the PWM, obviously I would have to be careful of the duration of the pulses (50% duty cycle at 0.5 hertz would give 1 second of full power to the winding, so pulse duration can impact the current across the motor). That said, it would seem that a way to monitor the current in the winding would be important.
So the first question is: what method would be best to measure the current in the motor windings considering that I am using a PIC (I have several to choose from including the PIC16F630, PIC16F684, PIC16F54, and some PIC16F84's) to control the motor? My test motor is a 6-wire unipolar and I intend to power the common junctions with positive voltage and just switch the negative with a MOSFET (I have some TIP41C's I will try). I am good with the PWM control but I am not sure how to handle limiting the current. At present I'm just running the motor on its rated voltage.
The second quesiton is, as I eventually use larger motors, how do I properly choose the protection diodes I will use in parallel with the windings? I have some 1N4148's but they seem small. I also have several larger ones like 1N4004 and other, similar part numbers.
Thanks in advance.
--HC