Arduino Forum

Using Arduino => Motors, Mechanics, and Power => Topic started by: dsese1234 on Aug 19, 2012, 05:49 pm

Title: (RPM) output 1600 pulses = 1 RPM
Post by: dsese1234 on Aug 19, 2012, 05:49 pm
Hey Guys,

I am working with a Stepped Motor connected on arduino pin. i am wondering how i can used analog input with potentiometer to speed up the motor out 1600 pulses = 1 RPM. and display the "RPM" on Serial Communication?   :smiley-roll-blue:


How is that? :D

Darwin.



Title: Re: (RPM) output 1600 pulses = 1 RPM
Post by: 3dprinter on Aug 19, 2012, 10:26 pm
The usual Stepper library is blocking, that is, it will not continue until it has given the number of steps.

The solution is a loop that closely resembles the "BlinkwithoutDelay" example. Instead of togging pin13 you call step(1) whenever the "millis()-timer" differnece exceeds the timing threshold. In the loop you also do a an analog read on every pass and calculate an updated value for the timing threshold.

Do not call Serial.print on every pass. This takes too much time. Only call it every 1000 millisec (which means you have another section with another timer that triggers once a second - have a look at  Blink Two LED without delay (http://arduino.cc/forum/index.php/topic,76140.msg574940.html#msg574940))

Enjoy
Title: Re: (RPM) output 1600 pulses = 1 RPM
Post by: kf2qd on Aug 20, 2012, 06:14 pm
How is your stepper connected? how does your driver work? need a few more details.
Title: Re: (RPM) output 1600 pulses = 1 RPM
Post by: MarkT on Aug 21, 2012, 01:27 am
Provide _all_ the details you have...  The exact motor (datasheet link if possible), its driver (datasheet link if possible), power supply, how its all connected (full circuit diagram is possible).

When you say "1600 pulses = 1RPM" do you actually mean "1600 pulses per revolution" ?  And its not clear if you want to change this ratio, provide more pulses per second, or what...  You perhaps should break down your problem into separate issues (analogRead and potentiometer is one, driving the motor is another).