| Synchronous DC Motor Driver
In order to drive the synchronous DC motor I connected the common lead to a power supply (~12V) and then used darlington transistors to connect alternate leads to ground, thereby producing a field in each coil in turn. Using my PIC board I sequenced the coils to obtain the require A,B,C pattern.
Rather than using descrete NPN transistors to make the darlington pairs I used the L6220 which is a quad darlington driver chip made by STMicroelectronics. Why? Well I had bought a bunch of them and really it's a very nice chip. OK, it's already obsolete but what can you do?
The L6220 is an interesting chip. It was originally designed to drive unipolar stepper motors (future project?) and can handle 1.8A per darlington pair with a heat sink. Conveniently for us, the chip is set up for TTL level inputs which is just what the PIC likes to deliver.
Because the chip was designed to drive a stepper motor, the input logic is a bit odd. There are four darlington pairs. Pairs 1 and 4 conduct when the input is logic high (1), whereas pairs 2 and 3 conduct when the input is logic low (0).
When driving a unipolar stepper motor in full step mode, there are pairs of coils in the motor that are energized in a complementary fashion; one is on and the other is off; or visa versa. Using the darlington pairs 1 and 2 together (or 3 and 4 together) to control these coils allows one TTL signal to control two coils. A logic 1 energizes the first coil and turns off the second, while a logic 0 turns off the first coil and energizes the second coil. But more on this later. Right now all that this means is that we have to be careful of our bit paterns when we code our control routine since some bits will be inverted.
As I mentioned, we need to know when to energize the next coil or our synchronous motor will never rotate smoothly. To determine where we are in the rotation I created an encoder wheel by printing a series of spokes onto a laser transparency. My first wheel had 1 mm spokes every 5 degrees (an arbitrary choice). This gave 6 spokes per coil which are themselves 30 degrees apart.
To measure the spokes I used a small optical interrupt switch. This is combination of a LED on one side of a small gap, and a phototransistor on the other. When the gap is unobstructed (clear plastic) the LED shines on the phototransistor and it conducts. This pulls the line going to the PIC chip low (logic 0). When the gap is obstructed (spoke is in the gap) the phototransistor does not conduct and the line going to the PIC sees 5V volts (well mostly, read below).
Here is the circuit I used to contol this switch. The LED requires about 70mA of current. At 70mA the LED has a drop of about 1.2V so the resistor must drop (5V - 1.2V) 3.8V. Since R=V/I we get 3.8V/0.07A = 54ohms. The closest resistor in my parts box was 51ohms.
If the variable resistor on the sensing side is set to a high value near 5Kohms, the switching time for the phototransistor becomes slower but we get a large voltage swing from 5V when gap is blocked to near 0V when the gap is clear. If the spoke on the encoder wheel is too narrow (less than 1mm) or the rotation speed is too fast (greater than 30-40Hz) the circuit may struggle to reach 5 volts while the switch is obstructed.
As we lower the variable resistance the response time of the phototransistor becomes quicker but the low voltage when the switch gap is clear begins to rise. By the time the variable resistance is about 300 ohms, the PIC no longer recognizes the signal as a logic 0.
A low rotation speeds (~40Hz), my first encoder disk sufficed. But as I pushed the rotation speed upwards, the drive would lose synchronization. I tracked this back to the speed at which the optical encoder could switch. It has a switching time of 10-15ms. At fast rotations this meant that my 1 mm spoke would generate a progressively shorter rounder peak until finally the PIC, that was monitoring the signal, could no longer recognize it as a TTL pulse. The solution was to thicken the lines. I decided to split the 5 degree arc into two even halfs; one half clear and one half black. Now the drive easily spins up to 100Hz.
Below you can see the schematic of the driver circuit. I've wired up all four darlington pairs although we only need three for this project. Perhaps we'll driver a unipolar stepper motor later on. The 1K pullup resistor on the ENable line turns the driver chip off when no pic is attached. The 33V Zener diode attached to the clamping outputs is there to provide a path for the current in the inductive motor coils when we shut the darlingtons off. Without this emergeny pathway, the current could 'pile up' at the L6220 chip when we shut off a darlington and exceed the 35V maximum of the chip. This would be bad in electronics parlance. The large capacitor shown in the circuit is not needed for this project. I'm always trying to plan ahead though. Finally, the V+ is typically about 12V. Provision is made to power the microprocessor board from this source although I'm not entirely sure that this is a good idea.
Finally here is the PCB for this circuit. I'll try to make all the projects fit on the same 2" x 1.25" boards.
Hover over the image above and use "Save Link As" (Firefox) or "Save Target As" (MSIE) to save the full size PCB layout to your computer.
Next Section: Synchronous Motor - Making it Spin