Summary of Stepper Motor Controller using pic16f628a
Since finishing a degree, the author built a robot stepper controller from surplus unipolar stepper motors (6-wire) using a PIC16F628A, TIP120 Darlingtons, and a 4050 hex buffer. They used a 4 MHz crystal, tested delays from 50 ms down to 3 ms per phase, and calculated about 104 RPM at 3 ms phase delays running the 24V-rated motors at 13V. Source code and compiled hex are referenced.Parts used in the Stepper Motor Controller using pic16f628a:
- PIC16F628A microcontroller
- 4 MHz crystal
- TIP120 Darlington pair transistors
- 4050 hex buffer
- Unipolar stepper motors (6-wire, 4-phase)
- Wiring and connectors
- Power supply (13V used; motors rated 24V)
- Programming tool for PIC (implied for loading hex)
The stepper motors were purchased at a local auction house. They took apart old hard drives and printers and such selling the parts separately. You can usually barter and get a good deal, the ones being used in this circuit cost about $3 each. These particular motors are unipolar steppers. You can usually tell by the number of wires coming out. This one has 6 wires coming out of it: 2 green, 1 blue, 1 yellow, 1 red, and 1 white. In a 4 phase unipolar motor There are 2 coils which are center tapped and have a wire for each of phases. If the wire colours are random or if there were only 5 wires, then you would have to use an ohmmeter to distinguish between the phases and center tap. Fortunately for me 2 of the wires were the same colour, so they must be the center taps. Another plus was the wires were grouped in threes.
There is a lot of online literature about stepper motors and controlling them. A Google search turned up the circuit below. It uses a PIC microcontroller to sequence the steps, TIP120 Darlington pairs for the switching circuitry, and a 4050 hex buffer for logic levels and circuit protection.
For the first circuit I used a PIC 16F628A to test the stepper motor and find out how fast I could get it going. Just a note to people who have built or want to build the LVP, I had problems with trying to get the internal oscillator working. It might be a quirk with how this paricular chip works or a problem with how the configuration bits are being set with the programming software. But for the test circuit I used a 4 MHz crystal. A stepper motor works by pulsing each phase in a certain sequence. The delay between pauses determines how fast the shaft rotates. Beginning at a 50 ms delay I was able to get it down to 3 ms for this particular motor.
Doing some some quick calculations:
On the motor it states that each step is 7.5 degrees per step, so that makes 48 steps for one full revolution.
4 phases/step x 3 ms/phase x 48 steps/revolution = 576 ms/revolution
Converting to revolutions/second we get roughly 1.736
1.736 revolutions/second x 60 seconds/minute = 104.16 RPM, not a bad speed.
The motors are rated for 24V, But I am running them at 13V because that is all I had available.
For more Detail: Stepper Motor Controller using pic16f628a
Quick Solutions to Questions related to Stepper Motor Controller using pic16f628a:
- What type of stepper motors were used?
Unipolar stepper motors with 6 wires (4-phase, center-tapped coils). - What microcontroller was used to sequence the steps?
PIC16F628A was used to sequence the stepper phases. - What driver transistors were used for switching?
TIP120 Darlington pairs were used for the switching circuitry. - What component was used for logic level buffering and protection?
A 4050 hex buffer was used for logic levels and circuit protection. - What oscillator was used on the PIC?
A 4 MHz crystal was used for the PIC in the test circuit. - How fast could the motor be driven per phase?
The delay per phase was reduced from 50 ms down to 3 ms for this motor. - What rotational speed was calculated at 3 ms per phase?
About 104 RPM was calculated for 3 ms per phase delays. - What supply voltage was used for the motors during testing?
The motors are rated 24V but were run at 13V for testing. - How many steps per revolution does the motor have?
The motor specifies 7.5 degrees per step, giving 48 steps per revolution.
Related projects
DHT11 Low Cost Humidity Sensor using PIC16F628A with Proteus Simulation
IntroductionThis microcontroller project demonstrates how to interface a low-cost DHT11 temperature and humidity sensor with a PIC16F628A using a Proteus simulation environment.The...
LCD & Display Projects · PIC16F628AFrequency Counter by PIC16F628
In this project we are building a basic and low cost frequency counter circuit . It can measure from 16Hz to 100Hz...
Games, Toys & Calculators · PIC16F628ATIC TAC TOE game using PIC16F628
This project is not to introduce Tic Tac Toe. Everyone knows this game. It's to introduce two features. Bi-coloured LEDs, microcontrollers and...
Motors & RoboticsReal-Time CAN-Based Vehicle Monitoring System with PIC MCU
INTRODUCTION The Controller Area Network (CAN) is a robust vehicle communication bus standard that was primarily developed for automobile applications but has...
Motors & RoboticsEasy Way to Learn Robotics Using Microcontrollers: A Beginner’s Guide
The title, "Easy Way to Learn Robotics Using Microcontrollers," promises an accessible entry point for those curious about the exciting world of...
Motors & Robotics · PIC16F877AEfficient Sun-Following Robot: A Solar Tracker with Microcontroller Control
Abstract The impending global challenge of dwindling non-renewable fuel resources underscores the urgency of transitioning towards renewable energy alternatives like solar power....

