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

Thread: 5v encoder (600PPR) for JOGWHEEL

  1. #1
    Junior Member
    Join Date
    Jun 2022
    Posts
    16

    5v encoder (600PPR) for JOGWHEEL

    Hi,

    I bought this encoder https://www.amazon.fr/gp/product/B015GYY7XU.

    The required Voltage is 5v. My question is Can I power with a 5v and directly connect A and B output to 5v tolerant pin ?

    If not what can I put between the A/B output and teensy pin (diode, resistor ?) ?

    thanks

  2. #2
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    8,274
    Quote Originally Posted by mickael View Post
    Hi,

    I bought this encoder https://www.amazon.fr/gp/product/B015GYY7XU.

    The required Voltage is 5v. My question is Can I power with a 5v and directly connect A and B output to 5v tolerant pin ?

    If not what can I put between the A/B output and teensy pin (diode, resistor ?) ?

    thanks

    The answer to that question is it is Teensy Model dependent.

    Teensy 4.0, 4.1, Micromod and Teensy 3.6 are not 5v tolerant so you would need a level shifter. For level shifters there are several options I typically use https://www.adafruit.com/product/757. There are other options available like from sparkfun as well.

    Teensy 3.5 and 3.2 the pins are 5v tolerant so you could connect 5v output from the encoder directly to the pins.

  3. #3
    Junior Member
    Join Date
    Jun 2022
    Posts
    16
    Thanks I have teensy 3.5.

  4. #4
    Senior Member PaulS's Avatar
    Join Date
    Apr 2015
    Location
    Netherlands
    Posts
    816
    This Wisamic encoder [english page] has NPN outputs so you need pullup resistors connected to both output pins.
    Here is diagram of a similar OMRON encoder:
    Click image for larger version. 

Name:	Capture.PNG 
Views:	10 
Size:	33.3 KB 
ID:	28855
    Those pullups [e.g. 1K] can be connected to 3V3 and than the output signals are safe for any Teensy.

    Regards,
    Paul

  5. #5
    Junior Member
    Join Date
    Jun 2022
    Posts
    16
    Thank you Paul for this advise.

  6. #6
    Senior Member PaulS's Avatar
    Join Date
    Apr 2015
    Location
    Netherlands
    Posts
    816
    Out of curiosity I purchased a very similar rotary encoder from Amazon.
    Hooked it up to a Teensy 3.2 with two 1k pullups from 3V3 to pins 5 & 6. The encoder itsself was powered from the 5V pin.

    Click image for larger version. 

Name:	IMG_20220706_222843.jpg 
Views:	12 
Size:	143.5 KB 
ID:	28871

    With this code, the encoder correctly outputted 2400 steps for 1 revolution.
    Code:
    #include <Encoder.h>
    Encoder myEnc(5, 6);
    
    void setup() {
    }
    
    void loop() {
      long newPosition = myEnc.read();
      Serial.println(newPosition);
      delay(10);
    }
    Hope this helps.
    Paul

Posting Permissions

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