Arduino and Rotary Encoder w/ GPS Project

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
dpaulc
 
Posts: 34
Joined: Thu May 09, 2013 11:40 am

Arduino and Rotary Encoder w/ GPS Project

Post by dpaulc »

I need to log the number of pulses from a rotary encoder. The encoder is attached to a shaft that may turn a small increment about every second. The shaft will rotate, hold, then rotate again -- repeatedly throughout the day. I'm not concerned with encoder direction as it moves only one way.

I can NOT log any zero values and need to log the count from the group of pulses between the shaft pause interval. Boiled down I need to log how far the shaft turns each time it rotates. I'm not sure about how to go about this. Any ideas?

User avatar
Franklin97355
 
Posts: 23911
Joined: Mon Apr 21, 2008 2:33 pm

Re: Arduino and Rotary Encoder w/ GPS Project

Post by Franklin97355 »


User avatar
dpaulc
 
Posts: 34
Joined: Thu May 09, 2013 11:40 am

Re: Arduino and Rotary Encoder w/ GPS Project

Post by dpaulc »

I have created a pulse counter that works fine. It's that I have to count pulses in groups at irregular intervals that's giving me troubles. Is this a job for interrupts?

Here's the logic:

Wait for pulses.
When pulses start, count them.
When pulses stop, total them and log this value (along with GPS position),
Repeat

User avatar
Franklin97355
 
Posts: 23911
Joined: Mon Apr 21, 2008 2:33 pm

Re: Arduino and Rotary Encoder w/ GPS Project

Post by Franklin97355 »

Post your code, perhaps we can give you some pointers.

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”