Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

PWM current control of stepper motors

Status
Not open for further replies.

picbits

Well-Known Member
Posted this on the Piclist earlier but for those who dont subscribble ;)

I've (almost) finished building a 3 axis milling/drilling machine which has some reasonable 180oz/in stepper motors. These are bipolar motors and I have made up a couple of FET driver boards which at the moment are fed with a L297 (I think) just for testing the phase stepping. The current used by each phase of the motor is measured via a 0.5R power resistor and all seems well. The motors will take a maximum of 2.4 Amps per phase.

I also have a pile of brand new 18v 200va toroidal transformers which would be nice to use in the stepper power supply. These will give around 25v unregulated with a full wave bridge rectifier plus cap.

Now the idea is to use an 18F4520 per axis with all 3 axis drivers connected to the serial port. With some careful programming I cant see any problems with this side. Each 18F4520 has two independent PWM outputs and my Stepper drivers have a PWM input for each phase.

I have had a play with various currents and speeds for the motors and at around 2 amps per phase there is enough power for my machine to start pulling itself to bits. At 1 amp per phase it still performs well and the motors run a lot cooler.

I've been toying with the following idea :

On startup the 18F4520 starts with a 20khz PWM period and a zero duty cycle.
The duty cycle is increased slowly and the average current (from an RC filter from the current sense) is read via one of the A/D channels until the average motor current is at the maximum preset value for the motor (set in software and stored in eeprom).
This is repeated (fairly unnecessary but there may be variances between phases) for the other phase.
I now have the upper limit that I can drive the PWM to my steppers at for maximum power.
Some calculations on the max value and store 7/8, 3/4, 5/8, 1/2 etc in variables for rapid retrieval (possibly for microstepping purposes later ......)

Now I should have the facility to vary the current to my steppers and depending on the step speed required and if I'm just transversing or actually cutting I should be able to tune these motors through software for the best results and minimal motor heating.

For example, if I have positioned the X and Y axis and just need to drill on the Z axis, 1/4 of the rated motor current is more than adequate to keep the X and Y motors held in position but without excessive motor heating. The Z axis can then be run at full power.

Likewise if the head is down for milling, the Z axis doesnt need a lot of current but the moving axis will.

I'm not that worried about microstepping at the moment - the resolution is pretty good with full steps and speed isnt that important at the moment.

Comments and suggestions are welcome ..........

Dom
 
go look at how the more recent allegro stepper controllers work. there is a wealth of info in those datasheets.
 
Ive examined Romans linistepper in detail but it wastes too much heat for me. I would rather go the PWM route and have all the output drivers setup for PWM
 
Oh and the main reason I discounted the linistepper is that I'm using Bipolar motors - the linistepper only drives unipolar :(
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top