Go Down

Topic: Proper generate of Pwm Stepper Motor (Read 4228 times) previous topic - next topic

colorsound

Hello guys

I,m using a stepper motor of 400 steps per revolutiuon 0.9ยบ step. It is the 0.9 version of this
http://catalog.orientalmotor.com/item/stepping-motors/pk-series-stepping-motors/pk266-e2-0b?jumpMenu=%23

and  an external driver DS1044 to control it ,which if receives a 5v On Off will make a motor Step.

So by switching on and off a pin it will move this works well so far.

what i would like is to be able to set an apropiate pwm ,
by using normal Analogwrite the motor  moves at its maximum speed and changing from 1-254 will not produce any difference in speed, so i presume it is because the range it is already at its maximum and that it is why it does not change .

searching around i tried a few things like this :

http://playground.arduino.cc/Code/PwmFrequency

using it and setPwmFrequency(6, x); changing to all options did not produce any change either so i still presume even slower frequency is still too fast.

any ideas or things i could try to achive a moderable pwm pulse to change speed of the motor , btw i.m using an arduino mega 2560 and if posible i,d like to use pin 8 for that.

In the past i used some stepper motors with the stepper shields , will the motors libraries be able to output that pulse ? as i remember they will affecting the motor directly using 4 output pins.

thanks  :)


semicolo

A DS1044? A delay line ic? I'm missing something here.

colorsound

hi semicolo

this is the controller http://www.lamtechnologies.com/Product.aspx?lng=EN&idp=DS1044

which works well and easy to use it is got a step pin where you set a 5v On Off and it will make a motor Step.

I,m trying to find out best way to set a good pwm in order to move the motor steps.

right now best solution i found it is using the Blink without Delay from the sketches examples and change to micros instead of millis as millis where causing the motor to move strangely when long interval = 1;.

so sounds like :
Code: [Select]

long interval = 1000000/2;  step per second
long interval = 100000/2;  10 step per second
long interval = 1000/2;  1000 step per second // this is not true as it gives one revolution a second +-


will the Blink without Delay way be a good option ?
will this way  depends on arduino performance or no matter arduino performance to get a good pulse using Blink without Delay way  ?

any other ideas welcome ;D

kf2qd

Probably not the correct place to use PWM... a PWM signal to the driver will cause the motor to try and step at the PWM frequency. If you want to use PWM you would use PWM to each of the transistors on the driver to control the current to each phase.

If you try to use Arduino PWM to drive a normal stepper motor driver the motor will try to step as 500Hz. PWM is a variable duty cycle - meaning it turns on and offm with the approx analog voltage being the ratio of 5V to 0V. so at 50% the voltage will be 5V half the time, and 0V half the time. Looks like a step signal to the driver.

colorsound

hi , ok thanks for reply .I,ll stick to the Blink without Delay technique for now which seems to work the better so far.

cheers

MarkT


Probably not the correct place to use PWM... a PWM signal to the driver will cause the motor to try and step at the PWM frequency. If you want to use PWM you would use PWM to each of the transistors on the driver to control the current to each phase.

If you try to use Arduino PWM to drive a normal stepper motor driver the motor will try to step as 500Hz. PWM is a variable duty cycle - meaning it turns on and offm with the approx analog voltage being the ratio of 5V to 0V. so at 50% the voltage will be 5V half the time, and 0V half the time. Looks like a step signal to the driver.


It is possible to configure a timer-counter to a variable frequency mode, but you will have to read the
datasheet in detail about this (all 3 timers on the Uno are slightly different too).  You would also probably
have an easier time learning to setup a timer interrupt at a regular frequency and drive the step/direction
pins with direct digital synthesis (google this).   Or you could read the source of the AccelStepper library
(or just use it!!)
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

colorsound

Hello MarkT

thanks for reply

I,ll try to find out how to get the pulse from AccelStepper library before it send to individual pins




Go Up