Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #9825
    gvsoft
    Participant

    Cari E.A..
    I'm asking you for help again: I fight with analog electronics. I can usually solve certain problems via software.
    Then: I need to use Arduino interrupts to generate some kind of randomness. The IRQ routine is triggered by pressing a pull-up button that closes to ground when pressed. But a simple button creates a series of bounces (obvious !!) which produce the effect of triggering the interrupt routine several times, nullifying the random effect that I would like to create. Seeing is believing: A counter in the interrupt routine counts how many times it is triggered: 3,5,6,7 times. It is therefore necessary to create a HARDWARE DEBOUNCING system so that the same routine is triggered only ONCE for each press of the button. After triggering, I disable the arduino interrupts and then reactivate them once the event is complete).
    I searched the web for debounce circuits but apart from the ones THAT DON'T WORK RIGHT (or are they just theoretical) I found one that uses the classic FLIP / FLOP with a diverter that brings mass in very alternating the two inputs of the flil / flop. The system works but is not yet reliable: a count of 1 trigger but not always as the following demonstrates:

    IRQ_1 count: 2 (After each triggering of the interrupt routine, the arduino IRQs are disabled and re-enabled when the cycle must be resumed)
    IRQ Enable
    Waiting from IRQ
    IRQ_1 count: 1
    IRQ Enable
    Waiting from IRQ
    IRQ_1 count: 3

    I therefore need a reliable HW debouncing system otherwise the randomness that I need in my project is going to be blessed !!!.
    Can you give me some suggestions ??
    Thank you
    gvsoft

    #9827
    Amilcare
    Keymaster
    ++++ Loading image FidoCad ++++
    see source fidocadj Zoom fidocad

    This is the safest and simplest I know as it is the diode itself that prevents unwanted triggers from occurring.
    Initially Ct was discharged from Rt and the final output is at one as if the circuit were not present.
    When the button is pressed, the capacitor through the diode charges immediately and remains in that condition until the button is released. Any bounces are ignored because the diode prevents the capacitor from discharging.
    After a time determined by the formula T = 0.8Ct * Rt (in seconds), the capacitor discharges and the zero output state returns to one until the button is pressed next

    #9829
    Picmicro675
    Moderator

    The simple 555 is the sharpest option. Obviously if the detection of the input is considered valid, you put Arduino to control the 555 sul reset, so that it does not repeat the trigger until the next scheduled time.

    ++++ Loading image FidoCad ++++
    see source fidocadj Zoom fidocad

    Otherwise it can be done with a CD4011

    ++++ Loading image FidoCad ++++
    see source fidocadj Zoom fidocad

    Sorry but some parts of the fidocad libraries are not representative, only with the program you can paste the source and see well.

    #9831
    Amilcare
    Keymaster

    I thought of a further simplification but this is only theoretical and should be experimented in the values ​​of R and C for the best anti bounce timing

    ++++ Loading image FidoCad ++++
    see source fidocadj Zoom fidocad
    #9833
    Amilcare
    Keymaster

    Picmicro675 for a correct and faithful visualization of Fidocadj the standard library should be used

    • This reply was modified 1 year ago by Amilcare.
    • This reply was modified 1 year ago by Amilcare.
    #9836
    Just4Fun
    Participant

    This is the debouncing scheme I normally use:

    Of course you have to use triggered ports as the input (I would add some examples of circuits but it is not possible to insert more than 2 external links / images).

    Find who the theoretical treatment.

    • This reply was modified 1 year ago by Just4Fun.
    • This reply was modified 1 year ago by Just4Fun.
    • This reply was modified 1 year ago by Just4Fun.
    #9840
    gvsoft
    Participant

    guys, Thank you for being courteous and prompt… now I'll see what to do… Thanks again
    Greetings
    gvsoft

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.