Pages: [1]   Go Down
Author Topic: Quadrature Encoder and PWM Input  (Read 634 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.


* ScopeCapture.jpg (24 KB, 514x319 - viewed 14 times.)
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 291
Posts: 25884
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
« Last Edit: March 29, 2012, 04:28:11 pm by AWOL » Logged

"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.

0
Offline Offline
Shannon Member
****
Karma: 201
Posts: 11740
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

[ I won't respond to messages, use the forum please ]

Pages: [1]   Go Up
Jump to: