stepper motor control?
Bill Henning
Posts: 6,445
I just went through the motor control section of obex (http://obex.parallax.com/objects/category/7/?page=1) and found four pages of great stuff... but none of them appear to be for controlling stepper motors!
Does anyone know of any stepper motor software in Obex?
If not, I guess I will have to write one.
Thanks!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.mikronauts.com Please use mikronauts _at_ gmail _dot_ com to contact me off-forum, my PM is almost totally full
Morpheusdual Prop SBC w/ 512KB kit $119.95, Mem+2MB memory IO board kit $89.95, both kits $189.95
Propteus and Proteus for Propeller prototyping 6.250MHz custom Crystals run Propellers at 100MHz
Las - Large model assembler for the Propeller Largos - a feature full nano operating system for the Propeller
Does anyone know of any stepper motor software in Obex?
If not, I guess I will have to write one.
Thanks!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.mikronauts.com Please use mikronauts _at_ gmail _dot_ com to contact me off-forum, my PM is almost totally full
Morpheusdual Prop SBC w/ 512KB kit $119.95, Mem+2MB memory IO board kit $89.95, both kits $189.95
Propteus and Proteus for Propeller prototyping 6.250MHz custom Crystals run Propellers at 100MHz
Las - Large model assembler for the Propeller Largos - a feature full nano operating system for the Propeller
Comments
I've been trying to exapnd my collection of motor objects.
... Would you like position in steps and steps/second control?
I'll also make it support two motors at once·like the rest of my dual drivers. (Is 4 windings good? 1 pin for each?) X2 for dual stepper motors.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
Post Edited (Kye) : 12/10/2009 2:52:43 AM GMT
Johnny Mac wrote one in a Nut and Volts article. I can't put my hand on it right now, but it was called "Stepping Out With Spin"
Jim
http://forums.parallax.com/showthread.php?p=839549
Thank you! That would be perfect. I need to control two steppers (X & Y direction), and while all I really need is N steps forward/reverse, N steps FWD/REV in T seconds would be very nice too!
hover1:
Thanks, will look for it...
w8an:
Thank you for the link!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.mikronauts.com Please use mikronauts _at_ gmail _dot_ com to contact me off-forum, my PM is almost totally full
Morpheusdual Prop SBC w/ 512KB kit $119.95, Mem+2MB memory IO board kit $89.95, both kits $189.95
Propteus and Proteus for Propeller prototyping 6.250MHz custom Crystals run Propellers at 100MHz
Las - Large model assembler for the Propeller Largos - a feature full nano operating system for the Propeller
Try here:
www.parallax.com/Portals/0/Downloads/docs/cols/nv/vol7/col/NV136.pdf
A useful stepper object would be able to do half-steps and micro-stepping for CNC applications. I've got this old ShopBot-thingie in the garage (my short video is at and it's not worth it's power consumption in full-step mode (0.015" steps) because it's a direct-drive gear/pinion setup. So, FlashCut CNC (and Gecko drives) offer some drivers that support microstepping. This increases my accuracy by using 1/10th steps (and 0.003" resolution). This particular machine was found locally on CraigsList for a song and a dance, but it does well with my robot bases.
Braking and ramping are other characteristics I'd like to see in a completely function stepper post on OBEX.
Sure appreciate your efforts.
Sincerely,
Ken Gracey
Parallax Inc.
Hey Ken... for the time being, I'd rather use someone else's stepper object, that way I'd have more time for PropellerBasic
I agree about half-steps and micro-stepping... I have started acquiring parts to make a small CNC with an 18"x18" work area, for milling out robot parts, Morpheus case face plates, I/O panels etc.
If I got it to do 3mil resolution, maybe even milling some of my own prototype PCB's, shortening my new board development cycle... so I may end up doing micro-stepping later.
Best Regards,
Bill
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.mikronauts.com Please use mikronauts _at_ gmail _dot_ com to contact me off-forum, my PM is almost totally full
Morpheusdual Prop SBC w/ 512KB kit $119.95, Mem+2MB memory IO board kit $89.95, both kits $189.95
Propteus and Proteus for Propeller prototyping 6.250MHz custom Crystals run Propellers at 100MHz
Las - Large model assembler for the Propeller Largos - a feature full nano operating system for the Propeller
http://www.allegromicro.com/en/Products/Part_Numbers/97060/
It takes care of chopping and microstepping based on digital input and can drive up to three amps.· My application will be a three axis CNC controller/driver that would be capable of acting as a stand-alone power drive with poor-man's digital readout or as a slave to a PC running CNC software.· I'd really love to be able to add an SD card and run the G-Code straight from that but that would be way down the road.· As soon as I get the ability to make my own PCBs I plan to start on this.
I normally can put my finger on that stuff pretty quick, but I am in the middle of packing to do a 4 day install in Wausau, WI. Forcast next 4 days: average 0 degrees F. Hey, where's the global warming?
I'll be going home for about a month during the holidays and I will not have acess to any stepper motors/powersupplies/etc. I don't believe I can finish the driver in a day so don't hold your breadth for me.
The good news however is that I plan to finish the full FAT32/FAT16 file system driver I was working on over the holidays. I'm finishing up finals week at school right now so my time is not my own.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
@Bill, If I were your manager, I'd also tell you to stick to the BASIC compiler.
Ken Gracey
So, I guess I can make multiple versions of the same driver for each different type of stepper motor. I think high level position and speed control will be enough for now at the lowest level.
Ramping and such may be put at a higher level.
... After a bit of research I looked into microstepping and its pretty much just a form of half stepping were you vary the current of each of the two coils your half stepping with to get a very fine accuracy.
This can be done using pwm. Now, I'm not sure if there is any point of varying the current based on sine waveforms or just ramping the current of one coil up while ramping the current of the other coil down in operation. Both methods seem plausible to me.
To make it a dual driver using one cog I'll have to write it in asm which I'd rather not do. But to do microstepping you'll need two channels of pwm per motor. Would be easier in spin.
Maybe I'll make a single motor per cog driver first.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.mikronauts.com Please use mikronauts _at_ gmail _dot_ com to contact me off-forum, my PM is almost totally full
Morpheusdual Prop SBC w/ 512KB kit $119.95, Mem+2MB memory IO board kit $89.95, both kits $189.95
Propteus and Proteus for Propeller prototyping 6.250MHz custom Crystals run Propellers at 100MHz
Las - Large model assembler for the Propeller Largos - a feature full nano operating system for the Propeller
How about current management? Typically with steppers, or any motor for that matter, you lose torque as the motor speeds up. If you regulate the current so that it remains constant, you can maintain constant torque, and thus higher current at higher speeds. To do this you need a boost regulator of some kind to increase the voltage the stepper sees at higher speeds verses the lower voltage it would see at lower speeds. I realize that this sort of thing is usually done at higher level applications and requires a fair amount of external hardware support for the DC-Dc conversion and the Stepper motor voltage regulation. But if an object were written equipped to manage the current based on speed and/or a feedback loop from the motor, it would be a nice little object addition.
I have done this with standard DC motors with very good results, the same technique could be applied to steppers.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
But as there is done choppering at all to limit the current
I would think this is just a matter of changing the on/off-ratio of the pwm signal that choppers the current.
Second thought. If the current is limitted through choppering by measuring the (averaged) current this should
include ALL effects. So it should include the effect of the increasing - hm don't know the word -
"the voltage generated through the moving of the magnetfield "through" the coils which lowers down the supplied voltage
as the generated voltage has opposite polarity."
So this should allow to go always to the current limit the steppermotor can stand without OVER-heating.
In the company I worked 3 years ago they used a lot high torque steppermotors 85V 3A. They drove them
with a current, that they warmed up pretty much (55°C)
best regards
Stefan
I bet it would be a very big hit with everyone
1. The driver, creates the waveforms the motor requires from simple step and direction pulses
2. The motion control part. Creates pulse streams to provide the required motion profile, typically trapezoidal velocity profiles.
3. G-code interpreter or overall program issues motion commands.
1. If you buy a commercial stepper motor driver (or build one based on relevant chips) then that will cover you for 1. Or you could create a stepper driver object to do that with appropriate hardware, hopefully it would support micro-stepping and do the current limiting side of things etc. I would rather buy something to do this as the pros do the power electronics better than me.
2. Then you have the motion profile side of things and that should be a separate object as well with distance travelled (in steps), acceleration and maximum velocity as inputs. Two axis interpolation at least is required ideally.
3. This could be a separate object (g-code interpreter) but in many applications this would be your main program.
So basically don't try and do an object that does it all, divide and conquer.
Graham
Yes, I agree, divide and conquer in small steps (no pun)
As far as power management is concerned, my days in motion control for prosthetic robotics is coming out...
StefanL38,
"I'm not familiar with the details of steppermotor-chopper circuits.
But as there is done choppering at all to limit the current
I would think this is just a matter of changing the on/off-ratio of the pwm signal that choppers the current."
This works if your supply voltage/current is rated at least 4 times the requirement for the Stepper, but often, and I think this is a misconception with stepper motors, the supply voltage/current is rated at the same requirement of the Stepper. This causes the stepper to operate ok but it's not as efficient as it could be with the power supply and you start to have problems at higher speeds.
Think of it this way...
In full step mode, each coil to the stepper only "sees" 1/4th of the total available power.
0001 , 0010 , 0100 , 1000
Alternative full step mode, each coil to the stepper only "sees" 1/2th of the total available power.
0011 , 0110 , 1100 , 1001
In half step mode, each coil to the stepper only "sees" 3/8th of the total available power.
0001 , 0011 , 0010 , 0110 , 0100 , 1100 , 1000 , 1001
...even if you alter the speed of the sequence, you still have the same power ratio. So two things you could do.
1) Start out with a supply 4 times the stepper requirement.
2) Add a DC-DC converter that effectively multiplies your voltage by a factor of 4 and that can maintain the required current drive of the stepper.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
Post Edited (Beau Schwabe (Parallax)) : 12/10/2009 6:20:59 PM GMT
Mariss from Geckodrive suggests you can pretty much go all the way up to 20X the stepper's rated voltage assuming current limiting is in place to allow high speed operation, 20X is pretty high, I typically have used something more like 6 times. That would generally be done with just a single power supply, no level changing for different speeds, not as efficient but it does work.
Graham
I'll put the number of microsteps you want in the constants section of the code and the driver will just use a sin/cos lookup rountine to decrease the duty cycle of one coil while increasing the duty cycle of the other smoothly.
The microsteps number will control how many sin/cos steps it does then between each step. Shouldn't require much more than a few lines of code. However, I'm only going to test my driver on the oscilliscope since I don't have time to make the necessary driver stuff. I'll post my code on saturday, then everyone can test.
Thanks,
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
http://forums.parallax.com/forums/default.aspx?f=25&p=1&m=384380
thread and my data sheets.
It's not fancy, it's not super fast, but it works well enough for my current app.
Note: it does not do half or micro steps! I tried to do half steps, but my test motor did not like it - I was probably doing something wrong.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.mikronauts.com Please use mikronauts _at_ gmail _dot_ com to contact me off-forum, my PM is almost totally full
Morpheusdual Prop SBC w/ 512KB kit $119.95, Mem+2MB memory IO board kit $89.95, both kits $189.95
Propteus and Proteus for Propeller prototyping 6.250MHz custom Crystals run Propellers at 100MHz
Las - Large model assembler for the Propeller Largos - a feature full nano operating system for the Propeller
adding pulse width modulation to the outputs might let you do micro-stepping as well, but I haven't had the need to try to code it. I don't have ramping, but I do have speed control.
I'd have to clean up my code a bit to post it, but if you think it would make a worthwhile object I'll put it out here.
I have 4 axis code for the SX-48 that does have ramp control as well. ( full or half phase stepping ) You send it the XYZ coordinates in a 19.2K data packet and it drives to the correct position: Ramp up-ramp down or ramp up, run, ramp down.
It was an amazing accomplishment for me at the time. I tried to interest Parallax in it as a product, but they weren't interested.
The Propeller has enough horsepower that I'm getting reasonable 5 axis performance in SPIN. I haven't gotten good enough at pasm to feel comfortable re-writing it in assembly, but it should be pretty straight-forward if someone wants to take the ball and run with it.
K.B.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
" Anything worth doing... is worth overdoing. "
··············································· ( R.A.H. )
····································
Sounds good Ken, does it do interpolated moves too? If so between how many axes, sounds really neat.
I also have an stepper object that produces step and direction pulses but it only runs one axis at a time (or multiple axes but not synchronised), it is written in assembly and does trapizoidal motion profiles. It uses the exact same motion control technique as the G-rex by geckodrive, the counters are used in NCO mode and updated at regular intervals, the intergral of the frequencies is proportional to distance etc. It is possible to do coordinated moves I just have not got "a round toit" yet. That is why it has not been released as yet. Might be another Christmas project.
Cheers,
Graham
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
I am looking forward to your stepper control object.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.mikronauts.com Please use mikronauts _at_ gmail _dot_ com to contact me off-forum, my PM is almost totally full
Morpheusdual Prop SBC w/ 512KB kit $119.95, Mem+2MB memory IO board kit $89.95, both kits $189.95
Propteus and Proteus for Propeller prototyping 6.250MHz custom Crystals run Propellers at 100MHz
Las - Large model assembler for the Propeller Largos - a feature full nano operating system for the Propeller
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,