EveryCircuit
Contact
Reviews
Home
thebugger
modified 3 years ago

Rotary Encoder Up-Down Momentary Switch

1
6
391
02:43:50
I am working on an FM transmitter with PLL, where the output frequency is controlled incrementally at 100kHz steps through an up/down momentary buttons. Needles to say, I fancy something different than two boring push buttons, so I turned to rotary designs. It took quite some research to find what I need to accomplish an up/down switch based on the clockwise/counter-clockwise movement of a rotary switch. The circuit here simulates a continuous turning of a rotary switch. An incremental rotary switch will have 2 outputs, and each turn will give you 90dgs phase shift between the two outputs. By using a bit of logic circuitry, you can find out the direction of the switch based on this unique phase shift quality of the rotary encoder. If the output B is trailing behind output A for a given position, then the switch is rotated in a clockwise position. A vice versa situation would mean the switch is rotating in the opposite direction. As you can see, the circuit is fixed on the clockwise position right now. Click on the logic source to simulate a reversal of the direction of the rotary encoder, and the logic will start clicking the down button instead. P.S. The two 555 timers are an easily simulateable version of a one shot trigger. In order for the circuit to work reliably, the output needs to always fall back to zero, regardless of the switch position. Without this monostable flip flop, one of the positions of the rotary switch will keep one of the outputs at a logic high (constantly ON state). There are better monostable flip flops than the 555 timer, but it works as a proof of concept
published 3 years ago
jason9
3 years ago
Why not just use a potentiometer and ADC with the less significant bits cut off to limit it to however many discrete positions you want?
thebugger
3 years ago
Not sure if you can control direction like that... Gotta give it some thought
PrathikP
3 years ago
You can kinda control the direction by Sensing whether the pot voltage is increasing or decreasing. But a pot won't turn forever, so it cant replace a rotary encoder.
jason9
3 years ago
How does this type of rotary switch work anyway? I was assuming it to be roughly potentiometer like or something but that seems to not be the case.
thebugger
3 years ago
From what I understand, it's got 2 phototransistors that activate through slits in the wiper wheel. The slits are made to be 90 degrees out of shift, so one output activates at 25% delay than the other. This phase shift can be used to determine direction or rotation through this circuit.
jason9
3 years ago
Oh I see! I watched a video about computer mice and one kind of old mouse had a ball on the bottom that would roll when you moved the mouse and the way for detecting motion worked exactly like you described. In that case it seems better suited for digital circuitry than analog circuitry, especially given the discrete nature of the rotation steps since each phototransistor is (ideally) either on or off.

EveryCircuit is an easy to use, highly interactive circuit simulator and schematic capture tool. Real-time circuit simulation, interactivity, and dynamic visualization make it a must have application for professionals and academia. EveryCircuit user community has collaboratively created the largest searchable library of circuit designs. EveryCircuit app runs online in popular browsers and on mobile phones and tablets, enabling you to capture design ideas and learn electronics on the go.

Copyright © 2025 by MuseMaze, Inc.     Terms of use     Privacy policy