Notifications
Clear all

[Solved] Arduino Timers – no pain and all gain!

56 Posts
8 Users
36 Reactions
4,330 Views
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 7105
 

@will I know conceptually what a NAND is, but I am talking about push buttons and relay contacts, the circuit proposed is totally different.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
Inst-Tech reacted
ReplyQuote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2537
 

@zander 

They can also be used in different circumstances as well. The circuit shown using them isn't a good candidate for what you want.

How long a delay between the actual button push and the actual trigger event can your project stand ? That is, how fast does the debounce have to happen ?

There's an interesting article about debouncing at digikey which illustrates the use of NAND gates for this purpose (amongst other alternatives).

https://www.digikey.ca/en/articles/how-to-implement-hardware-debounce-for-switches-and-relays

Anything seems possible when you don't know what you're talking about.


   
Inst-Tech reacted
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 7105
 

@will The problem with that NAND circuit is it is a SPDT, not SPST. I just realized the kind of push button I am using is part of the problem, it's spring loaded or something. I will either find a switch that doesn't bounce, or look into capacitive touch sensors. If I just touch a wire to the pin there is no bouncing, there must be a switch somewhere that does the same thing.

Sorry for taking up so much bandwidth for a dumb switch.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
Inst-Tech reacted
ReplyQuote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2537
 
Posted by: @zander

Sorry for taking up so much bandwidth for a dumb switch.

Well, I personally am finding it to be interesting reading the replies.

Anything seems possible when you don't know what you're talking about.


   
Inst-Tech reacted
ReplyQuote
Inst-Tech
(@inst-tech)
Member
Joined: 2 years ago
Posts: 554
 

@zander, I found several articles on debouncing switches, and just thought I'd share them with you;;

The first one is a link to actual switches that claim to be bounce free...;

https://www.digikey.com/en/products/filter/pushbutton-switches/199?s=N4IgjCBcoLQdIDGUBmBDANgZwKYBoQB7KAbRACYBOAdgA4QBdAXwJgBYpRlJ1t8jSIWtQBs1CAWFjyISaOoBmWSBEBWatRnMWIVZxAAHKGAIGjkcqqZMgA

thos one is an article on methods to de-bounce switches;

https://www.digikey.com/en/articles/how-to-implement-hardware-debounce-for-switches-and-relays

Good luck with your project Ron,

kind regards,

LouisR

LouisR


   
ReplyQuote
robotBuilder
(@robotbuilder)
Member
Joined: 5 years ago
Posts: 2043
 
Posted by: @will
Posted by: @zander

Sorry for taking up so much bandwidth for a dumb switch.

Well, I personally am finding it to be interesting reading the replies.

Agreed.

 


   
Inst-Tech reacted
ReplyQuote
ron bentley
(@ronbentley1)
Member
Joined: 2 years ago
Posts: 385
Topic starter  
Posted by: @zander

@ronbentley1 I think we are talking about two different things. I do not plan on any kind of polling, there may not even be a main loop if I can avoid it. My system is interrupt driven, one of the things generating the interrupts is a mechanical switch. Anytime there is a hardware solution that is the best solution in most cases. 

Ron 

Your solution therefore lies in a hardware solution for debounce.

How long the debounce period is is an interesting question, but it should not matter so long as the interrupt is triggered post debounce when switch has reach a settled state.

Good luck

Ron Bentley
Creativity is an input to innovation and change is the output from innovation. Braden Kelley
A computer is a machine for constructing mappings from input to output. Michael Kirby
Through great input you get great output. RZA
Gauss is great but Euler rocks!!


   
ReplyQuote
robotBuilder
(@robotbuilder)
Member
Joined: 5 years ago
Posts: 2043
 

@zander

I read a mercury doesn't bounce?

Another example I see on the internet is using two inputs per switch.

The internal pull resistors could also be used.

To enlarge image right click image and select open link in new window.

twoPinDebounce

 

 

  If (PIN_2 == LOW)
    switch_ON = true;
  else
    switch_ON = false;

 

 


   
ReplyQuote
ron bentley
(@ronbentley1)
Member
Joined: 2 years ago
Posts: 385
Topic starter  

@robotbuilder 

Hi,

I'm afraid a mercury switch will also exhibit bounce.

I also dont feel the circuit above will take out any bounce, and 2 pins? I would be interested to understand others' point of view on this.

There are many sources for a hardware debounce switch circuit on the net, so you 'pays your money and takes your pick' - a hardware solution or a software solution.

 

 

Ron Bentley
Creativity is an input to innovation and change is the output from innovation. Braden Kelley
A computer is a machine for constructing mappings from input to output. Michael Kirby
Through great input you get great output. RZA
Gauss is great but Euler rocks!!


   
ReplyQuote
ron bentley
(@ronbentley1)
Member
Joined: 2 years ago
Posts: 385
Topic starter  

Hi again,

This is a very helpful article and covers hardware  debounce  in several ways.

Ron Bentley
Creativity is an input to innovation and change is the output from innovation. Braden Kelley
A computer is a machine for constructing mappings from input to output. Michael Kirby
Through great input you get great output. RZA
Gauss is great but Euler rocks!!


   
ReplyQuote
byron
(@byron)
No Title
Joined: 5 years ago
Posts: 1123
 

And here is a link to the ultimate debounce circuit, or so he says 😎 


   
ron bentley reacted
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 7105
 

@ronbentley1 I am beginning to think the software approach is the way to go if I can figure out an ideal number of tasks and task priorities and on which of the two cpu's to run them. It's been a while since I did something like that but I do recall it is NOT intuitive, and in fact many/most get it exactly backwards. I have not come across the scheduling parameters and what if any API calls I have available other than the priority setting and CPU affinity, but it's still early.

The reason for the re-think is two-fold, if the hardware fix proves to be not correct, it's a pain to change it whereas software is just that, soft and now with OTA quick. The second reason is that so many of you have encouraged me that way. 

I will still experiment with a touch sensor but two of the stations are in the bathroom and the humidity could be a problem.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
ron bentley reacted
ReplyQuote
(@yurkshirelad)
Member
Joined: 3 years ago
Posts: 493
 

What about an IC that handles debouncing for you?


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 7105
 

@yurkshirelad Ok, I am curious, tell me more.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
ReplyQuote
(@yurkshirelad)
Member
Joined: 3 years ago
Posts: 493
 
Posted by: @zander

@yurkshirelad Ok, I am curious, tell me more.

I can't remember where I read about them, so try a Google search. I remember reading about them somewhere so I don't know if they're any good or even available any more (!). I haven't tried using them myself so I can't really comment on them. Sorry. 😀 

A very random search gave me this, though I don't know if they're still available: https://www.onsemi.com/pdf/datasheet/mc14490-d.pdf

 

Edit: if they are available, they might be damn expensive!

This post was modified 2 years ago by YurkshireLad

   
ron bentley reacted
ReplyQuote
Page 3 / 4