Close
0%
0%

Analog Input Hack: Push Button Encoder

Hack a single MCU analog input to support push button rotary encoder.

Similar projects worth following
Push button rotary encoders are popular input devices for making simple user interfaces. Using a pushbutton rotary encoder requires 3 input pins on your microcontroller: 1 for the switch and 2 for the quadrature outputs. However, in a recent application I had only 1 pin remaining on my MSP430G2553. My only choice was to leverage that pin's analog input capabilities. I first sketched out my requirements, then designed a circuit, measured the performance of my design and wrote microcontroller software to realize it.

See my project blog post https://analog10.com/posts/rotary_encoder_analog_input.html for more details.
  • 1 × Push Button Rotary Encoder
  • 1 × 3D Printed Knob The bigger the diameter the better
  • 1 × MSP430 with ADC Evaluation, Demonstration Kits, Boards and Modules / Evaluation Kits, Boards and Modules
  • 1 × 33k Resistor
  • 2 × 15k Resistor

View all 6 components

Enjoy this project?

Share

Discussions

K.C. Lee wrote 06/15/2015 at 18:16 point

From the picture, looks like you have a LCD.  What I usually do is to share the LCD data lines with buttons.  The buttons have series resistors on them so that they don't short the data lines in the output mode.  I set a busy flag in my LCD code during access, so that the timer interrupt code polling buttons would skip the scanning.

  Are you sure? yes | no

Analog Two wrote 06/15/2015 at 19:13 point

That's a pretty good recommendation. Using that technique would also let me sense rotation while the button is pushed.

  Are you sure? yes | no

Mike Szczys wrote 06/15/2015 at 17:43 point

I love this technique. A also never hooked up a rotary encoder to my scope and now I'm going to try with and without your circuit. Thanks for the inspiration!

  Are you sure? yes | no

Analog Two wrote 06/16/2015 at 17:18 point

Thank you for the kind words and the HaD post.

  Are you sure? yes | no

Analog Two wrote 06/16/2015 at 18:45 point

One thing that I should have done is determine if the encoder contacts are break before/after make.  Seems to be after based on the contact bounce levels but only a scope trace is authoritative.

  Are you sure? yes | no

Eric Hertz wrote 06/15/2015 at 17:28 point

Clever!

  Are you sure? yes | no

AVR wrote 06/16/2015 at 04:55 point

I thought of your hack for reading multiple buttons when I saw this funny enough lol

  Are you sure? yes | no

Eric Hertz wrote 06/16/2015 at 09:22 point

Thanks :) I'm definitely adding this to my TODO's, or as most hackers say "to my bag of tools"

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates