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

Thread: Encoders with 4067

  1. #1

    Encoders with 4067

    Hi Guys,

    Currently I'm trying to figure out a way to use a 4067 mux to connect 8 encoders. I'm searched online to try and find some information regarding this however haven't been successful thus yet.

    I know how to get a mux working with 16 buttons, however am stumped to figure out how it would work with 2 signals coming from the encoder.

    Any information or direction would be great.

    Cheers.

  2. #2
    Senior Member
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    173
    You'd need two 4067, one for A and one for B. And then you'd need to modify your favourite encoder library to handle the mess. Don't know your requirements but it is probably much easier and still quite cheap to get a TeensyLC, directly connect the encoders to it and communicate the results to your main Teensy via a serial connection.

    This https://hackaday.io/project/27611-i2c-encoder might also be an interesting solution....

  3. #3
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    1,457
    I’m not sure if an analog multiplexer is the best solution for rotary encoders because the timing is critical and debouncing the contacts is a pain in the a... 8 encoders would only use 16 interrupt capable GPIO pins, code for templates encoder classes is available, and the Teensy 3.5/3.6 have more than enough pins. Why bother with multiplexing?

  4. #4
    Thanks for the response guys.

    Why bother with multiplexing..? well I'm currently using a 4067 mux for 16 buttons, which works easily and have a bunch of these around so thought why not use a multiplexer for the encoders as well (in series). I'm trying to minimize the mess and free up pins on the Teensy 3.2 for future expandability.

    Timing is not essential as the encoders will be used by human interaction and not machine based encoders.

  5. #5
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    6,104
    There are 11 digital pins on the backside of the T_3.2. With human generated encoder interrupts the response should be easy to accurately track adding those to some of the topside pins.

    There are solder on boards - FrankB's at OSHPark comes to mind - that provide a castellated surface to solder those pads to pins out the end of the Teensy. That board and other breakout boards on OSH or Tindie are around in posts somewhere.

  6. #6
    Yes, I could always go for the option of using the remaining pins on the Teensy 3.2 or as mentioned, a breakout board for ease of use.. however what if I wanted to use more encoders that require more pins than what the Teensy could provide. Surely, using a mux would allow for further expandability to chain more down the road.

    Although I like to write the code from scratch, I haven't found a library that utilizes a mux for referencing. Anyone got ideas?

  7. #7
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    6,104
    Look one more time for a library if desired - then post #3 could explain not finding one. It seems a general purpose encoder library would only work with direct input - introducing the mux would add overhead and could easily miss transition events.

    For more pins upgrade to T_3.5 or T_3.6 - they are 20% off today at SparkFun.

    Could they be read as a Keypad matrix?

  8. #8
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    17,029
    Quote Originally Posted by luni View Post
    And then you'd need to modify your favourite encoder library to handle the mess.
    Indeed, getting the software to work with encoders through a mux would be quite difficult. Even regular non-mux polling tends to be unreliable if the encoder speed is anything but slow movement on low res encoders.

    Your best path is connecting the encoders directly to interrupt-capable pins (all digital pins on Teensy 3.x, most of them on Teensy LC)

  9. #9
    Junior Member
    Join Date
    Nov 2017
    Posts
    1
    Hi, You can use 8x LS7366R encoder counter (32 bit) and connect to one of the SPI interfaces and chip select them individually with the Teensy (in a way, you get a mux). These counters fast (at least 20MHz counting), reliable (have good internal filtering) and are easy to configure via the registers if you e.g. want to reset the counter from an index pulse or count in quadrature mode, compare with a preset number etc. Buy from usdigital.com, $5.60 each, it's the only source I've found yet.

  10. #10
    Ok thanks guys, appreciate your responses.

Posting Permissions

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