Go Down

Topic: measure rpm of stepper motor (Read 2354 times) previous topic - next topic

123_able

Please tell me how to measure the rpm of a stepper motor using arduino programing.Also,please explain me the programme.For stepper motor to drive ,we have already used one arduino code.How should the second code be connected to this?please reply.

vinceherman

You tell a stepper motor to step.
So you know when the steps take place.
And you know how may steps per revolution your motor has.

The rest is math, right?

123_able

PLease would be helpful if you give the code for the encoder and also tell me where will the encoder be attached to measure the speed?It should actually be kind of automation so as to reduce human effort of holding the encoder each time.

vinceherman

But it would be a better learning process if you did the work yourself.
Do you have a stepper motor, and appropriate stepper driver and arduino?
Go google examples for that driver.

See if you can make the motor turn.

If you run in to problems, we will be glad to help you.  That is what we do here.

If instead you are looking for us to provide you code to your specification, there is a place for that also.  Over in the forum named Gigs & Collaborations.  There you tell people what you want, agree on the price you will pay them, and they do the coding for you.

jremington

You don't need an encoder, since your program tells the motor when and how often to step.

RPM = 60*(number of steps/second)/(number of steps/revolution)

123_able

I'm told to do the programme by using any one encoder on the moving motor.The thing is the motor is moving and the rpm of the motor needs to be automatically updated without any person holding it each time.

Johan_Ha

Sounds like you actually mean a DC motor and not a stepper motor.
____________________

If you ask for help and write 'u' instead of 'you' because you think it's convenient, I will write 'no' instead of 'yes'. For same reasons.

123_able

No it's a stepper motor only where i mentioned the speed through setSpeed but still using encoders I want to verify the same thing.How should that be done?Also the speed should be displayed automatically each time.

Johan_Ha

The stepper motor has the speed you set it to have. It's not like you set it to 800 rpm and it measures only 792.4 rpm. It's 800.

It can slip and skip steps and that's the only reason why it wouldn't reach 800 rpm. But that you don't detect by measuring rpm.

If you want to use an encoder plate for checking missing steps, you need a gear box to rotate the plate so that after each step the motor performs, the plate turns so that the encoder output toggles from 0 to 1, to 0, to 1 etc. Then you include to the step function a check whether the output toggled. But such a system would put an extra load on the stepper motor.

In short. RPM measuring wirh encoder plates is for dc motors. The equival thing for stepper motors is checking your code to get the right rpm and adjusting the current on the driver to make the motor run smoothly.
____________________

If you ask for help and write 'u' instead of 'you' because you think it's convenient, I will write 'no' instead of 'yes'. For same reasons.

123_able

For dc motor,how would it work?Though it will put an extra load on the stepper motor still please tell me how to implement it.In short,please tell me both the procedures and the equivalent code for the same.
Thank you,your previous rely was somewhat useful.

Johan_Ha

Here's info on how it works on a dc motor: https://brainy-bits.com/blogs/tutorials/speed-sensor-with-arduino

Instead of a dc motor, you could have a stepper motor there. But you have to understand my point. Your code says to your stepper motor when to take one step. The step is exactly one fraction of a revolution. It either takes this exact step or it does nothing,  depending on how big the load is. There's no halfway step due to heavy load. Therefore you don't measure the rpm on a stepper motor. You get your rpm from understanding your own code.

If you still want to measure the rpm of the stepper motor, just do the same as they do for the dc motor in the page I linked. I mentioned a gearbox earlier, only because I still think it  makes more sense to detect missed steps than rpm. For that you need an encoder platte that goes from 0 to 1 or 1 to 0 for each step your motor takes. If your motor does 1.8 degree steps, your plate needs 100 slots. With a 1:5 gearbox the plate needs 20 slots. With just any number of slots and no gear box you just have to perform extra arithmetics and end up in a rounded value of rpm.
____________________

If you ask for help and write 'u' instead of 'you' because you think it's convenient, I will write 'no' instead of 'yes'. For same reasons.

123_able

Please can you tell me the schematic for measuring the rpm of a dc motor using dual motor driver 5A,arduino UNO and an optical encoder.The code and how the connections are to be made.Please.

Johan_Ha

I thought I did in my previous post. Follow the link.
____________________

If you ask for help and write 'u' instead of 'you' because you think it's convenient, I will write 'no' instead of 'yes'. For same reasons.

Go Up