Step 8The Electronics
Attached is the schematic and PCB done in eagle cad. I also included the PCB images as a bitmap file - make sure you print them at 300dpi if you don't want to use eaglecad to print the pcb.
This is a handy board for driving any bipolar stepper motor - also known as 4 wire steppers. They are a bit more complex to drive than 6 wire ones, but come with the bonus of higher torque. Most circuits out there I could find were for 6 wire motors - one of the other reasons I wanted to 'roll my own'.
Also attached is the bascom source file, and a compiled hex file for the atmega8.
I know that the Atmega8 is pretty overpowered for this simple job, but I had some around and had been doing other work with them recently. The code uses only 14% of the flash on this controller, so there is room aplenty for more customising!
The circuit has my own ISP header - easy to figure out the pinouts for another programmer if you need to. I also added some ballast resistors suitable for my motor to run from 12v (18 Ohm 5 watt) instead of 5 volts so it had better torque and top speed.
I had no idea which direction the motor would go, nor how many steps were needed to go from one end of travel to the other, so this is what I did: I moved the bracket to the middle of the travel (so it won't jam somewhere if it goes too far), set the program to step in one direction only for 500 steps, and saw which way it went. Easy huh?
Next, I sent it 'home' - it goes back to the home microswitch and sent it forward in ever increasing number of steps until I was happy that was as far as I wanted it to go.
Then I had all the data I needed, to write the final program code. Most likely you will need to change these numbers to suit your layout, size and stepper/gear combo.
The final code has some failsafe work - if it hits the home switch unexpectedly it will recalibrate itself, and after 1000 moves it also recalibrates - just in case the stepper motor mis-steps - small errors in stepping cumulatively will add up over time, and we don't want this thing jamming up by moving too far...
| « Previous Step | Download PDFView All Steps | Next Step » |
![]() |
Add Comment
|






















































