Rotary Encoder Contact Bounce on the UBITX Transceiver

A few weeks after completing my UBITX-based HF transceiver I started to get problems with the reliability of tuning. For example, the frequency would not change quickly enough or the frequency would change in the opposite direction.

The Raduino synthesiser/processor board uses a rotary encoder for tuning and menu functions. The UBITX kit is supplied with a cheap mechanical encoder, type EC11. Virtually all mechanical switches are subject to ‘contact bounce’* and I suspected that this may have been the cause of the erratic tuning I was experiencing. Also, switches can be unreliable if operated at very low voltages or currents. Switch manufacturers usually recommend a minimum ‘wetting’ current to help prevent reliability issues due to the build-up of oxides on the contacts.

To confirm my suspicion about contact bounce, I monitored the outputs of the rotary encoder with an oscilloscope - see below. Although the plot resolution is not great (I used my ancient Tektronix 466 analogue storage 'scope), you can clearly see where the contact bounce is occurring. 


Contact bounce
The rotary encoder output showing contact bounce/chattering


There are several possible solutions:
  • Replacing the mechanical encoder with an optical type
  • Modifying the Arduino software to filter the contact bounce
  • Adding simple low-pass filtering between the encoder and the Raduino inputs.
I opted for adding simple RC filters after the encoder, as this seemed like less work than the other options. Also, by modifying the hardware I had the opportunity to review the switch pullups with respect to the minimum wetting current requirements.

Pull-up Resistors

There are no pull-up resistors on the stock Raduino board. In order to reduce the component count, the designer has enabled the internal pull-up resistance (around 20k) of the AVR processor in the software. Does this give sufficient wetting current for the rotary encoder? Well, the ALPS EC11 datasheet (see link below) is rather confusing regarding minimum wetting current. It specifies a minimum operating current of 1mA and suggest that currents less than 10μA may give problems. But it also recommends using 10k pull-up resistors (with a 5V supply) giving 0.5mA. I decided to include 10k resistors. Note that in practice the current will be a little higher than 0.5mA due to the internal pullups mentioned above.

Filtering

I used low-pass filters on each encoder output, using the component values recommended on the EC11 datasheet.

 Modifications to Raduino board

The schematic shows the modified input section to the Raduino. The modification involves cutting a couple of PCB tracks and fitting the additional components to the underside of the PCB (see photo).  
Raduino
The unmodified Raduino board showing where that tracks should be cut


Raduino board with contact debounce mods
Modified Raduino board
 
EC11 rotary encoder data:
https://www.alps.com/prod/info/E/HTML/Encoder/Incremental/EC11/EC11_common.html

Testing

After modifying the Raduino board, the tuning of the radio is much more reliable. Note however that sharp twists of the tuning knob still can inconsistent tuning rates. I am not sure yet if this is due to the hardware or the software. I would be interested in hearing of others experiences with this.
See update.


* ‘Contact bounce’ is where a mechanical switch contact may inadvertently open and close multiple times when being switched. It can take several milliseconds for the switch to settle to a stable state. There are several workarounds for this including one or a combination these strategies:
  • Use of bistable switching logic
  • Analogue filtering
  • Software filtering. 

Disclaimer: This is my personal blog. Views expressed in my posts are my own and not of my employer. The information provided comes with no warranty. I cannot be held responsible for the content of external websites. Any practical work you undertake is done at your own risk. Please make health and safety your number one priority.



Comments