Stepper Motor Controller using pic16f628a
Since I finished my degree in April, I have been looking for work. The search has been slow but hopefully soon I will be making the big bucks. To fill my spare time I decided to do something with the mounds of electronics and such sitting in my room. First is to build a robot using stepper motors.
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
JLCPCB – Prototype 10 PCBs for $2 + 2 days Lead Time
China’s Largest PCB Prototype Enterprise, 300,000+ Customers & 10,000+ Online Orders Per Day
Inside a huge PCB factory: https://www.youtube.com/watch?v=_XCznQFV-Mw
Current Project / Post can also be found using:
- https://yandex ru/clck/jsredir?from=yandex ru;search;web;;&text=&etext=1828 n1nECMdk7wa1V5h_VwHTLQbO_3P0-ntMqdA2BvZUCNmN5HX-mZCtkTRAhfLM-uUU 87842a584d8a89bb171c9374fd9ecdc4d12628f9&uuid=&state=_BLhILn4SxNIvvL0W45KSic66uCIg23qh8iRG98qeIXme
- pic 16f627a motor