Register to reply

Arduino/Encoder Question

by jgeating
Tags: arduino or encoder
Share this thread:
jgeating
#1
Mar12-12, 03:06 PM
P: 36
So I am reading a rotary encoder through an an arduino using interrupt pins for the quadrature output. I'm not an expert, but the system seems to work fine, i.e. gives correct output readings. It is for a pneumatic inverted pendulum, which can jitter, and change the cart velocity very suddenly. I have noticed that after running for several seconds, the angle drifts. When I realign the pendulum with gravity, the angle has drifted several degrees. Even shaking it with my hand (pneumatics turned off) causes the angle to drift.

Encoder is a S1-1250 by US Digital. 1250 counts per revolution, with standard, ground, power, ChA, and ChB outputs. (Unused index channel). Have tried an arduino mega as well as duemilanove, and two separate encoders (same model number). Someone recommended getting an "encoder counter" because the pulses are probably too high for the arduino.

However, a previous student did the exact same project without problems. The only differences are that my rail friction is much lower (3X lower), and my pendulum is a carbon fiber rod with a weight on the end, while his was just an aluminum shaft.
See http://dasl.mem.drexel.edu/~jiyueHe/...rted_pendulum/ for the tutorial I'm following

Thanks,
-Josh
Phys.Org News Partner Engineering news on Phys.org
Identifying long-distance threats: New 3D technology could improve CCTV images
Intelligent system that predicts when alarms might be triggered could greatly improve the management of industrial plant
3D printed nose wins design award
schip666!
#2
Mar13-12, 01:24 PM
P: 595
I would place a small bet on missing interrupts. If the drift is always in the same direction you might have asymmetric processing times on one input.

You could try an external counter to compare the number of interrupts you get, or simplify your program somehow to keep an accurate count.
jgeating
#3
Mar16-12, 07:49 AM
P: 36
Drift is in both directions, but usually CW. The program is simplified to the point where only the encoder related code is present. I also directly downloaded a simple encoder program from the arduino website and the problem still remains. I also eliminated serial output and used an LED to indicate where the supposed 0 point is. It always still drifts when I shake it about.


Register to reply

Related Discussions
Best Projects using Arduino? Electrical Engineering 7
Air valve for Arduino platform Mechanical Engineering 1
Arc via pwm circuit (arduino) Electrical Engineering 5
4:2 Bit Priority Encoder question Electrical Engineering 0
Why? question about optical encoder Electrical Engineering 2