Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
Tools
Old 22nd January 2009, 01:21 PM   #1
Default stepper motor control using cheep parts

Hi everyone I'm developing a cnc machine but starting with parts that are easy for everyone to get. The H bridges are made from NPN and PNP transistors and a 5v regulator for the microchip all from ratshack, a wallwort 12 volt transformer (that actually reads 18), and a simple program to run the ADC on a 12f675 that I will provide.
The initial idea is turn a pot and get varied speed for forward and backwards rotations on a stepper motor. Then later run two motors to make simple CNC designs.
The first part is to read the pot and subtract that from 127. If it trips a flag when subtracted then forward is called, if it doesn't trip a flag then it calls reverse. Based on how large the resulting value is from the subtraction the speed of the motor is changed.
For example if the ADC value is 100 and I subtract it from 127, the flag will not be tripped... The resulting value will be 27 and I'll use that in my delay to keep the coil turned on for some short corresponding amount of time. If the value from the ADC is 25 then the result after subtraction will be 112. Therefore giving a larger value for my delay and therefore spinning the motor at a slower rate. On the other hand if the value is 225 then I have the value of -98. I'll use the positive value of this number to create my delay therefore varying the speed of the stepper motor, but since the - will cause the flag to trip I will run the motor the other direction. The farther the value from zero the greater the delay and the amount of time that I'll leave the pole charged on the stepper motor, therefore the slower the motor will go.
For example here is the mantra of the program: read ADC, subtract from 127 and save value to delay timer, check flag, call forward or reverse correspondingly, charge first coil, count down delay, charge other coil, count delay, reverse polarity and charge first coil, count down delay, reverse polarity in second coil, count down delay, then continue to reverse and charge coils until ADC value read in a timer 0 interrupt indicates otherwise.
The read of the ADC will be in an occasional tmro interrupt. Fast enough to not notice but slow enough to not interrupt motor operation.

So far I have one H-bridge built and it runs a stepper motor pulled from an old A drive in my computer. I have run it with the 12f675l chip with just a very simple program that makes it go only forward, but it works. The next step is to run it in reverse, then put the ADC components on the board and in the program.

The reason for this post is to see if anyone else is interested in making a CNC machine that can do simple things like for example draw things with a pencil. I can't think of anything else to do with a 2D CNC yet. But all ideas are welcome and building partners as well. When the 3D machine starts I'll start another thread. l
__________________
jeremy
jeremygaughan is offline  
Old 22nd January 2009, 01:24 PM   #2
Default

by the way I forgot to mention that I'm working with bipolar motors.
__________________
jeremy
jeremygaughan is offline  
Reply

Tags
cheep, control, motor, parts, stepper

Thread Tools
Display Modes


Similar
Title Starter Forum Replies Latest
Stepper Motor Control (8051) Meesam Electronic Projects Design/Ideas/Reviews 6 5th March 2009 06:02 PM
control of stepper motor sanjivee Electronic Theory 24 5th March 2009 05:52 PM
MOSFETs for stepper motor control yngndrw Datasheet/Parts Requests 15 9th June 2008 08:08 PM
3x4 keypad for stepper motor control..need help melai General Electronics Chat 9 11th February 2007 02:54 PM
Stepper Motor Control Motorhead General Electronics Chat 9 18th January 2003 07:28 PM



All times are GMT. The time now is 05:02 AM.


Electronic Circuits  |  Learning Electronics
eXTReMe Tracker