Shop OBEX P1 Docs P2 Docs Learn Events
Need help reading pulses from motor encoder — Parallax Forums

Need help reading pulses from motor encoder

dasdas Posts: 3
edited 2006-06-06 02:36 in BASIC Stamp
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

Comments

  • stamptrolstamptrol Posts: 1,731
    edited 2006-06-03 19:10
    Hi,

    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
  • dasdas Posts: 3
    edited 2006-06-05 05:40
    Thanks. The count command did the job!
    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
  • weirdo557weirdo557 Posts: 7
    edited 2006-06-05 21:07
    you might try to pwm it
  • RGuyserRGuyser Posts: 90
    edited 2006-06-06 02:36
    you may also want to look at the parallax industrial control student book. it deals directly with closed loop control using the digital pot..
Sign In or Register to comment.