3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

Animated 'Haunted' Ouija Board

Step 8The Electronics

The Electronics
«
  • mainpcb.JPG
  • powerresistors.JPG
OK so we now have the mechanism basically complete... now we need it to move!

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 StepDownload PDFView All StepsNext Step »

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
1
Followers
1
Author:askjacob
Like making things. Like breaking things (to see how they work). Lost many a great toy in my youth to curiosity. Now I feel more confident to put thing back together again...