VK5TM

Home

Rants

Contact

News, Updates and Other Minutiae

Help wanted Can anyone help identify a piece of music from the 70's? See the home page for the details

November 2021 A desk lamp mod (well, more of a bodge) - halogen to LED conversion using LED strip. Find it under the 'Misc' category.

August 2021 The Simple DDS VFO has been updated to add band change functionality. It is on it's own page in the homebrew menu.

June 2021 Battery Monitor project updated and finalised.

May 2021 Added another Rant about the scabby manuals that come with stuff these days. Added page and files for a 3d printed box for the Noise Canceller courtesy of Gary VK6GS

January 2021 Paypal button added to Noise Canceller page. Updated the PK3 programming adapter - some spare pcb's available.

Privacy Policy uploaded. It may be viewed at the Privacy Policy link in the footer. As of October 2017, I will be asking for a donation in exchange for providing custom modified code for my projects to help keep this site available. GPDR and all that stuff In accordance with various bits of legislation around the world, either currently in force, about to come into force or proposed, you will now find that annoying "We use cookies" notice at the top of this website. The full Privacy Policy is available at the Privacy Policy link in the footer at the bottom of the page. (If you don't know what GPDR is, Google it. Real scary shit for ANYBODY with a web presence.)

Encoder Headaches

Or - a trap most have fallen into?

While working on another custom modification of the DDS Module, I spent about a week banging my head against the wall, cussing, using other nasty words and throwing things around the workshop. Why? Because the !#%$* encoder wouldn't work properly when the DDS code was modified and migrated to an 8 pin PIC. Nothing to do with the encoder changed in the code transplant other than the pins it was connected to. Even looking at an oscilloscope wasn't helping (it showed the problem, but wasn't helping). Instead of getting this:

encoder quadrateur phase

I was getting this:

faulty encoder quadrateur phase

What on earth was going on? It was a brand new (if cheap) mechanical encoder. Tried changing pullup resistors and the value of the filtering caps but nothing made any difference. Even went so far as to try Schmitt inverters and 'D' Flip Flops to try and cure the problem. Here is the snippet of the schematic as it relates to the encoder and I can tell you, the problem is right there, staring you in the face.

encoder circuit

Have you worked it out yet? Come on, it's simple when you know - keep trying. And no cheating by scrolling down. Annoying aren't I! Oh, all right, here's another clue - how are the caps supposed to discharge? Via the encoder when it's contacts connect to gnd I hear you say? Maybe so, but it's already too late by then. Besides, what are the caps supposed to do? Eliminate contact bounce, right? All right, stop yelling, here's the answer: Question, how can the caps eliminate contact bounce when they (the caps) are already fully charged and the software is configured as 'active low'? With 100n caps, the bounce time of the contacts is too fast to properly discharge the caps and the input pins of the PIC are high enough in resistance that they aren't going to help either, so nowhere for the spikes of contact bounce to go. Solution:

modified encoder circuit

This way, the caps are held discharged so that when the encoder contacts connect to ground, they are more easily able to absorb the small voltage fluctuations. With the values shown, I now get nice clean quadrature signals (don't be tempted to increase the value significantly, the trailing edge will develop a nasty curved appearance that will cause problems). Get out your scopes and cheapy mechanical encoders and try it. I know it solved my problem. (I had a couple of narky emails saying what a load of bull, but you can bet they didn't actually try it. Also, a couple of experimenters have reduced the caps to 1n and commented that it worked out better for them.)

Obligatory Legal Stuff Copyright © 2011 - 2021 T Mowles VK5TM. (All rights reserved) Privacy Policy Unless otherwise noted, all content on this website belongs to the site-owner. No person, corporation or other legal entity is permitted to make use of this content in any fashion or for any use other than personal use, without the express written permission of the site-owner except for fair use provisions as allowed by appropriate copyright law. See website Terms & Conditions. Content contained in offsite links and all trademarks belong to their respective owners. Valid CSS!