The origins of this project
For my latest project I wanted to use rotary encoders. They have really cool haptic feedback for a user and it gives your user-interface a very "organic" feel at the age of everything touch-screen based.
The problem I faced with them are related to bouncing. Sometimes; the encoder would register a counter clockwise turn when you have been turning clockwise the whole time; or the button would trigger a few times.
From this frustration came the idea to design a little module that would be completely bounce free. Debouncing is a bit of an art but there's an article on hackaday that explains pretty much everything you need to know:
I designed a first prototype using Schmitt-trigger gates and a RC network and this was the first version of this:
I used 0805 surface mount components for these, but I still could not get everything on one side of the PCB.
The back contains the three Schmitt-trigger gates; 10k/10nF RC network, and 100nF decoupling cap.
When testing, it was absolutely amazing, bounce free rotary encoder as expected. I checked an edge using my scope:
... Very satisfying indeed!
Pushing to a production run!
I originally posted this little module in r/electronics on reddit, and some people suggested I should sell this module. For the next few weeks I then proceeded to transform this pet project into a real product. Based on the experience from the prototype, it was clear I had to make two changes first:
- Add an additional M2.5 mounting screw hole so that it can be really tightened if needed.
- Shrink everything so that it fits on one side of the board.
To achieve this "shrinking process"; I switched to 0603 components and replaced the SOT-23 gates by SOT-553 (0.65mm pitch just like a typical SSOP package).
And here it is in all its glory!
It's also the first time I used a stencil a lead-free solder to assemble the board. PCB Assembly was way too expensive to justify investing so much money into a little pet project and so all assembly is manual.
Working with lead-free solder was actually surprisingly easy. From this experience I can highly recommend SAC-305 paste (96.5% tin, 3% silver, and 0.5% copper) which is very good lead substitute.
What about software encoders?
To conclude, I should mention that while I was doing this project, another awesome encoder module was gaining a lot of traction:
and its second revision:
It's an encoder debounced in software through a micro-controller that you can query as a slave I2C device. These are two different approach:
- The hardware debounced encoder is a plain encoder; but that acts as the theoretical "perfect" encoder.
- The I2C encoder mentioned above is a complete package that transform an encoder into an I2C device.
Both approaches have their merits; and ultimately it will be up to what you need for your project.