Our approach in designing a competitive robot involves using two stepping motors to accurately locate the center of the arena, as well as one stepper motor to rotate the ball sorting carousel. As both of these tasks are critical to the outcome of the competition, driving the stepping motors becomes an integral part of our design. When we originally decided to use stepping motors as a means of rotation, we checked three out from the Electrical Engineering shop. These motors have only a few markings to identify its datasheet by, but we found a sheet that led us to believe it was a unipolar motor. Driving unipolar stepper motors is very straightforward. Jones on Stepping Motors describes a solution to driving unipolar stepping motors with a ULN200x family darlington array, which we happened to have included in our lab kits. However, upon experimentation with the supposed unipolar stepping motors and the high voltage darlington arrays, we quickly found that the motors were in fact bipolar and require an alternate, slightly more complex, method of control. After discovering the true type of stepping motor we were dealing with, we set out to design an H-bridge to drive our motors.
Bipolar stepping motors are constructed from two or more coils. As current is passed through a coil, a magnetic field is induced causing the magnetic rotor to align with the stator. By alternating which coil has current passing through it, and the polarity of each coil, a step of the motor is achieved. An H-bridge is a common method of controlling the polarity of a stepping motor's windings. For more details on how a bipolar stepping motor works, refer to Jones on Stepping Motors.
Our text, Introduction to Mechatronic Design, introduces an H-bridge design utilizing both NPN and PNP transistors, similar to the image shown below for one coil, where (A) and (D), and (B) and (C) are tied together.
In an attempt to simplify this design, we made the choice to trade the two PNP transistors for NPNs, like the following.
We made a crude prototype of the circuit on a breadboard and used it to drive the carousel stepping motor. The circuit proved to work and so we excitedly designed and built three boards to drive our motors.
To our demise, we found that this design resulted in very little torque from the motors, not even enough to drive our small robot. The reason for this is inherent in the design we chose, simply replacing the PNP transistors yields underlying trade-offs that were not initially realized. A simple circuit analysis of the above design with only NPN transistors reveals that the NPN base never exceeds the voltage emitter voltage, therefore never fully saturating and severely limiting the torque produced by the motor. To overcome this problem, we refer to Jones' H-bridge design.
Jones' design overcomes the problems of our initial H-bridge design by introducing a pull-up resistors and a diodes from the emitter of the upper transistors to the collectors of the lower transistors, allowing the base voltage of the upper transistors to exceed the emitter voltage and fully saturate.
After thoroughly testing this design on a breadboard to ensure that it would provide the required torque to drive our robot, we designed a PCB layout and made a board for each motor. The schematic and board layout can be downloaded from our Git reposity at https://github.com/pnyholm/resistors
The H-bridge design used is very versatile and a great option as a general purpose H-bridge. There are two limitations of the bridge that made an impact on our robot:
The first is a limitation in that we only have a finite number of pins available to use for outputs on the PIC24F series microcontroller being used for the project. Our approach requires three stepper motors, for a total of twelve microcontroller output pins. To reduce the number of required pins and mitigate this limitation, we left the H-bridges general, as shown above, but implemented a NOT gate on the main navigation and shooting boards. The NOT gate uses only one output from the microcontroller but controls two H-bridge inputs. It leverages transistor logic to force one H-bridge input high and the other low. The NOT gate implementation allows us to half-step the stepper motor using only two microcontroller outputs to control all four H-bridge inputs.
The second limitation is that the H-bridge, on its own, is always on. This draws lots of current, locks the motors, and can potentially lead to overheating components. A power switch was implemented on the main navigation and shooting boards to control when power is sent to the motors. The switch was again made using transistor logic. Two transistors, one NPN and one PNP, are used to open and close the power loop to the motors. When the microcontroller output goes high, it turns on the NPN transistor which effectively grounds the PNP base, turning it on. With both transistors on, current can flow to the H-Bridge. With this configuration, we can control when we want the H-bridge turned on and can let is rest when it is not needed.