SPST debounce help needed - switching a positive signal

Thread Starter

redeyedjim

Joined Jul 14, 2018
33
Hi all,

I am a hack trying to finish up a project, and could use some help :) I need to debounce a positive signal from a SPST tactile switch to a PWM relay. The signal (and VCC) is 12VDC, and the relay will close with anything above ~2VDC. In its NO state, any quiescent signal below 2V is fine and will not close the circuit. The switch, when closed, feeds VCC to the relay's input trigger.

Below is the SPST circuit as I had planned it. I had originally spec'd a MAX6816EUS (MAX6816EUS datasheet) to handle debouncing:




Unfortunately, my real world experience has been that the MAX6816's input appears to be pulled high internally, and as a result my relay sees a signal (and activates!) when no signal should be present. I have not been able to get the MAX6816EUS to work in my circuit. I am tired of banging my head against this wall and want to move on to a different approach. (And if anyone knows what I'm doing wrong with the MAX6816EUS, I'm all ears. I just want to solve this debouncing problem and move on.)

It looks like there are a lot of options for a hardware debounce circuit, but most are designed to debounce a switch that carries a ground signal. I am trying to debounce a positive signal, so it seems like a lot of the designs I am seeing won't work for my circuit. I could use some help.

It looks like an RC circuit similar to this one that could work for me if I knew the right values for D1, R1, R2, and C1:



I would be very grateful if someone could provide some ballpark values (and a diode recommendation) to allow me to use the above RC circuit as a debounce solution for my project. :)

Honestly, though, I am open to any compact debounce circuit that will work for a SPST switch carrying a positive signal. The switch will remain pressed/closed for 5-10 seconds at a time, so the initial delay can be several hundred ms, if necessary - it really doesn't matter, the user will keep the button pressed until the task is complete. I just need to debounce the initial press of this button.

Thanks for any help or light you can shed on this! :)
 

crutschow

Joined Mar 14, 2008
34,286
Whats a PWM relay?
What input current does it require?

If signal rise-time is not a concern then you could likely use use a series resistor with a capacitor to ground.
An RC time-constant of 200ms or longer should work.
The maximum resistance of the resistor is determined by the PWM input current.
 

Thread Starter

redeyedjim

Joined Jul 14, 2018
33
Whats a PWM relay?
What input current does it require?

If signal rise-time is not a concern then you could likely use use a series resistor with a capacitor to ground.
An RC time-constant of 200ms or longer should work.
The maximum resistance of the resistor is determined by the PWM input current.
Thanks so much for he prompt reply!

By "PWM relay" I mean one of these:



https://www.amazon.com/DROK-200203-...=B01J78FX9S&psc=1&refRID=C352200ST1TD4V4PV893

Input signal current should be <0.5A.

>If signal rise-time is not a concern then you could likely use use a series resistor with a capacitor to ground.
>An RC time-constant of 200ms or longer should work.

That sounds like it would work OK for this application. Can you advise on the correct values and components?
 

crutschow

Joined Mar 14, 2008
34,286
Input signal current should be <0.5A.
Yes, it's likely less than 0.5A but that sounds like a WAG.
Since it's driving a MOSFET, I would expect it to be no more than a few tens of mA.
Do you have the device so you can measure the actual input current?
It has a significant effect on the required values for the R and C.

Edit: What is the maximum voltage and current of the relay load.
 
Last edited:

Thread Starter

redeyedjim

Joined Jul 14, 2018
33
Yes, it's likely less than 0.5A but that sounds like a WAG.
Since it's driving a MOSFET, I would expect it to be no more than a few tens of mA.
Do you have the device so you can measure the actual input current?
It has a significant effect on the required values for the R and C.

Edit: What is the maximum voltage and current of the relay load.
Thanks for your help. Sorry for the delayed reply.

Yes, the 0.5A current figure I gave was just a guess, and it is very high. You are correct that the signal does not require much current at all. I looked for any sort of published spec for trigger signal input current, but could not find anything about its current requirements. Since it is compatible with and engineered for Arduino, I would expect its current requirements to follow other Arduino-type specs. I think 10-20mA would be a safe current. I see references online to a 40mA max for Arduino inputs, so while this is also a WAG, at least it seems like a safer one.

I have a supply of these PWM relays on hand, but unfortunately I do not have a good way to measure current draw at the moment, as some of my equipment is in another location.

The triggering voltage could be anything above ~3.3V. The signal voltage coming from the closed tactile switch will trigger the relay for a 5-10 second interval, controlled by the user's press of the momentary switch. The user will keep the button pressed for the duration of the task.

The maximum voltage seen by the relay will be 12.6V DC. (3x 4.2V LiPo cells, which are nominally 12.6V when fully charged.)
The maximum current load carried by the relay is 5A.

Thanks for any help you can lend. I found an online RC Debounce calculator and was playing around with some values:



I have not has the opportunity to do anything with this ^^^ yet, but would be curious to get your (or anyone else's) take on this.

Thanks for your help!
 

Thread Starter

redeyedjim

Joined Jul 14, 2018
33
Here is a snippet (weak and inverse signal) of your debounce:
View attachment 164435
Thanks, that is interesting. Unfortunately, I am having some fundamental issues getting the MAX6816 to function as I expected it to. It's input seems to be pulled high internally to 5.2V, which also becomes its quiescent output, and that is triggering my relay, which reacts to the positive input voltage. There is probably something I am doing or not doing that might mitigate this, but I have poured over the MAX6816's documentation and cannot find a way to change this functionality.

My goal for this project is to have a working device with a debounced tactile switch, and at this point, I just need to debounce this switch. I do not necessarily need to debounce it via the MAX6816.

Thanks for your help, and for emulating the circuit I sketched out!
 

crutschow

Joined Mar 14, 2008
34,286
Thanks for any help you can lend. I found an online RC Debounce calculator and was playing around with some values:



I have not has the opportunity to do anything with this ^^^ yet, but would be curious to get your (or anyone else's) take on this.
Looks like it calculates the proper values for a simple RC debounce circuit.
I would go with a lower resistor value, such as 10kΩ, which would give a capacitor value of about 30μF for the above bounce time.
 

Thread Starter

redeyedjim

Joined Jul 14, 2018
33
Looks like it calculates the proper values for a simple RC debounce circuit.
I would go with a lower resistor value, such as 10kΩ, which would give a capacitor value of about 30μF for the above bounce time.
Thank you, @crutschow !

Two final, rather dumb questions:

1. What type of cap is best?

2. Looking at the wiring diagram:



The switch in the above diagram grounds an input wire. In my circuit, my closed switch carries positive voltage to an input pin. Can I still implement my RC debounce solution exactly as in the above diagram, albeit with the different values we discussed? Again - sorry if this is a stupid question, but I am uncertain and might as well ask.

Thanks so much for your help!
 

Thread Starter

redeyedjim

Joined Jul 14, 2018
33
16V rating is fine for a 12V signal.
That Digikey one looks good.
Are you okay building with SMD parts?
This particular project is a small handheld device. I realized a few months ago that if I was serious about making it small, I should try to build it with SMD components. So I've been trying that, and it's been going well - it's been fun and actually easier than I thought it would be. I'm not sure I could manage a truly complicated SMD build, but this one uses ~20 SMD components, and it's been manageable for a hobbyist like myself.

Thanks a lot for your help! I don't mind stumbling my way through some of this stuff, but it is truly great to get answers from someone who knows what they are doing. Thank you. :)

Updated to add: just tried it out, and this solution is perfect for my needs. I tuned the values a bit, and like the response of a 4.7k R with the 33uF cap. The aforementioned online calculator says that works out to a ~70ms debounce time, I think that will be fine for this device. The MAX6816EUS has a 40ms debounce time, so this actually offers a longer debounce interval while also being cheaper, simpler, and more reliable. Pretty sweet upgrade, IMHO. Thanks! :D
 
Last edited:

Plamen

Joined Mar 29, 2015
101
Hi all,

I am a hack trying to finish up a project, and could use some help :) I need to debounce a positive signal from a SPST tactile switch to a PWM relay. The signal (and VCC) is 12VDC, and the relay will close with anything above ~2VDC. In its NO state, any quiescent signal below 2V is fine and will not close the circuit. The switch, when closed, feeds VCC to the relay's input trigger.

Below is the SPST circuit as I had planned it. I had originally spec'd a MAX6816EUS (MAX6816EUS datasheet) to handle debouncing:




Unfortunately, my real world experience has been that the MAX6816's input appears to be pulled high internally, and as a result my relay sees a signal (and activates!) when no signal should be present. I have not been able to get the MAX6816EUS to work in my circuit. I am tired of banging my head against this wall and want to move on to a different approach. (And if anyone knows what I'm doing wrong with the MAX6816EUS, I'm all ears. I just want to solve this debouncing problem and move on.)

It looks like there are a lot of options for a hardware debounce circuit, but most are designed to debounce a switch that carries a ground signal. I am trying to debounce a positive signal, so it seems like a lot of the designs I am seeing won't work for my circuit. I could use some help.

It looks like an RC circuit similar to this one that could work for me if I knew the right values for D1, R1, R2, and C1:



I would be very grateful if someone could provide some ballpark values (and a diode recommendation) to allow me to use the above RC circuit as a debounce solution for my project. :)

Honestly, though, I am open to any compact debounce circuit that will work for a SPST switch carrying a positive signal. The switch will remain pressed/closed for 5-10 seconds at a time, so the initial delay can be several hundred ms, if necessary - it really doesn't matter, the user will keep the button pressed until the task is complete. I just need to debounce the initial press of this button.

Thanks for any help or light you can shed on this! :)
 

Plamen

Joined Mar 29, 2015
101
The simplest de-bouncing circuit for TTL logic involves one cap and two resistors:
The button is assumed connected one end to +5V, the other through a parallel RC (1 Meg, 1nF) to the TTL input, in turn also connected to the second resistors (10k) to GND. Normally the TTL input is held at logic 0 by the 10k resistor to GND. The 1nF cap is discharged by the 1 Meg resistor across. Upon pressing the button, the +5V applied through it is differentiated by the cap and produces a short "needle" (10k*1nF=10us).
This allows proper triggering even when the button is held pressed. Because the cap is charged rapidly (10k) and discharged slowly (1Meg), the bouncing pulses follow too closely (before the cap is discharged) so only the first pulse is propagated. Put it in LTSpice and try it.
 

Thread Starter

redeyedjim

Joined Jul 14, 2018
33
The simplest de-bouncing circuit for TTL logic involves one cap and two resistors:
The button is assumed connected one end to +5V, the other through a parallel RC (1 Meg, 1nF) to the TTL input, in turn also connected to the second resistors (10k) to GND. Normally the TTL input is held at logic 0 by the 10k resistor to GND. The 1nF cap is discharged by the 1 Meg resistor across. Upon pressing the button, the +5V applied through it is differentiated by the cap and produces a short "needle" (10k*1nF=10us).
This allows proper triggering even when the button is held pressed. Because the cap is charged rapidly (10k) and discharged slowly (1Meg), the bouncing pulses follow too closely (before the cap is discharged) so only the first pulse is propagated. Put it in LTSpice and try it.
Thanks, that is a very detailed and helpful answer. I appreciate your explanation, although I am not sure it applies to my situation.

FWIW, my project is a portable ZVS induction heater, and its circuit does not use any TTL logic. The transistors in the circuit are used to generate a high energy magnetic field through a work coil, which rapidly heat the object being worked. When the user hits the power button, they keep it depressed for a continuous 4-8 seconds, which is the length of time it takes the heater to perform its task. Due to the way this circuit uses its MOSFETs for power generation, switch bounce doesn't merely produce junk data, it actually destroys the transistors.

The circuit as implemented above (33uF cap, 4.7kR) seems to be working well in debouncing this switch adequately for my needs. I am not sure the more advanced circuit you suggest would be more helpful, given my application?
 

Plamen

Joined Mar 29, 2015
101
Thanks, that is a very detailed and helpful answer. I appreciate your explanation, although I am not sure it applies to my situation.

FWIW, my project is a portable ZVS induction heater, and its circuit does not use any TTL logic. The transistors in the circuit are used to generate a high energy magnetic field through a work coil, which rapidly heat the object being worked. When the user hits the power button, they keep it depressed for a continuous 4-8 seconds, which is the length of time it takes the heater to perform its task. Due to the way this circuit uses its MOSFETs for power generation, switch bounce doesn't merely produce junk data, it actually destroys the transistors.

The circuit as implemented above (33uF cap, 4.7kR) seems to be working well in debouncing this switch adequately for my needs. I am not sure the more advanced circuit you suggest would be more helpful, given my application?
 

Plamen

Joined Mar 29, 2015
101
MOSFETs are often controlled by logic level (TTL) signals. Typically +5V is provided for the sake of micro-controllers, displays, LEDs etc.
The same de-bouncing circuit could be used to control MOSFET too. When dealing with MOSFETs and especially with inductive load, some details are worth mentioning.
1. The MOSFETs have "Miller Effect - i.e. the gate is capacitively coupled to the drain. When shutting off - the drain is racing up...pulling through Cdg the gate up. This could exceed the max gate voltage if the gate driver cannot sink enough.
2. Inductive loads in on time store energy E=(L*I^2)/2. During turn off transient this energy 'kicks", producing on the drain a spike. way above the power rail.
Recommendation (in respect of MOSFET driving):
1. A gate driver is required, providing gate current limiting during turn on transient (a several Ohm resistor) and gate voltage limiting during turn off transient (for instance a PNP transistor - emitter to the gate, collector to GND, base to the gate driving signal source). This transistor has no impact on turn on transient and works in common base mode during turn off transient. The Miller Effect pulls the gate (and PNP-E) up, while the gate driving signal source is pulling (the gate through the ballast resistor and PNP-B) down. The PNP turns on and diverts the gate current to its collector i.e. GND. This is called "active clamp"
2. Drain overshoots and ringing (inevitable with inductive loads) are to be countered by "snubber circuit".
In its simplest form it is a series RC across the MOSFET D-S. The resistor is meant to match the "characteristic impedance" of the parasitic LC circuit (under 100 Ohm). Its value is tweaked to achieve the appropriate damping (fast decay of ringing). The cap is several nF and selected to provide sufficient overshoot limiting. In fast repeated switching situation, RCD snubber is preferred. It offers lower losses in the resistor.
 
Top