course, it saves those additional resistors and capacitors too, which all helps reduce the
cost and complexity of the kit! This is the reason why in this kit, you will not see any resistor
or capacitor debouncing of any of the controls. Everything is done in the software.
The rotary encoder is debounced using a state machine, rather than any timing loops. The
rotary encoder produces two switch-closure outputs which have a 90-degree (quadrature,
again) phase shift. The microcontroller can monitor these transitions and determine the
number of “clicks” of the rotary encoder, and the direction the knob was turned in, and at
the same time debounce the switch transitions.
Another unnecessary component often seen is a pullup-resistor on a switch signal to a
microcontroller, so that when the switch is open (not pressed) the microcontroller sees a
“high” voltage. This is unnecessary because modern microcontrollers such as the
ATmega328P all contain configurable internal pull-ups!
I had a little more trouble when it came to the “Select”, “Rotary” (shaft of the rotary encoder)
and “Exit” push-buttons. Despite thinking that the microcontroller had plenty of I/O signals
available, when I came to implement all the features I had in mind, I realized there weren’t
enough I/O signals to read the buttons!
The solution was to analogue-multiplex all three buttons onto a single input signal to the
microcontroller, which is one of the Analogue to Digital Converter (ADC) channels. No
microcontroller internal pull-up is used because I need to have precise control over the
voltage levels.
The circuit fragment above shows the rotary encoder, and the three buttons (two tactile
switch buttons, plus the button internal to the rotary encoder shaft) which are located on the
front panel PCB.
The input signal is pulled low by a 10K resistor R46. One side of all three buttons is
connected to the I/O pin. The other sides of the buttons are connected to 5V via different
resistors: 3.3K (R44) for the left (“Select”) button, 1K (R45) for the right (“Exit”) button, and
direct connection for the center (“Rotary”) button. When one of the buttons is pressed, the
resistors form a potential divider that sets the voltage to the microcontroller depending on
which button is pressed. Some calculation results in the following table of voltages
depending on which button is pressed:
Button pressed Voltage
QCX-mini assembly Rev 1.05_Fr
112
Summary of Contents for QCX-mini
Page 14: ...QCX mini assembly Rev 1 05_Fr 14...
Page 16: ...QCX mini assembly Rev 1 05_Fr 16...
Page 17: ...QCX mini assembly Rev 1 05_Fr 17...
Page 18: ...QCX mini assembly Rev 1 05_Fr 18...
Page 20: ...Main board Display board Controls board QCX mini assembly Rev 1 05_Fr 20...
Page 26: ...QCX mini assembly Rev 1 05_Fr 26...
Page 30: ...QCX mini assembly Rev 1 05_Fr 30...
Page 40: ...QCX mini assembly Rev 1 05_Fr 40...
Page 44: ...QCX mini assembly Rev 1 05_Fr 44...
Page 49: ...QCX mini assembly Rev 1 05_Fr 49...
Page 59: ...QCX mini assembly Rev 1 05_Fr 59...
Page 77: ...QCX mini assembly Rev 1 05_Fr 77...