Omron Encoder oddly reversing A B count direction occasionally

Thread Starter

Vinny7102

Joined Feb 5, 2017
11
Hey Fellas,

I have some strange behavior going on with a small battery operated encoder application where on occasion (at startup), the encoder will flip count direction and keep that direction until I turn off and restart the unit.
Most of the time, this distance counter works perfectly without a hiccup, but then all of a sudden when I turn the unit on, it just throws a fit and goes into reverse mode and counts oppositely in both directions. It acts exactly as though I swapped the A and B wires coming out of the encoder. I tried another Omron as well as the counter ic to see if it was faulty but no luck.

I was hoping someone may have some possible avenues for me to look at or try as I'm fairly green at this yet. I dont currently have a scope either but willing to find one if you think I need it.

Here is my full setup.
Omron E6B2-CWZ6C rotary encoder wired to an LS7366r counter chip and a XTAL OSC XO 27.0000MHZ oscillator for timing.
Adafruit Feather nRF52 controller
Sharp memory display


I have ~4.8 to 4.9v going to the Omron and 10k pullups on the A & B output legs going into the LS7366r.
I don't have any caps on the A or B and the Z is not hooked up (mainly because I'm really not sure of how to implement it or if I even need it)

Any help or advice would be appreciated.
Attached are the datasheets for the LS7366r and the Omron Encoder if needed.

Regards,
Vin
 

Attachments

Marley

Joined Apr 4, 2016
502
According to the data sheet all internal registers are reset when the IC powers up. But it might need the power voltage to come up quite fast.

Possibly, once the microcontroller code runs you could (after a delay to make sure the IC is properly up and running) have an initialising routine that clears everything again before starting the main code. I have only had a very brief look at the datasheet but I think this can be done.

You are properly filtering the power supply with 100nF caps very close to the supply pins? Be careful with noise on the encoder A and B inputs.

Edit: Where is your fck signal coming from? Make sure it is properly up and running before trying to count encoder pulses. If it's a quartz crystal they sometimes take some time to start-up. Once again, have an initialising routine after a sufficiently long delay.
 
Last edited:

Thread Starter

Vinny7102

Joined Feb 5, 2017
11
Marley,

Thanks so much for the reply as this makes perfect sense.

The fck signal is coming from an XTAL OSC XO 27MHZ. Pardon my lack of knowledge with proper circuitry, but are you referring to filtering the power supply to the counter IC? No, I do not have any caps in there for that, but I will definitely add them to the board (learning a lot here as I go along).
You mentioned 100nF caps? Would you please elaborate on the quantity and placement within the circuitry?

I'm going to do some experimenting with trying to clear the registers after a delay on startup as you suggested (sounds promising). Well give this all a try and I'll post back the results.

Much Appreciated,
Vin
 

dendad

Joined Feb 20, 2016
4,476
It is alway a good idea to add 100nF caps from the +V volts to the 0V of each Intergrated circuit, as close to the part as you can. And also a few more across the supply volts elsewhere. And an occasional 10uF Tantalum capacitor too. The foundation of a well designed and operating circuit is a clean power supply. My boards generally have more bypassing than is really needed. The capacitors are cheap and well worth putting extras in.
 

Thread Starter

Vinny7102

Joined Feb 5, 2017
11
@Yaakov,

Thanks for the tip, this too makes a lot of sense. I'm using a Pololu power switch in the circuit to control power to everything now but I think I can get the encoder and counter IC switched in sequence using the spare pins on the nrf52 controller and some PMV16XNR N-Channel mosfets timed in the program.
Maybe I can have the encoder and the nrf52 power ON instantly with power and then set delays to power the LS7366r after say 150ms.
Does this sound like a proper way to handle this?

Thanks,
Vin
 

MaxHeadRoom

Joined Jul 18, 2013
28,684
I don't have any caps on the A or B and the Z is not hooked up (mainly because I'm really not sure of how to implement it or if I even need it)

Vin
You should never need any caps on the A,B,Z lines.
The Z pulse is typically used in a CNC machine etc for a homing pulse, i.e. register the home reference position after power up.
Max.
 

Thread Starter

Vinny7102

Joined Feb 5, 2017
11
@dendad,

Ok, so add the 100nF cap straight across the VDD and VSS as close to the chip as possible? I can do this.

Can you please explain the purpose of the 10uF Tantalum capacitor? Should these be added across the +v and 0v of components as well? Or are these more for conditioning power on larger traces on the boards?

Thanks guys, this is perfect!
Vin
 

Thread Starter

Vinny7102

Joined Feb 5, 2017
11
Yaakov,

You bet. I'll let you know how it goes.

I'm going to implement all of the tips posted on this thread and hopefully fix this dreaded issue.

Thanks again,
Awesome forum!
 

dendad

Joined Feb 20, 2016
4,476
The 10uF caps are more bulk power filtering, and the 100nF between VDD and VSS of each chip for higher frequency noice. But both together help to keep your circuit happy. Basically, a low impeadance power supply is what you are after so that when there is a switching pulse, the supply does not bounce around but stays clean. If the supply does have pulses on it, the chips can do odd things. So clean power fixes lots of problems. And having different types and values of caps tend to filter different frequencies.
 
Top