I thought incorporating a rotary switch into my next project would be a simple matter. Not really! Gray code, quadrature phase shift and switch debounce studied, and I'm still nowhere near a working switch.

By Julian

Youtuber, shed dweller, solar charge controller aficionado

12 thoughts on “Project: 20-position rotary switch #1 – quadrature phase shift”
  1. Avataaar/Circle Created with python_avatars CoolRandy says:

    Any ideas on how to lengthen a switch like this?

  2. Avataaar/Circle Created with python_avatars videolabguy says:

    If you take the two quadrature encoder outputs, debounce them with Schmidt triggers, and feed one to the CLK input of a 74HC74 D flip flop and the other to the D input of the '74, the Q output will indicate direction. Next take the two debounced quadrature signals through a 74HC86 XOR gate, you will get double frequency clock on the output. An easy peasy hardware solution!! I just interfaced my first quadrature encoder, the same as the one in this video, to an Arduino. It took a day of research but was very simple to make work with only software in the end.

  3. Avataaar/Circle Created with python_avatars Phasor Systems says:

    Can't pay for conventional circuit simulators? come upon androidcircuitsolver on google

  4. Avataaar/Circle Created with python_avatars Anna Arze says:

    Hello, could you please tell me the model number of the switch.

  5. Avataaar/Circle Created with python_avatars Barry Etting says:

    Thanks for the video! really helpful in figuring out how to use the encoder i bought

  6. Avataaar/Circle Created with python_avatars Murali S says:

    Hi ,, in your video ,it shows both pin A and B of encoder are low state always in the shaft resting position. but most of encoders both pins are either low or high in their shaft resting position..

  7. Avataaar/Circle Created with python_avatars Panagiotis Kalogeris says:

    Hello Julian.Nice video! I have bought lots of this rotary encoders (keyes style) and all of them have 30 detents (positions or 'clicks for a 360 degree rotation) instead of 24 that you say to your video. Do you think that the manufacturer might have used different rotary encoders? Thanks for sharing your exprerience. Regards

  8. Avataaar/Circle Created with python_avatars Mohammedyasar Shaikh says:

    Hello sir, I need a 10 position rotary switch without microcontroller and only with mechanical and electrical system, because I want to set it to my project when microcontroller fails so we can use it, thanks

  9. Avataaar/Circle Created with python_avatars CARBON says:

    Frome where i can buy that swich? Cheers

  10. Avataaar/Circle Created with python_avatars Taran Agnew says:

    what are the DT, SW and clk used for?

  11. Avataaar/Circle Created with python_avatars Hola! Ragav Elan says:

    Hey what is the PPR value of your old opto coupler encoder with disc?

  12. Avataaar/Circle Created with python_avatars Fried Mule says:

    This is simply genius! You take a noob like me by the hand, down the rabbit hole to the debts of a complicated subject, but in a way everyone can follow!
    Thanks a lot for making these videos!! 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.