What is the proper way to connect 5V Rotary Optical Encoder to Teensy 3.6?

Status
Not open for further replies.

Gerrit

Well-known member
Hi,

What is the proper way to connect a 5V rotary optical encoder to a Teensy 3.6? The part in question is a Bourns EM14.
I tried a voltage divider but I need to use 10K resistors otherwise the output of the encoder voltage drops causing me to think that this might not be the proper way. I figure that the encoder is intended to act as a sink, could a single resistor be enough to protect the Teensy pins?

Kind regards,

Gerrit
 
The datasheet feels somewhat lacking to me. I would avoid hooking a Teensy 3.6 up to that until I undershoot how its voltage can be controlled, else risk damaging the Teensy.

From the datasheet it lists:
Output Voltage
Low (VCE(sat)), per Channel.............................................................................................. 800 mV maximum at I(SINK) = 25 mA (current means they can sink)
High (VO(HI)), per Channel................................................................................................ 4.0 VDC minimum @ VCC = 4.75 VDC (they don't list current, this usually means they don't source)
Output Current I(SINK), per Channel....................................................................................25 mA maximum (again, Sink but no mention of Source)

If the outputs produce no voltage when the device is powered with nothing on those output pins and you turn the knob then its most likely an open drain. If it is indeed an open drain you should be able to use a 10K pull-up from 3.3V. I would test with the pull-up to 3.3V but without the Teensy first just to be sure, if voltage goes above 3.3V then I would consider a more complex scheme.
 
The datasheet feels somewhat lacking to me. I would avoid hooking a Teensy 3.6 up to that until I undershoot how its voltage can be controlled, else risk damaging the Teensy.

From the datasheet it lists:
Output Voltage
Low (VCE(sat)), per Channel.............................................................................................. 800 mV maximum at I(SINK) = 25 mA (current means they can sink)
High (VO(HI)), per Channel................................................................................................ 4.0 VDC minimum @ VCC = 4.75 VDC (they don't list current, this usually means they don't source)
Output Current I(SINK), per Channel....................................................................................25 mA maximum (again, Sink but no mention of Source)

If the outputs produce no voltage when the device is powered with nothing on those output pins and you turn the knob then its most likely an open drain. If it is indeed an open drain you should be able to use a 10K pull-up from 3.3V. I would test with the pull-up to 3.3V but without the Teensy first just to be sure, if voltage goes above 3.3V then I would consider a more complex scheme.

Thanks for the reply :)

With the encoder powered and without anything connected to the A & B outputs the output changes between 0V and 5V when I turn the knob. Putting a voltage divider made up of two 10K resistors on the output, i.e. loading the output with 20K, reduces the output voltage to 4V. The output of the divider switches between 0V and 2V.

What am I to make of this?

Kind regards,

Gerrit
 
I'd simply use a standard buffer like the 74LVC125 between the encoder and the T3.6. The LVC series can be powered by 3.3V and has 5V tolerant inputs. You'll get a '125 for about 0.5$ in single quantities.
 
I'd simply use a standard buffer like the 74LVC125 between the encoder and the T3.6. The LVC series can be powered by 3.3V and has 5V tolerant inputs. You'll get a '125 for about 0.5$ in single quantities.

Thank you :)

Would the SN74LVC244AN also be suitable? This is an octal version and it is available in a PDIP package. I need to connect several encoders and I would like to avoid SMD soldering.
It does seem like using a buffer like this is the proper way to connect these encoders.

Kind regards,

Gerrit
 
That should work Gerrit, its sad how little info they give on the workings of those encoders, if they gave us what is needed a simple divider would handle it.

Edit, just a thought, try (encoder > 5K > Teensy >10K > GND) if the signal stays at 4V then that should give you about 2.66V and even if it goes to 5V you will get 3.3V out of it.
 
Last edited:
@ Donziboy: Just out of curiosity: do you have any special reason why you prefer to use 16 resistors to replace a simple 8 bit buffer?
@ Gerrit: Any IC from the LVC series can be operated from 3V3 and has 5V tolerant inputs, so the '244 will work fine.
 
I'm giving him options, I'm not telling him he has to use resistors. In the end 16 resistors may work better then 1 IC or vise versa. It all depends on the user and use case.
 
That should work Gerrit, its sad how little info they give on the workings of those encoders, if they gave us what is needed a simple divider would handle it.

Edit, just a thought, try (encoder > 5K > Teensy >10K > GND) if the signal stays at 4V then that should give you about 2.66V and even if it goes to 5V you will get 3.3V out of it.

I agree, as these are very expensive components one would expect more documentation. While testing I ended up with 10K + 10K because otherwise the voltage would drop too much, this is also why I'm asking this question. The fact that the voltage drops at all just doesn't seem right.

@ Donziboy: Just out of curiosity: do you have any special reason why you prefer to use 16 resistors to replace a simple 8 bit buffer?
@ Gerrit: Any IC from the LVC series can be operated from 3V3 and has 5V tolerant inputs, so the '244 will work fine.

Thanks for the confirmation, I'll get a couple of those then.

As for the usage: The encoders will be used in a high quality DAW (digital audio workstation) controller. They are hydraulically? damped and have a very, very nice feel to them, better than the nicest potmeter. The 64 PPR resolution (256 after decoding) makes it possible to cover the MIDI range (0-127) within a single turn like a potmeter. They are optical so there's no bouncing and the interrupt based encoder library can be used resulting in excellent tracking of movement.

Kind regards,

Gerrit
 
Gerrit, I'm reading this and still not getting it all.
Which encoder (a link) would you get, and how would you make it work with the Teensy?
Some voltage divider?
Using <encoder.h> as in
https://www.pjrc.com/teensy/td_libs_Encoder.html
?
Yes, it is my intention to use the teensy encoder library. The encoders are Bourns EM14 optical rotary encoders. The problems is that they need 5V to work hence the question. I will be using SN74LVC244A octal buffer/drivers to translate the 5V down to 3.3V. I have everything in house but haven't found the time yet to connect it all.

Kind regards,

Gerrit
 
@Davidelvig, if your encoders are basic electrical ones, you can just wire them to gnd and set the input pullups and leave it at that. Problem arises if your encoders contain circuitry that have voltage limits.
 
Status
Not open for further replies.
Back
Top