1
\$\begingroup\$

I want to simulate a simple encoder wheel with two buttons (one for up and one for down). The output of the encoder is as follows:

Waveform

I want to accomplish this without the use of a micro. I have a solution in mind but it would require 3 555 timers to generate the wave form (one to create A pulse, one for delay time on B pulse and third for the B pulse). I am thinking 50 to 100 ms periods would be sufficient. Also, the waveform does not HAVE to repeat while a button is held down. So, the button CAN be repeatedly pressed to simulate a full rotation as opposed to being held down.

Anyone have an improvement on my 3 555s? It just seems so wasteful and I am sure there is likely a more elegant approach.

\$\endgroup\$
4
\$\begingroup\$

I would go for digital. Use a 74HC4017 Johnson counter which you reset at the 4th count, so that your sequence goes 0, 1, 2, 3, 0, 1, etc. Wired-OR outputs 2 and 3 with a pair of diodes to create channel A, and 1 and 2 to create channel B.

enter image description here

The BAT54CW is a double Schottky diode with common cathode, so you'll need only two of them. They also only drop 320 mV maximum at 1 mA, so are suitable for logic powered by 3.3 V or higher.

Instead of the diodes you can of course use real OR gates.

\$\endgroup\$
  • \$\begingroup\$ Hmmm... I think I can visualize that. So a button is tied to the clock input of the CD4017 and 4 is tied to the reset of the counter? But the logic on the reset and 4 wouldn't match so I'd need an inversion eh? \$\endgroup\$ – Jason Aug 16 '12 at 1:51
  • \$\begingroup\$ @Jason - I added a pretty picture :-). The reset is positive logic, so you don't need to invert. \$\endgroup\$ – stevenvh Aug 16 '12 at 1:59
  • \$\begingroup\$ Yes, it is positive logic. I misinterpreted the reset signal on the data sheet. I'll need to go with a true OR gate because the diode drop will place me dangerously close to the minimum input high voltage (Vih). \$\endgroup\$ – Jason Aug 16 '12 at 2:38
  • \$\begingroup\$ @Jason - That depends what you want to connect to it. You wanted to use 555s, which need 5 V, and at 5 V Vih for HCMOS is 3.5 V. Besides, you can use Schottky diodes. The BAT54CW only drops 320 mV at 1 mA, and has two diodes common cathode in a devices, so you would only need two of them. \$\endgroup\$ – stevenvh Aug 16 '12 at 6:57
0
\$\begingroup\$

My suggestion would be to use a 74HC74 on each button to convert the data from that button into a graycode signal (clock the two latches together, and wire the D of the first latch to the Q of the second, and the D of the second latch to the /Q of the first), and then use a 74HC153 to "add" the two gray code signals (feed the S0 and S1 inputs with the Q outputs from one '74. Feed signals 1I0 to 1I3 with Q0, Q1, /Q1, and /Q0 from the other '74, and feed signals 2I0 to 2I3 with Q1, /Q0, Q0, and /Q1 from that same '74.

Pushing the buttons should cause the output sequence to advance forward or backward one step. If swapping a button causes the output sequence to advance in the wrong direction, switch which side of the '74 gets the inverting output of the other. Note also that it's possible that there may be some brief glitches on the outputs when a button is pushed; use of deglitching caps should be able to prevent problems, though.

Edit -- Changed order of signals to 74HC153

\$\endgroup\$
  • \$\begingroup\$ I think this answer would benefit if you could add a schematic. \$\endgroup\$ – Federico Russo Aug 16 '12 at 13:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.