Go Down

Topic: Quadrature Encoder and PWM Input (Read 764 times) previous topic - next topic

SammyJ

Hi All,

For a school project, I am currently trying to use the Arduino Duemilanove in conjunction with a quadratrue encoder to measure linear distance (think of the encoder as an odometer wheel).  Basically all I need to do is count the number of pulses output by the encoder and use simple arithmetic to calculate linear distance.  I am using a 2500 PPR encoder that can be found here: http://www.automationdirect.com/adc/Shopping/Catalog/Sensors_-z-_Encoders/Encoders/Light_Duty_Standard_Shaft_(TRD-S_Series)/TRD-S2500-BD.

Originally, I tried to use the digital I/O pins but they were indicating low and high responses even without turning the encoder.  After that, I tried using using the analog input pins to measure pulses when the encoder was above a certain voltage threshold.  This also gave me "counts" when the encoder was not turning.  My latest attempt has been to use the PWM input pins to determine counts.  I have been unsuccessful though, because of the limited amount of PWM commands to program the board.  I am wondering if it is even possible to do what I am trying to do using this Arduino, or if I should be considering another microcontroller, such as the Pic18 because of its crystal oscillator and ccp pin.  Any and all advice would be greatly appreciated.  Additionally, I can upload some code that I've been using lately if that will help. 

Thanks,
Sam

P.S.  I've attached an oscilloscope snapshot of the pulses produced by a single output on the encoder if this info will help.

AWOL

#1
Mar 29, 2012, 11:26 pm Last Edit: Mar 29, 2012, 11:28 pm by AWOL Reason: 1
Quote
Originally, I tried to use the digital I/O pins but they were indicating low and high responses even without turning the encoder

That usually implies your pins are floating.

I wouldn't use analogue pins on an encoded; they're generally too slow.


Quote
My latest attempt has been to use the PWM input pins to determine counts.

There are no PWM input pins.
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

MarkT

Your encoder wants a 12 to 24V supply and has open-collector outputs - you've accommodated that in your circuit design?

Also that scope trace shows big spikes at the transitions, which shouldn't be there...  Suggests there's a problem somewhere.
[ I won't respond to messages, use the forum please ]

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy