Тёмный

Watch to learn why capacitors are used for counting 🤓 

Make It Hackin
Подписаться 32 тыс.
Просмотров 189 тыс.
50% 1

I order my circuit boards, stencils, and 3D prints from www.pcbway.com Make sure to check out their RU-vid Channel as well!
‪@PCBWay‬
=================================================
Thanks for watching! ‪@RealElaineee‬
For more places to watch and interact, check out:
/ makeithackin
/ makeithackin

Опубликовано:

 

8 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 83   
@pcsurgeontheoriginal8015
@pcsurgeontheoriginal8015 4 месяца назад
I always debounced using a cooldown in my code.
@robn2497
@robn2497 5 месяцев назад
the algorith is working for me now, teaching me electronics, Im a total noob so these shorts are great!
@angryalliance4958
@angryalliance4958 5 месяцев назад
Same pinch
@KyoDerWahre
@KyoDerWahre 5 месяцев назад
Pink ofcourse
@SG_01
@SG_01 4 месяца назад
Alternatively you can use a debounce timer in your code of about 50ms
@billcollins7009
@billcollins7009 3 месяца назад
50ms is where I start and then adjust as necessary.
@bonamin
@bonamin 4 месяца назад
I have been using only resistors until now. And software debouncing ofcource. But a capacitor sounds reasonable. I'm gonna try it and check it with the scope. Thanks.
@doonual6034
@doonual6034 3 месяца назад
This is just not at all how engineers fix button bounce. You just ignore a button press if it was too soon after the last one in code. No extra components needed
@ItachiUchiha-gf4fz
@ItachiUchiha-gf4fz 3 месяца назад
But would that cost a delay?
@_marshP
@_marshP 3 месяца назад
Yes, but I've tried that method and (at least for my implementation) it's not as reliable as you think it is. Though if you're aiming for circuit simplicity, yes. Electronic buttons have been around for ages. There's a reason techniques like hardware debouncing stick around.
@fog1257
@fog1257 3 месяца назад
​@@ItachiUchiha-gf4fzNo, only if you suck at programming. Use a time counter (millis in arduino) or an interupt.
@ItachiUchiha-gf4fz
@ItachiUchiha-gf4fz 3 месяца назад
@@fog1257 I see, thanks! I’ll try to implement good of both worlds😁. The problem I’m seeing is that if there’s gonna be a need for precision because surely that not every project would have the same components then just programming alone might not do it all. So, I believe the most reliable one is to smooth out the current with a capacitor and or an inductor. Overall, thanks anyway since I haven’t actually integrated the two of them yet. I have learned programming and electrical separately. Soon I’ll be using Arduino to create cools stuff.
@fog1257
@fog1257 3 месяца назад
@@ItachiUchiha-gf4fz Unless you are trying to get timing down to nano seconds the interrupt sequence on a regular Arduino works just fine (micro seconds of precision), really you will not get that good timing with a lm555 with regular cheap components. The reason people like delay is because of simplicity of use but how it really works is wasteful. When you type delay(1000) you tell the processor to perform a NOP(no operation assembly) for 1000 ms. The number of operations that corresponds to is calculated in the Delay function by the number you put in times a factor based on the clock speed of the processor. That's why you can't do anything else when using a delay, the processor is busy doing nothing.. Better approach is using millis(). Millis is a function which is called by an interrupt at 1000Hz in the background and a counter is incremented and stored, like a clock. At startup the clock is 0 and then it just keeps ticking. When using millis you call it and store it into a variable like, unsigned long lastTime = millis(). We use a long here since millis() is a very large value. You can then compare this in your loop by: if(millis() - lastTime > myDelayTime) //DoSomething In short, millis() is a form of polling. Lastly we have the interrupt. Interrupt uses separate hardware which can interrupt the processor at any time to make it do something else before returning to its previous task. You can either use input interrupts so that buttons are more responsive for example or you can use timed interrupts. Interrupts are a lot harder to set up and you got to be careful so that everything is restored after the interrupt or your program will crash. For speed and multitasking, they are the best. Another thing to keep in mind is that some libraries use interrupts already and there are a limited number of interrupts since they are hardware based. So if you want to use them together with a library which also uses them you got to make sure that there are no collisions, for example if two parts of the code try to use the same interrupt for different things at the same time. If you have more questions, ask away. Good luck with your learning.
@amos9274
@amos9274 4 месяца назад
Thanks, great job explaining the concept, unfortunately I noticed a few mistakes. You kind of drew the diagram wrong, the falling edge happens instantly, the rising edge takes longer and returns to 0 during every bounce (instead of both happening instantly and only small spikes on the positive voltage). Also, you would not connect a capacitor directly to a push button like that (at least if you can reasonably avoid it), as this creates a current spike, potentially causing EMI and reducing the lifespan of the contacts by literally vaporizing them or depositing soot.
@Quaxyy
@Quaxyy 4 месяца назад
I have been trying to build a keyboard from scratch and been experiencing debouncing. Should I use this capacitor technique? If so how should I connect it?😊
@amos9274
@amos9274 4 месяца назад
​​@@Quaxyy That really depends on the application. On a keyboard, I personally would do it in software to save some effort (only allowing updates to any button every 20 ms or so should already resolve the problem). If you want to do it in hardware tho, look up the debouncing article in digikey for the IDEAL and adjustable solution (first solution on the page). To save space tho, this is the order in which I would remove elements from that circuit: D1, U1 and if you really want R2. Or you could buy dedicated IC's (third solution on the page) to save even more space.
@Gagandeepsingh-uf2un
@Gagandeepsingh-uf2un 3 месяца назад
⁠@@amos9274 hi amos, I really like your point of view, I have also used software debounce in one our projects which had the stm32. If i am not wrong we can also use SR latch circuit for eliminating the debounce of a switch. Plus i want to ask you if you have any experience with transistors or amplifiers.
@amos9274
@amos9274 3 месяца назад
​@@Gagandeepsingh-uf2unHi Gagandeep, thank you for your reply, I also currently use stm32 for nearly all of my projects :) Yes, you can use an SR latch, but only if you have a dual-throw switch/button. I do have some experience with amplifiers and transistors but it is not my specialty.
@ouroboros.education
@ouroboros.education 4 месяца назад
The best way to do this is implementing a Low-Pass filter, with a small resistor and small capacitor. Just a series resistor on the output and a capacitor. Will give better results
@fortheregm1249
@fortheregm1249 4 месяца назад
Yeah, that cap discharging into the switch will ruin the contacts of the switch in no time
@helderfilipedasilvamoreira7879
@helderfilipedasilvamoreira7879 4 месяца назад
You can use software "score" over a state 0 and 1 or software low pass filter. It works, and is cheaper and smaller.
@flueritv
@flueritv 4 месяца назад
does this block the programm while debounceing or not?
@Oscar4u69
@Oscar4u69 4 месяца назад
this method seems more reliable than software
@ipodtouch470
@ipodtouch470 4 месяца назад
@@flueritvI don’t know what this guy is talking about but when I implemented a software solution to denouncing I used a finite state machine that switched from high to low or something like that. While the button is bouncing you can’t do anything you have to wait until it stabilizes
@flueritv
@flueritv 4 месяца назад
@@ipodtouch470 I once tried to set a timer on Interrupt on Change from the GPIO and once the timer overflowed I captured the Value. I mean it worked and didn't block the programm but it useses one Timer per GPIO to debounce so its not very effective
@slewoutdoors2142
@slewoutdoors2142 4 месяца назад
Simple software fix would fix this as well
@ahmedamr1124
@ahmedamr1124 4 месяца назад
Can also be done using software only
@JakubS
@JakubS 4 месяца назад
You could also make the button be a switch for multiple AND gates connected together With enough AND gates, the chance of all of them randomly having a voltage drop at the same time would be virtually zero.
@reignreincarnation5531
@reignreincarnation5531 4 месяца назад
been looking to learn about cap and mos..now their shorts fly in all the time.. let em coming
@benjocrostar
@benjocrostar 4 месяца назад
Or use a library for debouncing
@prateekmahajan190
@prateekmahajan190 5 месяцев назад
In my opinion for designs involving an mcu, the best and robust solution is to use least number of components, for this one just use millis() function in any Arduino supported mcu to achieve software debounce, most modern mcu even have inbuilt pullup and pulldown resistors.
@ketse89
@ketse89 5 месяцев назад
I would add schmitt trigger input buffer
@slimeminem7402
@slimeminem7402 4 месяца назад
You should definitely use the pink PCB. I've never seen anything like that before
@Shawny460
@Shawny460 3 месяца назад
Very easily done in code without extra hardware.
@AtlatlLeader
@AtlatlLeader 4 месяца назад
A button press is a button press (TJ henry Yoshi was right)
@ekon01cz
@ekon01cz 4 месяца назад
Yeah but u need 2 more components. You can solve this in fw side without any cost at all.
@Mike-ry4ti
@Mike-ry4ti 4 месяца назад
Denounce functions can be written in the program for the MCU. Debounce caps are used in non programmable applications.
@Electronzap
@Electronzap 5 месяцев назад
Good info.
@user-pr6ed3ri2k
@user-pr6ed3ri2k 4 месяца назад
Debouncing in electronics too?
@abdur2933
@abdur2933 Месяц назад
Does this apply to mouse button too? Like right now my Orochi V2 like to double click. Do i need to replace the capacitor for the button?
@mlab3051
@mlab3051 4 месяца назад
The waveform is incorrect.
@_marshP
@_marshP 3 месяца назад
Looks correct enough to me. If it's just to demonstrate the concept of bouncing, it's fine.
@mlab3051
@mlab3051 3 месяца назад
@@_marshP As the circuit provide use pull-up resistor, the wave form will go down fast and rise up slow. So it must keep low state during bouncing period. it does cost more or take any afford to make it correct at the first place. Making video like these cost more confusion for beginner.
@FelanLP
@FelanLP 3 месяца назад
This bounce and denounce time also introduces input lag because your device has to make sure first that you actually have pressed it and released it. Switching from rubber dome or mechanical switches to lasers, eliminates this problem completely. No capacitor or added lag needed.
@Fish-cubing
@Fish-cubing 4 месяца назад
Pink is a w.
@supreme.__.
@supreme.__. 4 месяца назад
I use pull down resistors and it works fine for me
@user-vy8eu5go2t
@user-vy8eu5go2t 4 месяца назад
D bouncer💀
@kheavmady8780
@kheavmady8780 4 месяца назад
Is that a snubber?
@aarravoltics4592
@aarravoltics4592 5 месяцев назад
Why not use a pulldown resistor?
@skmgeek
@skmgeek 5 месяцев назад
The button is *physically* bouncing, it's just way too fast for you to notice
@prestonferry
@prestonferry 5 месяцев назад
@@skmgeekI still don’t feel like that answers the question Why is it used if it doesn’t work?
@prestonferry
@prestonferry 5 месяцев назад
This is what I was thinking and I was about to ask
@skmgeek
@skmgeek 5 месяцев назад
@@prestonferry wdym? the button is working fine, almost all buttons experience bouncing. a pulldown resistor won't do much as the button is literally connecting and disconnecting a few times before settling down. think of it like a ball that gets dropped from a height, it'll bounce a few times before coming to a stop. using a capacitor in a low-pass filter will make it so the extremely fast bounces get smoothed out and practically disappear. Ben eater has a very good video on denouncing if you want to learn more about it
@prestonferry
@prestonferry 5 месяцев назад
@@skmgeek oh I see, so it doesn’t need a threshold which is what a pull down resistor does, because the button physically closes a few times in less than a second? And are buttons the only components with this issue?
@YDV669
@YDV669 5 месяцев назад
God damn it, that one time I needed to debounce a button with an Arduino, I did it with code. Where was this video during my time of need?
@runforitman
@runforitman 5 месяцев назад
Software debouncing is perfectly fine and can be what makes most sense
@MrClean-ep7uc
@MrClean-ep7uc 5 месяцев назад
@@runforitmanPAin in the ass tho
@prateekmahajan190
@prateekmahajan190 5 месяцев назад
Yup software debounce libraries like oneButton are really helpful
@datamike00
@datamike00 4 месяца назад
this reminds of the TRS-80 back in the day , it had horrible keybounce, you could download a patch to handle it, would have nice to have a physical fix
@BenGray-fv5pb
@BenGray-fv5pb 4 месяца назад
More learning shorts please
@BenjaminGatti
@BenjaminGatti 4 месяца назад
Ain't no engineer gonna spend parts where software can do the job. You talking about noobs.
@guyguy463
@guyguy463 4 месяца назад
Failure to disclose your sponsors is illegal
@equationaeecrama8517
@equationaeecrama8517 4 месяца назад
Keep the spreading the words
@roddragomes
@roddragomes 5 месяцев назад
Gray
@lainwired3946
@lainwired3946 5 месяцев назад
A resistor is cheaper and more common, no?
@rileyjones7231
@rileyjones7231 5 месяцев назад
A resistor won't slow the voltage change. Resistor will only resist current. The mcu input is such a high impedance and low capacitance that the charge between the resistor and input will change just about as fast as if there were no resistor.
@aaronschuhhardt2096
@aaronschuhhardt2096 4 месяца назад
Pink
@aksharbarao6362
@aksharbarao6362 4 месяца назад
Can't SR latch used as a switch debouncer?
@SaltyTil
@SaltyTil 5 месяцев назад
Essential to know. Maybe this is the key to fix my crappy buttons not working with arduino
@MuslimNow99
@MuslimNow99 4 месяца назад
GRAAAAAAAAAY😂
@Midzuchi
@Midzuchi 5 месяцев назад
Pink :D
@JoaoPedro-ki7ct
@JoaoPedro-ki7ct 5 месяцев назад
A button press is a button press you can't say it happened three or more times
@brennethd5391
@brennethd5391 5 месяцев назад
for the computer it did
@ahmedamr1124
@ahmedamr1124 4 месяца назад
This button is mechanical it keeps moves up and down
@deirdrehoivik9790
@deirdrehoivik9790 4 месяца назад
🙂 'promosm'
@frommarkham424
@frommarkham424 5 месяцев назад
1st
@JaiminP
@JaiminP 5 месяцев назад
Bro 5th comment please pin 😊
@theslowsloth646
@theslowsloth646 4 месяца назад
Pink
@krrishrohilla2945
@krrishrohilla2945 5 месяцев назад
Gray
Далее
#1099 How I learned electronics
19:55
Просмотров 1,3 млн
Dropping In from the Clouds 🌁
00:17
Просмотров 1,3 млн
кого отпустят гулять чееек
00:53
Fun with Transistors
24:33
Просмотров 265 тыс.
Hacking a weird TV censoring device
20:59
Просмотров 3,1 млн
Decoupling Capacitors - And why they are important
7:39
Crystal Radios: No Batteries? No Problem!
25:06
Просмотров 269 тыс.
I Made A Water Computer And It Actually Works
16:30
Things you can make from old, dead laptops
19:03
Просмотров 12 млн
A simple guide to electronic components.
38:06
Просмотров 8 млн
Let's build a voltage multiplier!
16:32
Просмотров 2 млн
Dropping In from the Clouds 🌁
00:17
Просмотров 1,3 млн