Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : Victory over a Rotary Encoder on Picomite
Author | Message | ||||
apalert Newbie Joined: 06/07/2023 Location: AustraliaPosts: 15 |
Feel it's worth sharing this. My task today was to get a rotary encoder working with my current Picomite project. Started with Geoffs notes in "Getting Started With The Micromite". Got it working, sort of. The problem is inconsistency as many before me have discovered. Adding 100nF switch bounce caps as per Geoffs book helped, as did using external pullup resistors instead of the internal ones as per an Arduino forum. But still quite glitchy. I'd kicked off around 6:30am. By mid-day I was getting frazzled! Gut feeling said it was still a switch bounce problem. Swapped out the 100nF caps for 2.2uF and magic happened! I'd call it 99.9% cured. The only fault I can get out of it is if I twist the RE knob a large amount as fast as I can it doesn't increment or decrement the total number of times it should. Maybe the caps cant recover fast enough? Might try an intermediate values sometime, say 1uF. Should I diode protect the pico inputs with 2.2uF caps connected directly to them? And I'll add, switching back to the internal pullup resistors reintroduced a small amount of inconsistency. |
||||
phil99 Guru Joined: 11/02/2018 Location: AustraliaPosts: 2135 |
@matherp has a cure for that here:- https://www.thebackshed.com/forum/ViewTopic.php?TID=10568&PID=124755#124755#124755 |
||||
PhenixRising Guru Joined: 07/11/2023 Location: United KingdomPosts: 858 |
If speed is an issue, the Mikroe Click "Counter" board features the LS7366 quad-counter. Easy to talk to (SPI) and can count up to 40MHz @ 5v. Slower if 3v. |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 6098 |
2.2uF seems very high. I guess it depends on the encoder but I have no issues with 0.1uF. An external pullup of about 10 is my preference rather than relying on the internals. Jim VK7JH MMedit MMBasic Help |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6787 |
I wouldn't use anything above 100nF (0.1uF) across a rotary encoder contact. They are very flimsy things unless you buy expensive encoders. Repeatedly having a relatively large capacitor discharged through them won't help their longevity. :( Peter's software, as Phil99 mentions, works extremely well without capacitors. Well, it does for me. :) Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
apalert Newbie Joined: 06/07/2023 Location: AustraliaPosts: 15 |
Thanks, yes, I did find Peters code but it threw up errors and I felt daunted to try and fix it. However, you prompted me to take another look. Immediately after Peters post in that link you sent me another TBS member, goc30, posted a revision of part of Peters code that fixes the problems I was having. And yes, it works beautifully even without caps or external resistors. |
||||
Dave_K1SWL Newbie Joined: 31/01/2024 Location: United StatesPosts: 1 |
(New user here- sorry for the lengthy quote) I use series resistors of a few hundred ohms outboard of the switch-bounce caps. They cut down on the discharge current transients. I'm using the Pico in transceiver designs. Those resistors go a long way toward cutting down on noise impulses as I tune around in frequency. -Dave_K1SWL |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6787 |
That's an excellent idea, Dave. ...and welcome to the 'Shed. :) Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
Print this page |