Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 6 of 6

Thread: Connect a 9v powered optical encoder to a teensy 3.2 ?

  1. #1
    Junior Member
    Join Date
    Aug 2019
    Posts
    3

    Connect a 9v powered optical encoder to a teensy 3.2 ?

    Hello.

    I have a project in which I need to connect this optical rotary encoder (http://www.ekt2.com/pdf/96_ROTARY_ENCODER_HN38-06-N.pdf) to my teensy 3.2.
    Alas, contrary to the given specifics, it does not work at 5v, it needs at least 5.2v to work
    I have 9v availlable in my project, but I'm afraid I'll burn my teensy if I use it.
    Will it?

  2. #2
    Senior Member
    Join Date
    Oct 2012
    Location
    Portland OR
    Posts
    676
    The linked datasheet does not say what the output voltage is. At any rate you must not exceed the voltage tolerance of the specific pins you are using on your Teensy 3.2.

    "All digital pins are 5 volt tolerant on Teensy 3.2 & 3.1. However, the analog-only pins (A10-A14), AREF, Program and Reset are 3.3V only."
    -from https://www.pjrc.com/teensy/teensy31.html

    If your device has any chance of delivering anything above 5.0 V (or 3.3V if you use those pins) then you need to add circuitry to reduce the voltage. A resistive divider might be the easiest.

  3. #3
    Senior Member
    Join Date
    Nov 2017
    Location
    Belgium
    Posts
    102
    The datasheet clearly states that the outputs are open collector and will not output any voltage without a pull-up resistor.
    You can safely power your encoder with 9V, connect the each output to it's teensy pin and for each output add a pull-up resistor to 3.3V.

  4. #4
    Junior Member
    Join Date
    Aug 2019
    Posts
    3
    Yeah! Many thanks to both of you.
    I didn't saw that info about 3.3v max on analog pin and I realise I had my potentiometers wired with 5v to analog. However, this didn't fried my board but it explains why I reached the max value before going all the way on my potentiometers. One problem solved

    About the encoder, would the internal pull-ups do the job or do I need to add some?

  5. #5
    Senior Member
    Join Date
    Nov 2017
    Location
    Belgium
    Posts
    102
    Quote Originally Posted by Kraod View Post
    About the encoder, would the internal pull-ups do the job or do I need to add some?
    The internal pull-ups are probably too weak for the job, so add external pull-ups. I usually use 10k resistors for mechanical encoders which are meant to be turned by hand. In your case something between 1k and 4k7 should do the job. The lower the resistance or the stronger the pull-up, the cleaner the signal will be.

  6. #6
    Junior Member
    Join Date
    Aug 2019
    Posts
    3
    Yeah! It worked like a charm. I just had to connect the 9V Gnd and the 5v Gnd for this to work.

    Thanks again, I can now go further in my project!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •