Encoder signal processing (ATmega2560)

I've got a project that I'd like to incorporate the processing of an quadrature encoder signal. That is, to take the input pulse rate and scale an output to a different value. 3600ppr input to 1600ppr output for instance, while keeping track of the absolute position relative to an outside trigger event.

I understand that the output will always need to be a small amount of deviation from the actual position because it takes time to do the math, I'm interested to know if this is something the Arduino is capable of handling in the first place.

Max input from the encoder is 3600ppr @ 800rpm = ~42khz pulse rate

If the desired output pulse rate was to be converted to 1800ppr then the Arduino would need to produce a 21khz output at the same time. All while maintaining an accurate pulse count.

To add to the processing woes, I'd like it to report at least the pulse rate via serial to my display at the same time.

Pipe dream with this hardware, or?

See Encoder Library, for Measuring Quadarature Encoded Position or Rotation Signals
A teensy could be considered

Keeping pace with Serial will be a challenge, may. Be you can report once every second to not get stuck with the small output buffer and of course you want a super high baud rate

48 kHz.

scale an output to a different value.

No problem for division by factors of 2. The math is tricky for other factors.

I'd like it to report at least the pulse rate via serial

How often?

Five times a second should be enough I suppose, although I would prefer double that.

From the reading I've been doing it seems that a 16mhz cpu isn't going to be quite up to task for scaling the output directly at those rates let alone leaving any headroom for other, even simple tasks.

How fast can it count? If I were to count only half the pulses, or even only the rising edges of A or B, would it be able to keep up with a 3600ppr encoder spinning 800rpm? This would be counting at 12khz?

In this case I would start counting upon an external trigger, and then send a digital output(s) high after a X number of pulses (distance).

It is no problem to count pulses at 48 kHz in software, using a 16 MHz Arduino Uno. All you need to do is increment a variable.

For counting at up to about 6 MHz, you can use the Input Capture Function and/or external input of hardware Timer1.

I suggest to buy one and learn by experiment.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.