Motor Circuit Diagrams

PIC12C508 Stepper Motor Controller Schematic Circuit Diagram

Alternative Stepper Motor Usage

When a stepper motor is not employed for achieving precise positioning of a robotic component. It can serve as a traction motor, replacing the standard modified servos discussed elsewhere in this publication. In this scenario, there’s no longer a need to meticulously count the motor’s steps; The objective is to enable continuous rotation in either direction. Various methods can be employed to drive the motor, some of which are detailed in this issue: utilizing a specialized stepper motor driver IC, programming microcontroller parallel ports accordingly, or constructing a driver circuit using conventional logic ICs.

Challenges in Traction Applications

However, these conventional solutions pose challenges when using a stepper motor for traction. They necessitate a continuous generation of pulses for as long as the motor needs to run, either requiring an additional programmable oscillator or consuming resources from the robot’s primary microcontroller. Hence, we propose an alternative approach with a dedicated stepper motor driver designed explicitly for controlling its continuous rotation in either direction, managed by a straightforward logic level.

Dual Driver Solution

Considering that propulsion motors in robots typically operate in pairs, we provide a dual driver by repurposing a commonly available and cost-effective IC. Since precision in step accuracy is not critical for a stepper motor used in propulsion, simple single-pole models are perfectly suited. Therefore, our circuit is tailored for motors of this type, enabling motor control through two TTL- or CMOS-compatible logic inputs. When both inputs, denoted as L and R, are set to logic high or left floating (equipped with their pull-up resistors), the motor remains stationary in a braked mode, typical for a stepper motor.

Directional Control and Speed

When the L input is brought to logic low, the motor rotates in one direction, often designated as left (L). Conversely, when the R input is driven low, the motor turns in the opposite direction. If both inputs are grounded simultaneously, the R input takes precedence, resulting in motor rotation in that direction. While the motor’s speed is fixed, we provide the source listing of the software used for this application, facilitating easy customization to suit specific requirements. Moreover, external speed adjustment can be incorporated if necessary.

PIC12C508 Stepper Motor Controller Schematic Circuit Diagram 1

PIC12C508 Stepper Motor Controller Schematic Circuit Diagram 2

PIC12C508 Stepper Motor Controller Schematic Circuit Diagram Table

PIC12C508 Stepper Motor Controller Schematic Circuit Diagram 3

Controller Circuit Overview

In Figure 1, we present the circuitry of the ‘intelligent’ part of our controller, featuring the utilization of a PIC12C508 microcontroller from Microchip. The PIC12C508 operates in internal clock and reset circuit mode, eliminating the need for external components for these functions and ensuring the availability of all port lines. In this configuration, parallel ports GP2 and GP3 serve as inputs, with R1 serving as an internal pull-up resistor for GP2. Meanwhile, parallel ports GP0, GP1, GP4, and GP5 function as outputs to generate motor winding pulses. In the subsequent sections, we’ll delve into the power stage options for various motor setups.

Powering the PIC12C508

To power the PIC12C508, a stable 5 V supply is derived from the motor supply through a standard 3-terminal voltage regulator IC2. If the controller serves a single motor or a motor with a current draw exceeding 500 mA per winding, the power stage depicted in Figure 2 is the suitable choice. This power stage incorporates bipolar transistors capable of switching currents up to 3 A, accompanied by diodes D1—D8 to suppress transient spikes generated during motor winding current transitions.

Efficient Motor Control for Low-Current Motors

For motors with current draws below 500 mA and the need to control two such motors, a clever solution is available, illustrated in Figure 3. This approach employs a standard ULN2803, typically used for relay driving but equipped with eight medium-power Darlingtons and their protective diodes. The ULN2803 is well-suited for driving single-pole stepper motors, provided the voltage requirement doesn’t exceed 50 V and the current per winding remains under 500 mA. Furthermore, its eight identical stages allow it to be employed with two controllers, enabling control of two robot propulsion motors independently.

Programming the PIC12C508 and Heat Management

To program the PIC12C508, the required files can be obtained in object and source form on the Elektor website and the author’s site ( for potential modifications. If constructing the transistor power amplifier, note that T1—T4 do not require heatsinks unless the motor’s power consumption exceeds 1 A, in which case attaching them to a small aluminum plate is advisable.

Mechanical Considerations and ULN2803 Usage

For simplified mechanical construction, it’s possible to common the four transistors, but this necessitates the use of standard insulating accessories like mica washers and shouldered washers due to the transistors’ collectors being connected to the metal parts of their cases. In the case of the ULN2803-based version, no special precautions are necessary, as long as the current remains within the IC’s maximum capacity of 500 mA.

Modifying the Software for Custom Control

The complete source listing of the software programmed into the PIC12C508 is provided for customization. For those unfamiliar with PIC microcontroller assembler. A crucial modification involves adjusting the speed of control pulses to the motors and, consequently, their rotational speed. The control word, as detailed in Table 1, can be modified by altering the binary constant in the line: MOVLW 13’10010101′ located just above the line containing OPTION in the source listing. The original value yields an 8 ms duration for one step, with the table offering guidance on constants for different step durations.


Related Articles

Leave a Reply

Your email address will not be published.

Back to top button