# 2 Encoders and Serial @ 119200

I'm needing to read two quad encoders. They are 600 PPR, which gives a total of 2400 pulses per revolution, measuring the rise and fall of both A & B. The maximum speed they will see is 120 RPM. I need to count their pulses per 10 milliseconds as Xval & Yval. Then compute sqrt(Xval * Xval + Yval * Yval) and output the result over hardware serial at 119200. With the Atmega328, this means each encoder would only have one interrupt pin as there are only 2. Can the UNO handle this? I'm going to set up a test bench scenario but is there a way to tell if the process I can handle this? Maybe it'll have no problem, maybe it can do it reliably? Thanks

There's PCINTs also.

Don't know what that is. Will do some research. ...if you have any good suggestions for info on it let me know.

I'm guessing PCINT is short of PinChangeInt. A very useful library. I don't know if there are other libraries using the same techniques are not.

I used it to capture pulses from a RC receiver. It worked much better than other techniques I had tried.

PinChangeInt seems like a good match for monitoring encoders.

I'd think you'd need to be careful about how much serial you output.

The serial output would only be about 4 characters. About 20 times a second. That be every 50 millis. I'll check out PinChangeInt.

SouthernAtHeart: I'm needing to read two quad encoders. They are 600 PPR, which gives a total of 2400 pulses per revolution, measuring the rise and fall of both A & B. The maximum speed they will see is 120 RPM. I need to count their pulses per 10 milliseconds as Xval & Yval. Then compute sqrt(Xval * Xval + Yval * Yval) and output the result over hardware serial at 119200.

You mean a baudrate of 115200, right?

Which is the counting resolution you need?

A 600 PPR encoder is providing a 600 full-step resolution per rotation, or 1200 half-step resolution per rotation, or 2400 quarter-step resolution per rotation, just as you like (or need) it.

So what do you want to count: 600 full-steps, 1200 half-steps or 2400 quarter-steps in one rotation?

SouthernAtHeart: With the Atmega328, this means each encoder would only have one interrupt pin as there are only 2. Can the UNO handle this?

Just doing a rule of thumb calculation: 2400 quarter-steps per second and 120 RPM (2 per second)= 4800 quarter-steps per second. Looks doable for me.

I think, that should be no problem, as long as - the encoder is an "optoelectronic encoder" (no signal bouncing) and not a "mechanical encoder" - the programming logic provides no-bullshit-code and avoids bullshit-programming Unfortunately 99% of all Arduino "rotary encoder libraries" are providing bullshit programming only. So ypu would have to avoid those 99% of available Arduino libraries.

Which is the encoder you are planning to use? Manufacturer? Type? Datasheet? Do you have the hardware already and can test it?