I'm trying to connect an optical encoder (Bourns EN series) to AVR microcontroller, and a few things are not clear for me from the datasheet.

At first, datasheet says that the maximum supply current is 26mA, but do I have to limit current (i.e. by putting resistor on VCC) or this means it just drains not more than 26mA and can be directly connected to +5V?

And a second question: do I need to put any pull-up resistors on Channels A/B, or I can just connect them directly to AVR pins?


1 Answer 1


Just connect Vcc and GND, you don't have to limit current on Vcc and GND. Ch.A and Ch.B are your outputs. The maximum supply current (26mA) in combination with maximum output current (25mA) implies that you do have to limit the output current. Notice that you have two outputs that can be active at the same time. In my opinion maximum output current per pin should be limited to 25mA / 2 = 12.5mA. I personally would advise to keep the output current a fair bit lower (factor 2..10) than the these maximum ratings.

  • \$\begingroup\$ Thanks for your answer. So, I guess if I connect Ch.A and Ch.B to AVR pins configured as inputs with internal Pull-Up to VCC (100k), everything should be fine, since maximum current will be very low, right? \$\endgroup\$
    – ovk
    Apr 21, 2013 at 8:57
  • 1
    \$\begingroup\$ That should work just fine, yes. \$\endgroup\$
    – jippie
    Apr 21, 2013 at 9:01
  • \$\begingroup\$ The datasheet even states voltages for LOW and HIGH output, so I don't think you need the pull up resistors with this encoder. \$\endgroup\$
    – jippie
    Apr 21, 2013 at 9:07
  • \$\begingroup\$ It is good practice when experimenting to limit the current with a series resistor \$\dfrac{5\text{V}}{10\text{mA}} = 470\Omega\$ (rounded to the nearest E12 value) or more, to protect both AVR outputs and encoder outputs for overcurrent. For example when you accidentally configure the AVR pins as output. \$\endgroup\$
    – jippie
    Apr 21, 2013 at 9:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.