Need help reading pulses from motor encoder
das
Posts: 3
Hi,
I have a motor with an encoder that output 6 pulses per revolution.· I want to build a feedback circuit so that I can set two motors to the same speed.· Thus, I need to read the motor encoder output of each motor.· Does anyone know how to do this with a Basic Stamp 2?
At 12V, the motor runs about 123 rpm's.
Thanks,
Dean
I have a motor with an encoder that output 6 pulses per revolution.· I want to build a feedback circuit so that I can set two motors to the same speed.· Thus, I need to read the motor encoder output of each motor.· Does anyone know how to do this with a Basic Stamp 2?
At 12V, the motor runs about 123 rpm's.
Thanks,
Dean
Comments
You might have better luck using the PULSIN command to measure the width of the pulses. Then, adjust motor speed so the pulse widths are the same.
That way you don't have to dedicate all the processing time trying to keep track of the pulse streams from the two motors.
Or, use the COUNT instruction to count pulses for a fixed amount of time. Then adjust motor speed so the counts are the same on both motors.
More info on both commands is available in the Help file.
Cheers
Now, I am trying to write a feedback routine that speeds up or slows down the motor until the desired speed is reached. I am using the digital potentimeter that came with the "What is a Microcontroller" class. However, I noticed that the granularity of the resistance is not very good.
Any ideas?
The motor speed is controlled based upon the voltage in (from 0 to 5v).
Thanks,
Dean