Incremental encoder counter

First time goes

I have been trying to make a hardware counter for an encoder for a while, basically I want to not rely on the Arduino to capture the pulses, I was thinking there must be a way to count pulses with a counter chip and poll it periodically with the Arduino. I found this site:

He uses an inverter, a couple of gates, latch, and a counter chip to count pulses. I assembled the circuit on my breadboard, and am having an issue.

The counter (74hc193) has a 4 bit output, I connected the 4 bits to LEDs and am turning the encoder slow enough to see the individual pulses change the LEDs. When I rotate CW its fine I can count along with it as I turn the encoder (5,4,3,2,1,15,14,13.....). When I rotate CCW, it is acting strange, it counts 1,2,1,3,4,3,5,6,5,7,8,7,9,10,9,11....or in binary: 0001 0010 0001 0011 0100 0011 0101 0110 0101 0111 1000 0111 1001 1010 1001 1011 and so on.

Looks like two steps forward and one back. I am using the HC series of chips instead of LS since that is what I had. I've tried several things to correct the counting up, I wrote a small sketch and used the Arduino to simulate the A and B phases instead of an encoder, I've added capacitors to isolate each chip, swapped new chips, and same response each time....I'm stumped, anyone have any ideas? I can post a few pics of my setup if it's of any use.

Cheers, -Dave

Post the schematic as you wired it. Perhaps there is a simple wiring error.

I think you'll be better off with software. Use one pin connected to an edge-triggered interrupt (rising or falling, doesn't matter). In the ISR (interrupt service routine) check the other pin. If it's LOW, increment else decrement. When using the counter, disable interrupts briefly. Be sure declare the counter "volatile".