==================================== PCB AVAILABILITY - SORRY ALL GONE NOW - No more requests please! ====================================
@stevehallam08503 жыл бұрын
Yes please!
@lambert02593 жыл бұрын
Yes Please Ralph, ive been trying through software to counter act the de-bounce problem on a stm32 MCU
@flemmingchristiansen24623 жыл бұрын
Yes please
@Joe-hu3cq3 жыл бұрын
Thanks for the great video, Ralph! Please count me in for the PCB...
@allensmithphotography3 жыл бұрын
Is certainly be interested in 1 or 2
@kentswanson28073 жыл бұрын
Thank you Ralph. In these days of reduced part counts and "just run a dupont wire" engineering, it is good to see some of the fundamentals being discussed. If I am not mistaken, that debounce circuit is a combination of an RC filter and a 1/2 wave rectifier. #savethebypasscapacitor
@RalphBacon3 жыл бұрын
I'm not sure that any rectification takes place here; it's all to do with that capacitor holding a charge sufficient long to miss the bounce pulses, then allowing the Schmitt trigger to do its magic.
@TheDefpom3 жыл бұрын
I’ve always used two approaches, an RC filter from each output, and also reading the pins twice… works a treat. I actually read both pins to look for the alternating pulses, if it gets two pulses from one pin without a pulse from the other pin then it knows it was a bounce and ignores it.
@RalphBacon3 жыл бұрын
Sounds cool. I'm guessing there are quite a few ways to detect and/or eliminate switch bounce. What I like about this hardware solution is that we no longer have to concern ourselves in the code with such things!
@hopje013 жыл бұрын
And if you use an esp32, you can use the hardware counters. In software you can set a debouncing value. It also helps debouncing. There are libraries available for rotary encoders.
@jfsaraceno92653 жыл бұрын
I use this circuit without the diode. I'll try with the diode and see if an additional component on the bom is warranted
@billfischer70853 жыл бұрын
Thanks, you are a fun and interesting teacher. Always love your stuff. My personal opinion is to use as many parts as needed plus some. When I started college in 1978 parts were orbital in price. Today I will build 3 or 4 extra boards just to test the extremes. The lectures are perfect. Thank You from Bill Fischer
@RalphBacon3 жыл бұрын
Thanks for sharing, Bill! I'm very happy you find my videos interesting (and even useful)! In 1978 we had no Internet, no Asian Market to get cheap components from, no Asian PCB makers (I made my own, Ferric Chloride etc, my fingers were permanently brown) but we did have MAPLIN (in the UK, at least) for components, sadly no longer here. And I was but knee-high to a grasshopper! Cough, cough.
@albertovillar56723 жыл бұрын
Ralph, thanks for sharing that knowledge with us. Very interesting explanations and also recommendations regarding JLCPCB
@RalphBacon3 жыл бұрын
Glad it was helpful!
@edgeeffect3 жыл бұрын
I never cease to be impressed by your video editing.
@RalphBacon3 жыл бұрын
Nice of you to say. I hope the content is equally impressive 😁
@saxhorn15083 жыл бұрын
In aircraft use, a fast twist kicks the interval from 1/click to 5 or 10/click for that twist. Useful for a big change and the lost counts don’t matter anymore.
@RalphBacon3 жыл бұрын
Or, in this case, you could push-click the encoder to make each detent worth, say, 5 normal detents, get to the position you more or less want, then push-click it again to get it into "normal" mode.
@heyok3 жыл бұрын
Thank you! Enjoyable explanations always are appreciated. Cheers, Al.
@RalphBacon3 жыл бұрын
Glad you enjoyed it!
@martinmckee53333 жыл бұрын
Happy to second recommending the debouncing paper to just about anyone interested in electronics to read. It's one of my favorites. Great video about an important topic. I've got an encoder board with a very similar bit of hardware on it, but that's SMD and the components fit on the back side of the encoder along with a microcontroller (NXP LPC845). It will act as an I2C device for use on random projects.
@RalphBacon3 жыл бұрын
Thanks for sharing!! Sounds nice and what I might have done had I used SMD components! Cool.
@mikebond632822 күн бұрын
Ooooh. That’s cool!
@InssiAjaton3 жыл бұрын
Once upon a time there was another switch debounce circuit in one of the "Designer's Notebook" or similar short idea article in one or other electronics Magazine that I apparently remember for ever. It used a Form C contact, two pull up resistors and an RS Flipflop IC. No capacitors or diodes. The switch common was tied to power common and both fixed contacts to a junction of the pull up resistor & S or R input, respectively. Supposedly the switch never chatters all the way to the opposite contact, only opens partially. So the pull up resistors raise both flipflop inputs high, but that does not matter as the IC toggles only at low level input at one of the two inputs and latches. I have used this sometimes and it works like a charm.
@RalphBacon3 жыл бұрын
The bit that does the business, so to speak, in this circuit is the (charged) capacitor and (relatively) slow discharge to allow for some chatter. This must be the basis of all circuits that deal with this problem. The Schmitt trigger ensures that the output only changes when the capacitor's charge drops to the threshold. Which sounds quite like the circuit you're describing, Pellervo; I tell you, there's nothing new under the sun! If you have a link to the article (you have to obfuscate it if you try and post it here or YT will zap it) I'd be interested. Or enough details so I can find it on the Internet!
@RalphBacon3 жыл бұрын
I searched given the information you gave me and found this article which is quite interesting; the first circuit uses no capacitor because the switch goes to ground, not VCC. www.embedded.com/solving-switch-bounce-problems/
@InssiAjaton3 жыл бұрын
@@RalphBacon -- The Figure 1 circuit in your finding is what I recall and have occasionally used. The original article I saw probably in 1970's. In those days the authors got a token payment of $50 per accepted submission. (I got that amount for one submission, although they redacted the description beyond recognition...)
@bluegizmo19832 жыл бұрын
I just built a volume control knob out of one of these encoders. I installed an aftermarket Alpine stereo in my car and it doesn't have a volume knob, just onscreen capacitive buttons for the volume, which I didn't like. My car doesn't have steering wheel controls either, but the new stereo did have a 3.5mm jack for an optional box to interface with a vehicle's steering wheel controls. I found some code online where someone had decoded the protocol it uses to interface with steering wheel controls. I used some of that code, an Adafruit Qt Py ESP32-S2, and an Adafruit Stemma rotary encoded board to create an actual volume knob for my stereo. I found that this Adafruit encoder board doesn't seem to have the issue you mentioned of rotating too fast, as I could spin it as fast as I want and it never skips or loses track. However, this stereo can only accept inputs about once every 150 milliseconds due to the precise timings required for the protocol it uses. So, I had to program a buffer into the code so that if the encoder is spun faster than the stereo can accept a new signal, it buffers the commands and sends them as soon as its ready for another signal. I also used the encoder button/click function to mute and unmute the stereo. I chose the ESP32 because I wanted something with WiFi so that I can do OTA updates to the code without pulling the stereo out of the car every time I wanted to make changes to the code (as the ESP32 is behind the stereo). I coded it so that if I hold the encoder button in for 5 seconds, it enables the WiFi in AP mode and loads the OTA webpage, this way the WiFi is only active when I need to do a code update.
@RalphBacon2 жыл бұрын
Absolutely fantastic work, Daniel. You're obviously an experienced 'maker' and are putting to good use all the skills you have. Yes, OTA updates are a real blessing too, I too use that feature. Interesting that you are writing the data stream to a buffer which then sends the data in a controlled (timed) manner to the stereo. You could also have rejected signals coming too fast from the encoder, I suppose. Cool stuff, I'm impressed 👍🏻
@DerMarkus19823 жыл бұрын
Weirdly (as English is not my primary language), i understood the meaning of your "finger-in-the-air job" statement/idiom @10:04 immediately. Didn't understand it *phonetically* at first, so i had to go back and listen with CCs on. But as soon as i had read that line in the CCs, i had to chuckle a bit. " f i t a " as in, "let's lick the finger and put it straight up in the air to feel where the wind is coming from". 😁 Good analogy!
@RalphBacon3 жыл бұрын
I'm glad I've increased your (already excellent) command of the English language, Markus, but I have previously apologised for using British English similes, as the meaning is often unclear! On the other hand, perhaps non-English speaking viewers appreciate a richer language...
@guidovlaere4 ай бұрын
Thanks From the Netherlands Ralph. Very helpfull video. I'm really a fan from you. You made so many helpfull video's! Thanks again for all your work to make this! 👍
@RalphBacon2 ай бұрын
My pleasure!
@-MrDontCare-6 күн бұрын
Going to try out a 1.3 Inch OLED With EC11 Rotary Encoder Module IIC Interface from aliexpress for the first time, so this was very usefull info. Thanks.
@RalphBacon19 сағат бұрын
Good luck!
@jfsaraceno92653 жыл бұрын
I like your approach of making a single board with both smt and tht components
@RalphBacon3 жыл бұрын
Well, this board unfortunately did not allow for SMT components just through-hole. I've done other boards that allowed both but it was hard work!
@jstro-hobbytech Жыл бұрын
I'll take any pcb you have to offer Ralph!!! I love building circuits and studying them while taking notes. I have thousands of pages written haha
@RalphBacon Жыл бұрын
You should have a blog / website with all that information on it, Joey. Or do you have one already?
@jstro-hobbytech Жыл бұрын
@Ralph S Bacon naw. I'm not the type to put myself out like that. I've been working on doing something locally but I'm kind of a shut in brother.
@asagk3 жыл бұрын
There is a little trick that can be used, which is to connect one of the two pins (A/B) as a trigger for an external interrupt, and tell the direction fomr the state of the other pin as direction whenever the interrupt takes place, which can grant a safe higher turning speed, than with the shown schematic. That is especially true when a flip-flop stores the direction information of the pin that is not used as the trigger, but as a downside requires an additional IC like a 7474. But besides that a very good choice to use an external low pass filter to get rid of the bouncing. ------ Btw. shottky diodes are not used for rectification for some reason, which makes them not the best choice for blocking reverse current. They work to a certain limit the same way as silicium diodes, but do not block currents as fast, caused by their satturation characteritics. So do not expect that a shottky-diode does exactly what you expect when the switch connects the low pass to ground at all times. A 1n4148 (small signal si-diode) might be the better choice for this application, since it sppeds the charging at least up to Vcc-0.7V, while the rest up to Vcc then comes through R2. But when the switch connects the low pass to ground, the satturation charge is removed much fatser, so the time of reverse conducting is reduced until the diode blocks, while a shottky can under circumstances still be in a reverse conducting state. This behaviour is very depended on charge, amount of current, etc. ... but can play a role depending on the application.
@RalphBacon3 жыл бұрын
Hmm. My sketch uses a single interrupt on Pin A and then interrogates the state of Pin B to see which way the rotary encoder was being turned. Not the most elegant bit of code (too many if statements in an ISR) but works well enough to show that no bounces were corrupting the direction information. Isn't that pretty much what you are saying? Regarding the diode, guess what? I wasn't using a Schottky after all, but a 1N4148 (just like you say), much to my surprise when I built the PCB. I was getting confused with my remote temperature sensor from my Smart Heater Controller which definitely uses a Schottky to block reverse voltage flow - works OK in that circuit (a future video will tell all). In this bounce circuit the diodes are optional - might not be needed at all.
@asagk3 жыл бұрын
@@RalphBacon Well, since I did remember something you had mentioned a shottky, I felt to point out that shottky diodes might not fit the purpose, since all the load in the capacitor wants to get discharged at once in reverse mode, so a huge current within a nanosecond, and the saturation characteristics might allow that to some degree, instead a fast small silicium signal diode with little saturation charge might be the better choice then. But perhaps I got your comment wrong then? My bad... :)
@PhG19613 жыл бұрын
In one word: great !
@RalphBacon3 жыл бұрын
Glad you enjoyed it, Philip.
@PhG19613 жыл бұрын
@@RalphBacon I always do. It's part of my Sunday entertainment... ;-)
@mickleuk3 жыл бұрын
Thanks Ralph, got the PCB this morning. 👍
@RalphBacon3 жыл бұрын
Good news! As it's the UK post I was certainly expecting them all to be delivered soon-ish (albeit with a 2nd Class Stamp). Good luck with the construction, it's pretty straightforward.
@mickleuk3 жыл бұрын
@@RalphBacon Put it together straight away. Didn’t take long and works a treat.
@GnuReligion3 жыл бұрын
I've been building Marlin UI's with cheap rotary encoders recently, and am using a similar circuit, minus the R1 and the Schmitt Inverter. Most MCU's will already drive the digital read line high through a high valued resistor. So an easier, passive means is to just use a diode, resistor, and small capacitor for each switch.
@RalphBacon3 жыл бұрын
Sounds great! In fact, it sounds a bit like what @Bernd Felshe was saying the previous comment. Please don't tell me I have another switch bounce circuit to build?
@PolygonSwan3 жыл бұрын
@@RalphBacon subscribed ....it's been 24 hrs ? 😜
@TheUnofficialMaker2 жыл бұрын
did you mean without R2?
@GnuReligion2 жыл бұрын
@@TheUnofficialMaker The idea is to eliminate the Vin+ and R1 because the read pin can be "INPUT_PULLUP", in place of the Schmitt device. You could go the other way (higher complexity), with 2 diodes for a symmetrical no-bounce circuit.
@TheUnofficialMaker2 жыл бұрын
@@GnuReligion got it. thanks
@andymouse3 жыл бұрын
Hi Ralph, in a similar vein I have taken to using touch switches directly on the PCB and I use a chip to handle this that gives bounce free signals and it is the TTP223, they work great. Nice video......cheers.
@RalphBacon3 жыл бұрын
I'm hoping you got the idea from video #143 "Touch Switch 👆 with optional TTP223 module (ESP8266 or Arduino)". Bet you did. All in the subconscious.
@andymouse3 жыл бұрын
@@RalphBacon Oh Yeah ! you have used them I do believe that's where I heard about them ! ...It's been a long time!.....cheers!
@fredflintstone13 жыл бұрын
Cheese!!
@andymouse3 жыл бұрын
@@fredflintstone1 Squeak !
@byronwatkins25652 жыл бұрын
If you work it out, the inversion doesn't matter; A still changes before B (and vice versa) and the counts will be the same. Similarly, whether A,B are pulled down or up (as long as the common is the other) does not matter. tau1=(100 n)(82 k) = 8.2 ms and tau2 = (100 n)(18 k) = 1.8 ms. This gives a cutoff frequency f = 1 / (2 pi 10 m) = 16 Hz. If more than 16 cycles / revolution, then you have reduced the maximum rotation rate below Bournes' specifications in exchange for filtering the bounce noise. You could also save the cost of the diode by placing the 18 k in series with the switch and connecting C and the inverter 'in' between the resistors. Most port inputs also have hysteresis -- although Schmidt triggers usually have more.
@RalphBacon2 жыл бұрын
I'm not going to check your calculations, Byron, so let's assume they are correct. Your changes may work but until you actually try them out... you know what mean. 😉
@RalphBacon3 жыл бұрын
PLEASE READ THIS EVERYONE!
@IanSlothieRolfe3 жыл бұрын
Where the bounce doesn't seem to go all the way up to supply voltage is probably just where the pulse is so brief that the input capacitance of the oscilloscope is still charging when the voltage is sampled.
@RalphBacon3 жыл бұрын
Sounds very plausible, Ian. Some of the bounces were very brief indeed. Such a source of irritation to us developers!
@borayurt663 жыл бұрын
I used a crude RC filter together with a software debouncer routine in my never ending Nixie Clock project's rotary encoder. Although it is working perfectly as it is, I am intrigued to change the design once more to this and get rid of the software debounce part in the code. This is exactly why my projects seem to get forever to finalize :-) Thanks!
@RalphBacon3 жыл бұрын
Well you can build the debouncer circuit and try it out on a spare chip, I am sure, before committing to changing your project (again!).
@borayurt663 жыл бұрын
@@RalphBacon Always. I never integrate anything in my designs that I haven't made to work as a prototype. The whole Nixie project has been running on 5 protoboards at the moment and I keep adding, removing stuff (hardware/software) all the time. If I am happy with the result, it gets included in the final schematic.
@lelandclayton54623 жыл бұрын
I've seen that circuit all over the place for many years. Typically I see 100K and 10K resistors used and different variants of the Schmitt Trigger either as TTL or CMOS. I also seen a circuit that uses a 555 timer as a debounce, I never tried it but looked interesting.
@RalphBacon3 жыл бұрын
Interesting! I'm sure Jack Ganssle's circuit is being used everywhere! By varying R2 in the circuit (I use 18k2) we could adjust the bounce delay (eg 1mS - 10mS) because the cap will still hold its charge. As I say, interesting!
@edgeeffect Жыл бұрын
Some (many?) microcontrollers have built in Schmitt triggers on their inputs.
@lelandclayton5462 Жыл бұрын
@@edgeeffect Yea but controlled in software.
@YoutubeBorkedMyOldHandle_why3 жыл бұрын
Good explanation. I used exactly this same debounce circuit in a little button board I made, for each of the 12 buttons on the board. It works great ... no more dicking around with software debouncing ;-) Mine is SMD.
@RalphBacon3 жыл бұрын
Yes, Richard (see, I worked it out!), I was going to use SMD but gave the reasons why I didn't in the video. An SMD version would be much more compact. I'm almost tempted!
@YoutubeBorkedMyOldHandle_why3 жыл бұрын
@@RalphBacon Thanks for the reply Ralph. You are the first person I'm aware of who has "worked it out." I would have just used my real name, but the ascii version was already taken. Nothing personal intended with the SMD reference, I just tend to use SMD as much as possible. This was particularly true for my little button board, because 'through hole' would have increased the size considerably. Also, I liked your observation that JLCPCB (and others) offer up to 100x100mm without penalty, so why not panellize small boards? I've done this a few times. But my real pride and joy is a little table saw I made with an old sump pump motor and metal scraps, to which I attached a shaft and one of those thin fibre cutting disks. Since then, I've filled up my PCBs with as many projects as I can stuff onto each board, and when the boards arrive I use my diy table saw to slice them all up. Works great ;-)
@RalphBacon3 жыл бұрын
Your SMD reference was spot on, Richard, I'm beginning to wish I'd made it that way now! When I panelise a board with JLCPCB, by the way, I choose V-Cut which enables me to just gently snap them off, no sawing necessary.
@YoutubeBorkedMyOldHandle_why3 жыл бұрын
@@RalphBacon Of course panelizing absolutely makes sense ... 'if' you need many identical boards. But consider this my predicament: I've been using 1.27mm pitch headers with different pin counts. I occasionally need to fabricate cables, or to convert from 1.27 to 2.54 pitch. So, I made these little tiny boards, Dip to Dip, SMD to Dip, 2x3, 2x5 pins etc. I have several useful configurations. There is a fabrication cost penalty for mixing different boards on panels. I could panelize each, but now I'd end up with hundreds of boards, and I just don't need that many. Similarly, I may have several projects for which I really only need one or two boards. Don't forget JLCPCB, is already providing 5 copies of each. Having the ability to cut my own means that I can (and have) put all sorts of different boards on a single panel making use of most of the available space. There are pros and cons to doing it either way, but I'm talking too much ... why don't I just show you? ... drive.google.com/file/d/13v_rhqNyMphHWalQLJxw260QPXI82dvX/view?usp=sharing Cheers.
@RalphBacon3 жыл бұрын
Right, I see what you have done! I'm not sure I could do that with EasyEDA as the PCB is an entity in its own right. And it's always created from the schematic. To combine the boards would required some other action - how do you do it, create the PCBs directly without a schematic?
@egonsvensson27283 жыл бұрын
Interesting content as always, keep up the good work.
@RalphBacon3 жыл бұрын
Thanks Egon, glad you found it interesting.
@maxximumb3 жыл бұрын
Nice approach to the problem.
@RalphBacon3 жыл бұрын
Thanks! It certainly is one way of sorting out those pesky bounces.
@jstro-hobbytech3 жыл бұрын
I'm in nova scotia Mr. R.S Bacon or I'd take one off ya. You made an incredibly dull topic highly interesting. Great video
@RalphBacon3 жыл бұрын
Nova Scotia still has a postal service though, right? Send me an email and I'll add you to the list, Joey.
@grozaadrian41343 жыл бұрын
just a few days ago did a de'bounce on a rotary encoder with schmitt trigger as you describe, i had to poll pin A stat for high / low and low/high to get 1 increment/decrement per tick and works like a charm. Suggestion since .. its a hex inverter, would of been cool somehow to be able to chose if you want the final signal high or low by using the other 3 schmitt trigger in series or not. Great video Ralph ! nvm: i just saw you said about it :D
@RalphBacon3 жыл бұрын
Thanks for sharing. Yes, using the other three gates is most do-able but by then the circuit was designed, the PCB on order... and I discovered it about an hour before I made the video. Oh well, high or low, it works!
@therealemmpunkt3 жыл бұрын
if you put the components on the backside, there would be more space in the front to mount it in a panel...
@RalphBacon3 жыл бұрын
Yes, indeed. Just looking at mine here, if the 74XXX14 chip were soldered directly to the PCB (no socket) then the rotary encoder would fit onto a front panel and nothing gets even close to that. Or redesign it with SMD components, as I originally was going to do.
@thomawhite Жыл бұрын
Thanks Ralf, I'm addicted to your content. Regarding this project - is there an optimal voltage for VCC?
@RalphBacon Жыл бұрын
The datasheet for this exact Schmitt trigger chip (SN74AC14) says it works from 2v to 6v, so should be good for an ESP32 (or other 3v3 device) or an Arduino UNO (or other 5v device).
@fredflintstone13 жыл бұрын
Nice video Ralph, I stopped throwing switches on the floor that stopped them bouncing :-)
@RalphBacon3 жыл бұрын
Yes, that would most definitely work too. Unfortunately you couldn't really have that floor-bouncing switch in a decent enclosure or you'd have enclosure-bounce too. For which I have no solution. Other than a visit from the men with those cute white jackets, very long sleeves and very long belts...
@fredflintstone13 жыл бұрын
@@RalphBacon those men in white coats expelled me from my last place there:-)
@BerndFelsche3 жыл бұрын
You can do without the Schmitt trigger chip as digital inputs on microcontrollers have threshold levels for each logic level and known input impedance. There is typically hysteresis as well. With some rearranging, the resistors can be reduced by employing pull-up (or pull-down) on the microcontroller inputs. You have to do the maths! 😎😁
@RalphBacon3 жыл бұрын
Sounds feasible... but only proven in practice. Let me know when you've tried it, Bernd!
@LimbaZero3 жыл бұрын
Yep. You can check MCU IO block diagram if it have schmitt-trigger input. It seem at least AVR has these.
@markday31453 жыл бұрын
As do STM32. On the RP2040, the Schmitt trigger is enabled by default, but can be disabled in software.
@NormanNodDunbar2 жыл бұрын
Hi Ralph. Happy Christmas. I'll see your "ultimate" switch debouncer, and raise you the MC14490P hex debouncer. I use these when debouncing switches, surprisingly enough, and one chip takes up to 6 separate switches and requires only a single capacitor to set the frequency of the debouncing circuitry. You can pull each attached switch up to VCC or down to GND depending on your needs -- but they do all have to be the same. Other than that, it's surprisingly good! Happy New Year when it comes. Cheers, Norm.
@RalphBacon2 жыл бұрын
Hmm. I see that sales of your (excellent) Arduino hardware book must be doing well to suggest a chip that retails for £5.69 (RS Components) in single quantities! Yikes. I've read the spec sheet and I'm sure it's wonderful but "my" simple hex-input SN74AC14N chip costs just 45p when bought in packs of 10 - still less than a single MC14490P. Along with a resistor or two and a capacitor it still makes it very pocket-money friendly. Seriously, I wouldn't mind spending a few pounds extra on a personal project (just look at the cost of some of my project cases!) but on a commercial basis, cheaper is better (mostly). Just ask our Chinese suppliers!
@NormanNodDunbar2 жыл бұрын
@@RalphBacon £5.69? Each? Goodness gracious! I got a pack of 10 for much less some time back from eBay. I'll have to check prices. Insert suitable delay here.... eBay has lots from China. Ranging from a pack of 10 for the price of one from RS, to a pack of 50 for £37. I expect some might not be kosher, but mine work fine. Cheers, Norm.
@RalphBacon2 жыл бұрын
"I expect some might not be kosher..." Oh, really? 🤣😆😊
@NormanNodDunbar2 жыл бұрын
@@RalphBacon Yes, really!😉😉😉
@Clark-Mills3 жыл бұрын
The inverter MUST be a Schmitt triggered input gate; the 7414 is, so great. In the schematic the gate should show the Schmitt symbol. If you don't use a Schmitt input gate you get noise as the input gate voltage passes through the grey zone where the input might be read as a logic one or logic zero.
@RalphBacon3 жыл бұрын
Indeed. I did emphasis that there was no "linear" (or grey) zone with a Schmitt trigger, hence why it was being used. The schematic symbol was one from the manufacturer, I think, without the Schmitt symbol, how remiss!
@sleepib2 жыл бұрын
R2 and the diode aren't needed here. When the switch contacts are closed, you know what state the switch is really in, so you should discharge the cap without delay. When the switch contacts are open it could be actually open, or it could be in the middle of a bounce, so that's when you need the delay. Given the scope shots, your delay is longer than it needs to be, as you only need to smooth the longest single bounce, rather than the whole settle time(and manufacturers generally specify the whole settle time). That said, you want to be characterizing heavily worn switches, so you can pick the lowest value that won't impact long term reliability. Basically, don't sacrifice performance to solve problems you don't have. If your debouncing circuit gets you reliable operation at high rates of rotation, by all means use it. For an encoder this RC + hysteresis method is good. If you have a double throw switch you can do better though, use a non-inverting buffer with positive feedback, read the common pin, and tie the NC and NO pins to opposite rails. The switch will latch in the state of the last closed contact, even if it closes for a fraction of a second before getting stuck on some dust that breaks continuity. No delays needed.
@RalphBacon2 жыл бұрын
Hmm. Whilst, in principle, what you say sounds very plausible, given that each switch is different, Jack Gansle has done some _serious_ work on this subject of switch bounce so what he has discovered must have merit. Of course, as you (and I) say that each switch is different we are free to modify the code/hardware to suit - but in a commercial environment we would defer to the lowest common denominator - the worst example of switch we found (or specified by the manufacturer). So if the datasheet says 60rpm *max* that's what we should allow. In a hobby environment if we discover, empirically, that _our switch_ can manage 200rpm, so be it!
@sleepib2 жыл бұрын
@@RalphBacon I suspect that 60RPM max is just what the manufacturer believes will work with simplistic software debouncing(only a few samples, rather than the continuous sampling you get with hardware debouncing) and a switch at the end of its rated cycle life. When I've compared new and heavily worn switches on a scope, the worn ones bounce a lot more, but the individual bounces don't get THAT much longer, because the single bounce time should be mostly determined by the mass and springiness of the contact. Here's an example of a new mechanical mousewheel encoder and one that's been used for several years(same model, purchased at same time), even though the worn switch looks horrific in comparison, the longest single bounce there is still only ~40us, so you shouldn't need several milliseconds to filter it out: imgur dot com/a/0W7sO6Y I read the section of the paper that second resistor and diode were discussed, and I don't think they apply here, maybe if the switch was a long distance from the debounce circuit. Even then, you can get rid of the diode and lower R1 by the value of R2. At 5v, R1 can go as low as 2.5k and still stay inside your encoder's ratings. At least for the push switch I'd probably use 10k for R1, omit the diode, either 0 or 1k for R2, and 100n for the cap. Very high value pull up resistors can cause problems depending on what material the switch contacts are made of, and we don't know the pushbutton contacts are self wiping like encoder wipers would be.
@Olavotemrazaodenovo3 жыл бұрын
Great job!
@RalphBacon3 жыл бұрын
Thanks, Glaucio!
@romancharak36753 жыл бұрын
I played with Jack's circuit some time ago, but I think my Oscilloscope probe setup added some extra ringing on the screen, causing me some confusion. Thank you for this interesting topic, Ralph.
@RalphBacon3 жыл бұрын
I detected no ringing in my experiments so maybe it was your probe setup, Roman. Glad you found this interesting and thanks for posting.
@__--JY-Moe--__3 жыл бұрын
I would like to see you make an optical encoder ! I know you can !Outstanding work as usual! Harry Potter's proof of concept!
@RalphBacon3 жыл бұрын
Well, an LED, an opto-sensor and a circular disk with bits cut out of it placed between the two. Hmm. Now you got me thinking.
@Roy_Tellason3 жыл бұрын
@@RalphBacon You might find some useful bits to do this in an otherwise defunct computer mouse...
@romancharak36753 жыл бұрын
They already make Optical Rotary encoders, they are much more expensive. Are you thinking of a DIY version, @Fantasy Engineered?
@jensschroder82142 жыл бұрын
the solution is not only for rotary encoders, but also for buttons, switches, reed switches and others. i ordered circuit boards from china, it's cheaper than from england.
@RalphBacon2 жыл бұрын
Yes, this is a general purpose switch debouncer, that is true!
@Enigma7583 жыл бұрын
I noticed that your code does not use the state machine technique. I suppose that's because Gannsle's approach is good enough thereby rendering any further software techniques redundant.
@RalphBacon3 жыл бұрын
You are correct. The previous Rotary Encoder video used the state machine technique, but even then it was possible to miss a pulse if the loop() was particularly busy (or awaiting a response on, say, SPI). It also depends on how much work you put into the ISR, of course.
@tonybell15973 жыл бұрын
Nice one, thanks Ralph….
@RalphBacon3 жыл бұрын
My pleasure!
@leec2106 Жыл бұрын
How much did the 30 PCBs cost? Did you ever make a surface mount PCB? I think I may build my own SM version for my project! I am using 1 single button and a toggle left to right to control a stepper motor. The single will bypass the pot setting and go full speed, otherwise it will do a percentage of speed set by the potentiometer. Lee
@RalphBacon Жыл бұрын
I've made a new (tiny) one recently, using a single SMD Schmitt trigger chip. Works well. Email me for more details (if you want them, of course!)
@edgeeffect Жыл бұрын
Now I know how I've managed to b----r up the rotary encoders in my synths.... turning them at 10,000 RPM isn't such a good idea? ... I wrote that comment before you brought up 10,000 RPM... I like the fact that we both have the same idea of what constitutes "stupid speed" :)
@RalphBacon Жыл бұрын
You _can_ turn _optical_ encoders at that speed (well, check the data sheet). But several thousand rpm is not uncommon.
@sunuk19153 жыл бұрын
Awesome job 👏
@RalphBacon3 жыл бұрын
Thank you! Cheers!
@TonyLing3 жыл бұрын
Did you not think of adding mounting holes to your PCB design? Excellent project, I watched with great interest.
@RalphBacon3 жыл бұрын
Well, Tony, TBH as this is more of a break-out or development board I didn't consider it (bad Ralph). I was trying to keep it small. But you can mount the rotary encoder on a front panel if the chip is soldered directly to the PCB. Even when using the socket I think it could work. You could mount it on another PCB (host/motherboard) by using the connectors intended for the header pins, of course. I've done that many times with dev boards without mounting holes. My next break-out board _does_ have mounting holes so I have already learned my lesson! Glad you liked the video!
@paulpkae3 жыл бұрын
Think I suggested Schmitt triggers on your last video Ralph. Schmitt triggers, Op-amps, Comparators, Decade counters, Multiplexers, Shift Registers....... all excellent IC companions to micro controllers. The decision to solve a problem through software or hardware is a common dilemma. Personally I get more satisfaction going the hardware approach and not rely on code so much. I really like the idea of creating custom PCBs and I must get round to giving that a try. Your boards look great!
@RalphBacon3 жыл бұрын
You could well have done, Paul, although I have covered a hardware solution before (using a different chip) a few years back. But this was with a PCB and everything (well, except mounting holes, apparently). I do like the hardware solution too! It's what we intuitively expect from any switch, a simple on/off action!
@rpasco93522 жыл бұрын
Why are there no switch(es) debouncer(s)/switch(es)+debouncer(s) modules available ANYWHERE ???
@RalphBacon2 жыл бұрын
You mean, why can't you buy them? Because most developers either cater for the debounce in software or create their own hardware solution. Probably not worth a dedicated solution (although I did find some out there, silly money).
@banalestorchid58143 жыл бұрын
You should have made the board through hole AND SMD, that would be really cool.
@RalphBacon3 жыл бұрын
Well, as I said in the video, I was _going_ to make it SMD (to make it smaller); then I would have had space for some mounting holes too. As it happens, through-hole is probably best for most people (the needs of the many outweigh the needs of the few) but there was really no space left for mounting holes. Sorry! My next board does have mounting holes though, keep tuned.
@gregtoman76783 жыл бұрын
I have never required more than an RC circuit to interface to a rotary encoder, EXCEPT for the bourns. I stopped using Bourns encoders because of the horrible performance, and the deceptive information they provided me when I talked with them. Great advice in the video, and I will implement this in my next design just to give myself more tolerance for a bad encoder, but I do not recommend using any Bourns encoders...you are asking for problems. They should be ashamed.
@RalphBacon3 жыл бұрын
Thanks for the info! I was _hoping_ that Bourns was a reliable make; your experience says otherwise. Hmm. More investigation needed!
@buzzwerd80933 жыл бұрын
Your circuit has an RC delay built in between switch change and debounced signal change. Software debounce does too but I wonder which is quicker.
@RalphBacon3 жыл бұрын
Most switches are done with bouncing around after 2mS but I use 5mS in my software and don't have issues. The hardware version could be tweaked by adjusting the cap or better the R2 resistor to suit the switch being de-bounced.
@arminth3 жыл бұрын
Did I miss the link to the debouncing paper?
@RalphBacon3 жыл бұрын
I guess you did - it's in my GitHub (link in the video description) but here too: github.com/RalphBacon/230-Ultimate-Switch-Bounce-Eliminator - good reading even if I didn't fully understand all the maths.
@arminth3 жыл бұрын
@@RalphBacon as usual, the error was sitting in front of the computer! Thanks for pointing me to the right direction!
@jacquesmertens33692 жыл бұрын
Why haven't the manufacturers come up with this? What's stopping them from improving the KY-040?
@RalphBacon Жыл бұрын
In a word: Cost. Whilst you (and me) think that 50 cents or even $2 is a worthwhile investment in ensuring we have a bounce-free Rotary Encoder or switch, the bean counters at Acme Inc do not. They see no return on their investment, so don't do this. If they want the functionality, they leave it to the coders to implement. So as hobbyists we can "afford" to over-engineer our solutions. You could not (afford to) do this in a commercial environment. Not unless your company name is Apple. 😲😁
@Tasbir3970 Жыл бұрын
Great content
@RalphBacon Жыл бұрын
Thanks! Would you believe I'm having to switch debounce something right now. Sigh.
@Tasbir3970 Жыл бұрын
😀@@RalphBacon
@staticpower41052 жыл бұрын
What about optical encoders? Are they limited for speed of rotation?
@RalphBacon2 жыл бұрын
Optical encoders are usually not limited but the datasheet will specify a maximum.
@andrewtoogood87743 жыл бұрын
Great Video Ralph :) When you present us with you fantastic research and findings not only do you educate us but you get our minds working, hence the many suggestions :) Sorry but I also have one: Is there any way of using your detection of interrupt < 20ms to give you a + 5 for that 20ms so it feels like there is no over spin limit and spinning it fast works fast? i.e. When "too fast" is detected set a variable and when you reach the acceptable 20ms threshold don't add 1 in that direction add 5 or more because the variable was set?
@RalphBacon2 жыл бұрын
The 20mS "Too fast" message was just there to show how my car deals with me spinning the volume control too quickly - it just ignores the "click" rotation entirely. You can reduce that if your rotary encoder still reliably works - but the manufacturer put the max rpm there for a reason! But you could easily set a flag (in the ISR) if the rotation is too fast and when you get the next < 20mS pulse detect the flag, add +5 and reset the flag. Simples!
@lezbriddon2 жыл бұрын
just a thought i had while thinking of this today, although i watched it months ago, the schmitt trigger inverters, if the microcontroller has hysteresis of its own on its input pins, would they really still be needed....
@RalphBacon2 жыл бұрын
The microcontroller is more than quick enough to detect all the switch bounces going, I'm afraid. The difference with and without Schmitt triggers has to be seen (on an oscilloscope) to be believed!
@lezbriddon2 жыл бұрын
@@RalphBacon I'll swap 2 resistors and a little cap for lines of my code anyday...... The simple mistakes I've made in code I'll take hw over it anytime lol
@Alltechfab406 Жыл бұрын
Can I get a bit more info on the sn74ac14n on digi-key there is so many options on different switching voltages, what are you using?
@RalphBacon Жыл бұрын
For the demo in this video I was using 3v3. This was undoubtedly because I was using an ESP32 and I didn't want 5v appearing on any of the input pins from the Rotary Encoder (A/B/PB pins). The SN74AC14N is tolerant to 7v, however, so if you have an Arduino Uno (or other 5v microcontroller) it's safe to use 5v.
@Alltechfab406 Жыл бұрын
@@RalphBacon sorry for the silly questions I'm pretty new to this, am I correct in thinking that eats that of pins across from each other is a different trigger? Is the multiple pins able to be used for multiple inputs and outputs I'm not sure I'm saying that correctly. Maybe a better way to say it is Can I with one of the sn 74ac14n chips denounce say 4 buttons, or do I need one chip for each circuit? Thank you for your time!
@daedelus19822 жыл бұрын
Great video, really well explained as ever. Stupid question probably... In your code you have your ISR triggered on change, so you are watching on falling and rising edges. Why can't you have the ISR trigger on pin A falling edge only? From the ISR you can then just read pin B to check if pin B is high or low and whether the turn is CW or anti-CW? A lot less code that way. Ive probably missed something obvious, so apologies.
@RalphBacon2 жыл бұрын
No, it's not obvious at all. This particular rotary encoder has a detent part way through the cycle. If I only watched for falling (or rising) edges I would have to rotate it TWO clicks to get the full cycle detection. By watching for both edges I detect all clicks (detents). I've found that the cheap(er) rotary encoders from the Far East don't have the mid-cycle click so your 'rising' watch will work fine. I've done a video (#19, getting on a bit now but still works well) on those too: kzbin.info/www/bejne/gGrGdXibm5V8mLM BTW If you need a PCB from this video I still have some, just send me an email with your address.
@daedelus19822 жыл бұрын
@@RalphBacon Aha, makes sense now. Thanks. Im actually having a go at making an SMD version of your's/Jack's circuit using JLCPCB. Using their SMD soldering service means I don't need to solder so much and I can make it much smaller as you said. Havn't done any board fabrication before or used any circuit design software so its a bit of a learning curve for me. Fun though. I'm sure I'll make a few mistakes, JLCPCB is very cheap though even with the shipping. Thanks again.
@WagonLoads3 жыл бұрын
I bought 2 rotary encoders from ebay and had a problem that wonder if this circuit can fix. If I turn both encoders clockwise, one counts up and the other counts down. I am guessing that the encoder wheel on one of them was flipped over. Can you tell us about optical rotary encoders? I know some are rated to be attached to motor shafts and spin at very fast rates.. Do they still have a maximum spin rate?
@RalphBacon3 жыл бұрын
Rotary encoders use light to determine the HIGH and LOW values; no switches or physical contacts. However, when I was investigating these, some had a maximum rpm of just 1,000, others 3,000. As these were already in the region of £30 - £40 each I decided I would not proceed with my experiments. I'm guessing that if you were to spend more you could get one with an increased rpm. I'd also recommend buying from a reputable supplier (RS Components, Digikey, Mouser) and the like.
@WagonLoads3 жыл бұрын
@@RalphBacon On Optical encoders, isn't there a transition point when the beam is being partially broken, where there is noise? Or does the optical detector have a built-in Schmitt trigger? Example of what I am thinking: Feed a triangle wave into one side of a comparator and a analog voltage from a pot into the other side. At the point where the triangle wave goes above or below the voltage set by the pot, is there a bunch of noise?
@RalphBacon3 жыл бұрын
I don't know is the quick answer; but I have found one of my optical rotary encoders (a Grayhill) so I might wire it up and try it out...
@WagonLoads3 жыл бұрын
@@RalphBacon Hey (just a side thought) In my example above. using a triangle wave on one side of a comparator, could you make a timer count how long the output is high and use that to make an infinite resolution ADC?
@jyvben15203 жыл бұрын
Got a jlcpcb ad just before, how did they know ? ;-)
@RalphBacon3 жыл бұрын
Big Brother is always watching you, Jyv. And he knows _everything_ about you 😲
@chrismolloy1313 жыл бұрын
I would like one to try
@RalphBacon3 жыл бұрын
Email me Chris! The address is buried in here: kzbin.infoabout
@MrEdwardhartmann3 жыл бұрын
It seems to me that you could do SMD components mounted on the back with the rotary encoder mounted on the front and end up with a unit just slightly larger then the original rotary encoder.
@RalphBacon3 жыл бұрын
Indeed you (or I) could do that, Edward. Even the chip is available in SMD format. But as I explained in the video that would preclude lots of my viewers from taking one of my PCBs and constructing it for themselves. I suppose I should have made two versions but there are only so many hours in a day... I might talk to my MP about a 30-hour day soon.
@MrEdwardhartmann3 жыл бұрын
@@RalphBacon I don't think I would build it myself - JLCPCB's board manufacturing service is so cheap that it's easier to let them do it. And the last time I used them, they had a discount coupon for the cost of assembly, so the 5 boards I was having made cost less the a dollar to have assembled. I don't think I could have bought the parts for that price. The full price for making the boards and doing the pick and place was less then the shipping cost to get it to me.
@MrEdwardhartmann3 жыл бұрын
@@RalphBacon As for the chip, they do carry a SMD hex schmitt trigger chip - SN74LV14ADRG4 in a SOIC-14 case, but I also found a smaller 3 channel chip - 74hc3g14, but they are currently out of stock.
@RalphBacon3 жыл бұрын
I do keep intending to use their SMD Assembly service but keep designing though hole boards! Maybe next time.
@MrEdwardhartmann3 жыл бұрын
@@RalphBacon Just for fun, I did an SMD panel 20x23mm - so a 4x4 panelized board would give you 80 small boards. But, this first layout did not have any mounting holes. As long as you used rotary encoders that bolt through a panel, that should not be a problem. But I could make the board a little wider and add some mounting holes and maybe get a 3x4 panel. (who needs 80 rotary encoders anyway!) Not counting the rotary encoders and the 5 pin headers, the part that JLCPCB would mount would cost about $21 including the $3 charge for the one extended part.
@gregclare3 жыл бұрын
Given that you are effectively implementing a 20ms denounce delay in software (ie. not allowing another pulse for 20ms), I don’t really see the practical need for adding hardware denounce? Although I agree that the 2 resistor, 1 capacitor, plus Schmitt trigger is the standard switch denounce approach. :)
@RalphBacon3 жыл бұрын
In its current form, that is true, Greg. But the 20mS "Too Fast!" message was there merely to demonstrate the point. There is no need for it in real life. If someone does spin the rotary encoder that fast that it cannot cope, well, on their heads be it!
@joerideman2 жыл бұрын
Now that I have happily implemented the Pinteric algorithm I can turn as fast as I want. Out of the 20 cycles per whole rotation I miss 6 of them for being to quick. The algorithm prevents any bounce effects as if I was turning the other way. Why would you want to solve this with components?
@RalphBacon2 жыл бұрын
One reason to do this with components, not software, is to relieve the microcontroller from having to service the interrupts. It greatly depends on what your software is doing _apart_ from waiting for an interrupt, of course! But you could find that the main loop is significantly affected by all the ISRs (and associated function calls). It's the same with NeoPixels. Sure, you can run many hundred NeoPixels from a relatively fast processor - but you won't have any clock cycles left for anything else. That's why they invented NeoPixel Drivers, so the microcontroller can do lots of other work and just chuck stuff over the wall for the NeoPixel Driver to take care of. Horses for courses, as they probably don't say anymore 😁
@ronalddhs37263 жыл бұрын
Hi Ralph, Thanks for the vid. How do I contact you to get a PCB off your hands (I'm in the UK). Thanks again.
@RalphBacon3 жыл бұрын
Here: kzbin.infoabout scroll down to find my email address.
@jumadhaheri3 жыл бұрын
Maybe we can get the ultimate ultimate denounce eliminator
@RalphBacon3 жыл бұрын
Well, where there's a problem, there are a thousand engineers thinking about a solution...
@Charlietuna493 жыл бұрын
I don't understand how to order the pcb.
@RalphBacon3 жыл бұрын
Just "let me know" were the words I used! No details. It was a test. Ok, the best way to tell me you are interested in the PCB is to email me. My email address (carefully hidden so I don't get even more spam than I already do) is on this page: kzbin.infoabout
@Charlietuna493 жыл бұрын
@@RalphBacon Thanks
@johnstephenson28913 жыл бұрын
Hi Ralph. Do you have any left? I don't see a pinned comment.
@RalphBacon3 жыл бұрын
It's there John. Just email me so I can add you to the list!
@johnstephenson28913 жыл бұрын
@@RalphBacon Sorry I must be going blind, I don't see it.
@RalphBacon3 жыл бұрын
You know my email address surely, John?
@johnstephenson28913 жыл бұрын
@@RalphBacon Haha, the reply is which one!!
@hoggif2 жыл бұрын
Why not just debouce in software? I've never debounced with hardwaree. Software is "free" and uses no physical space. Unless you're running out of memory hardware is no better and compact debouncing code uses very little memory space. Having a clean input can enable different kind of software though, like just using pin change interrupts or what not.
@RalphBacon2 жыл бұрын
Why not indeed! Well, you've jumped into the debounce series at Season 4, so you've missed all my software debounce videos: #226 kzbin.info/www/bejne/qYKxgXSpj7Chetk #98 kzbin.info/www/bejne/qXWVYauhi7ybaNU #96 kzbin.info/www/bejne/r5eTi2OXqc2Bg68 #19 kzbin.info/www/bejne/gGrGdXibm5V8mLM Happy viewing!
@hansdegroot652 Жыл бұрын
But great video thx
@RalphBacon Жыл бұрын
You're welcome!
@KaiseruSoze2 жыл бұрын
Optical rotary encoder.
@RalphBacon2 жыл бұрын
Pricey.
@laurentiujinga55583 жыл бұрын
do you still have the pcb? I can't see any pined comment
@RalphBacon3 жыл бұрын
Send me an email Laurentiu (you'll find my email address on this page: kzbin.infoabout) and I'll add you to the list.
@philchadwick94703 жыл бұрын
You must take a MINUMUM of one second Ralph, not a maximum.
@RalphBacon3 жыл бұрын
Doh! Of course I meant minimum! I should have said "one second or more" to make it clearer. I'm sure (most) viewers will have understood that it was not a race... I hope! (Smacks forehead with palm of hand - hang on, got an emoji for that) 🤦♂️🤦♂️🤦♂️
@harveyellis67583 жыл бұрын
"not unsurprisingly"?
@RalphBacon3 жыл бұрын
I suppose that's the same as "surprisingly", I guess. But with more confusion to add a certain je ne sais quoi!
@YTbxg3 жыл бұрын
Do you think this circuit work with the likes of windspeed and robot wheel quadrature encoders which I would suppose turn at higher rpm than a rotary encoder switch? A very interesting video and do pop my name into you circuit board giveaway lucky dip :-)
@RalphBacon3 жыл бұрын
Yes, absolutely. The 60rpm restriction is just for that Bourns encoder. A windspeed device usually has a magnet and a reed switch (mine does, anyway) and can whizz round quite fast. This circuit should have no trouble with that. I'll put your name into the draw if I know how to contact you (and what your name is)! You can email me. Address is on this page kzbin.infoabout
@rollyavecilla3 жыл бұрын
Can I have your PCB re-fabricated at JLCPCB?
@RalphBacon3 жыл бұрын
Indeed you can, Rolando. If you open up the GitHub for this project, you will see I have uploaded both Gerber files and EasyEDA project. If you just want the PCBs exactly as I have made them, just upload the Gerber (zip) file to JCLPCB and they will provide them! If you know EasyEDA then you can import and then modify the project to suit yourself. github.com/RalphBacon/230-Ultimate-Switch-Bounce-Eliminator
@pekkagronfors73043 жыл бұрын
He, he, This one is funny to watch
@RalphBacon3 жыл бұрын
It wasn't supposed to be funny, so do share what you find amusing, Pekka!
@zaprodk3 жыл бұрын
*Ganssle, not Gansler :)
@RalphBacon3 жыл бұрын
I couldn't decide on the pronunciation: I thought it might be a Dutch or other European name in which case it would be pronounced Gans-ler. The English (or USA) pronunciation would be Gann-sell. How do you know which one? OK, I Googled him and he's American. Gans-ell it is. 😀
@srduke3 жыл бұрын
7:37 *minimum of 1 second.
@RalphBacon3 жыл бұрын
Yup. I'm hoping that as you picked up on this so will everyone else. "1 second or more" is what I should have said to avoid all confusion. Doh!
@hansdegroot652 Жыл бұрын
I think I better stick with software
@RalphBacon Жыл бұрын
Hardware is easier if you can already do the software, Hans.
@yogeshitaliya4733 жыл бұрын
😍😍😍😍😍
@RalphBacon3 жыл бұрын
I can always rely on you, Yogesh, nice to see you here!
@laurentiujinga55583 жыл бұрын
I have to comment. I had a rotary encoder, test it and all went wrong... I ordered another 10 pcs on Amazon and I've quit trying after I test half of them. Just junk. I will never add a rotary encoder to my projects, not with this available junks
@martinmckee53333 жыл бұрын
In what way did they not work? I have used high quality encoders as well as cheap bulk encoders and they have all worked to some extent. The code can be tricky to get working the first time, but they are really lovely to use once they are working.
@RalphBacon3 жыл бұрын
If you watch my first video from a few years ago on the Rotary Encoder I can almost guarantee you success! The video: kzbin.info/www/bejne/gGrGdXibm5V8mLM Just do exactly what it says!
@flyboy3633 Жыл бұрын
Teach me your accent !
@RalphBacon Жыл бұрын
It's not _me_ that has the accent, Ed, it's everyone else not in the UK! 😁
@hansdegroot652 Жыл бұрын
The best part is no part.
@RalphBacon Жыл бұрын
The best part is the part that "just works" and is a true fit-and-forget.
@siliconjunkie72973 жыл бұрын
This sort of thing is simpler to do in software, no components required.
@RalphBacon3 жыл бұрын
Well, "simpler" is a relative term. This was an _alternative_ way of doing this (I did a software version a few weeks ago) and it enables developers to focus on their code rather than workarounds for shortcomings in the hardware!
@markcummings1503 жыл бұрын
I think you missed the whole point of Ralph’s design. Maybe watch it again. I’m a hardware fan, and I’ve used an almost identical circuit on an Apple II plus hardware lowercase mod where there is simply no space left in the ROM to try and deal with all the issues that have to be dealt with to overcome key bounce. It barely takes any extra room on the pcb for one gate and a few passives.
@hintoninstruments23694 ай бұрын
Sorry, but you are wrong. Your "ultimate" debounce circuit creates a 2.5ms delay and cannot debounce switches with longer bounce times. The best debouncing hardware was the Motorola MC14490 which is no longer available, but you can learn a lot by looking at its internal circuit in the data sheet. You can implement the same circuit in discrete logic or an FPGA OR it can be implemented in microcontroller software and then you only need two pullup resistors. Also you can get finer resolution from encoders by using the transitions of both A and B.
@RalphBacon2 ай бұрын
Good to know and I will check out the MC14490 (if I can find any) 👍
@t1d100 Жыл бұрын
Do not exceed RPM code = clever.
@RalphBacon Жыл бұрын
Well, certainly informative!
@ReneKnuvers74rk3 жыл бұрын
In my opinion this is nowhere near the ideal solution. The state machine was better is everal aspects, not the least the external component count and reusability in other encoder situations. But that is just an opinion.
@RalphBacon3 жыл бұрын
And I totally respect your opinion, Rene. I think either solution is good. It depends on how much "software" vs "hardware" you want the solution to be, I suppose. I just loved building this and then not having to worry about switch bounce in the software; it felt weird!