Automotive switch design - ESD, Debounce, etc.

Thread Starter

bwanna

Joined Nov 19, 2012
19
Hi,
First, I want to thank the Forum for assistance ahead of time.

Goal: Design a circuitry that provides a clean 3 or 5v logic output from a standard motorcycle turn switch.

A Motorcycle turn switch is a SPDT ON-OFF-ON design with mechanical latching using copper plates that move laterally to form the 12v connections. This project eliminates the mechanical latching converting it to a MOMENTARY Switch.

I want to design a circuit that uses this Motorcycle Turn Switch (momentary mode) to provide a clean logic level inputs into a Arduino MCU Interrupts 0 & 1.

OVERALL DESIGN GOALS:
  • Circuit must not reduce the Motorcycle OEM battery (capacity 12AH) below 11.75v within a year
  • Circuit must ONLY activate by purposeful manipulation of the turn switch
  • Circuit must NOT be activated by ESD, other external electrical forces, or during normal operation of the other switches on the motorcycle
  • Both switch outputs need to trigger two MCU Interrupts (to accommodate waking from MCU Sleep mode)

DESIGN PREFERENCES:
  • Smallest SMD footprint possible (<35x35mm)
  • MCU is currently ATMEGA 328p (5v), but can use ESP (3v) variants if a better approach.

FIRST EFFORT - FAILED: High power draw, extremely sensitive to ESD, etc.
  • Simple direct circuitry, no additional caps/res, etc.
  • Switch Center Pole connected to System 12v
  • Switch Outputs to Voltage Divider Resistors to convert 12v to 5v logic level
  • Used external pulldown resistors to GND
  • Relied solely on various software debouncing code with generally similar results
  • RESULTS: It appears ESD was able to overcome the Pulldowns to GND and activate the 328P Interrupts
  • Circuit activated by Lighting strikes, nearby cars, Human ESD (handlebars), use of other motorcycle switches (brakes, Nuetral, etc.

SECOND EFFORT - WORKED WITH MODERATE ISSUES: Low power draw, Moderately sensitive to ESD, etc.
  • Simple direct circuitry, no additional caps/res, etc.
  • Switch Center Pole connected to Ground
  • Switch Outputs directly connected to MCU using Internal PULLUPs & External 4.7k pullup resistors to 5v
  • Used various sofware debouncing approaches with generally similar results
  • Software debouncing code uses: RBD_Button by alextaujenis
  • RESULTS: This did reduce the MCU reacting to ESD, other motorcycle switches being activated.
  • Still too sensitive for consistent and safe use

THIRD EFFORT - WORKING WITH LESS ISSUES: Low power draw, Low sensitivity to ESD, etc.
  • Switch Center Pole connected to System 12v
  • Switch outputs connected to:
    • External 10k PULLDOWN to GND
    • SMDA12C-8.TBT ESD Suppression Bidirectional TVS
    • 74HC4050 Hex non-inverting HIGH-to-LOW level shifter (outputs to MCU)
    • MCU INT0 and INT1 (no PULLUPs activated)
  • Software debouncing code uses: RBD_Button by alextaujenis
  • RESULTS: This works the best, but still reacts to ESD if very close. Ex. Clicking a cigarettes lighter close to the handlebars or turn switch
  • Still too sensitive for consistent and safe use

Basic Design #3.png

DISCUSSION:
  • While I have been enjoying this effort and learning along the way, I'm trying to create a circuitry that is 99% perfect! Something that does not react to environmental electrical or use of other swatch on the motorcycle during normal operations.
  • Have considered in Third Effort to use "inverting" shifter along with MCU Pullups... wondering is this will further reduce responding to ESD
  • Due to very small footprint limitations and wondering if there are chips available that can the entire situation in one chip?
  • I have been researching the MANY software debouncing approaches. The strongest recommendations I've read are to use a combination of hardware & software. After so much research, I have to admit my head is swimming a bit!
 

eetech00

Joined Jun 8, 2013
3,946
Try this.
You may not need the 74HC4050 but shouldn't be needed for the circuit below.

1. You can use NPN Bjt's to level shift as they are more rugged than CMOS chips. The circuit shown inverts the signal from the turn switch
2. The TVS diodes should be higher voltage to account for battery charge voltages. I've shown 18v TVS diodes.
Place TVS diodes at each end of the wiring.
3. The caps slow the input rise time under normal operating conditions to help reduce contact bounce.
4. Also use software debounce with this.
5. Use TVS diode at the power supply input to MCU.
6. The wires from the BJT's to the MCU should be as short as possible.

1610749696770.png
 
Last edited:

Thread Starter

bwanna

Joined Nov 19, 2012
19
eetech00
Thank you for the information!

In looking over the circuit, the only challenge I could see is the first set of TVS diodes close to the switch. While it could be done by directly soldering them, that wouldn't work with my plans. Have to assume all circuitry must be contained in the final unit that the turn switch plug will be attached. Given that, does removing the first TVS diodes near the switch dramatically affect its performance?

TVS Diode selection:
I'm not fully understanding your info on the TVS characteristics. I think what you're suggesting is instead of using the SMDA12C-8 with a working voltage of 12v, I should use something higher? That chip also offers working voltages of 15v and 18v. In your opinion, would the SMDA15C-8 or SMDA24C-8 suffice? https://semtech.my.salesforce.com/s...5/z6Bu69KfRqv8_jtu3hiKCZT2BXy932aDlj6UQtUxGmg

RC Design: I like the RC time delay circuit approach. I did consider trying that, but wanted to reduce the number and footprint of the total SMDs on the PCB. Question: Would a One Shot be a comparable choice? I've researched a number of Monostable Multivibrator chips that offer that. Is there an advantage in doing it the way you show?

Battery Drain: It doesn't appear this circuit design would add significant drain while the MCU is in Sleep Mode. Would you agree?

Again, Thanks for the suggestion!!
 

eetech00

Joined Jun 8, 2013
3,946
eetech00
Thank you for the information!

In looking over the circuit, the only challenge I could see is the first set of TVS diodes close to the switch. While it could be done by directly soldering them, that wouldn't work with my plans. Have to assume all circuitry must be contained in the final unit that the turn switch plug will be attached. Given that, does removing the first TVS diodes near the switch dramatically affect its performance?
Belt and suspenders. :)

Probably don't need D1 and D2.

TVS Diode selection: I'm not fully understanding your info on the TVS characteristics. I think what you're suggesting is instead of using the SMDA12C-8 with a working voltage of 12v, I should use something higher? That chip also offers working voltages of 15v and 18v. In your opinion, would the SMDA15C-8 or SMDA24C-8 suffice? https://semtech.my.salesforce.com/s...5/z6Bu69KfRqv8_jtu3hiKCZT2BXy932aDlj6UQtUxGmg
The "clamping voltage" should be higher than the operating voltage so that it only clamps at when an over voltage spike occurs. I would use a TVS that clamps at about 18v, but a 15v will work. My assumption is a motorcycle charge voltage can be as high as 16v at times.

RC Design: I like the RC time delay circuit approach. I did consider trying that, but wanted to reduce the number and footprint of the total SMDs on the PCB. Question: Would a One Shot be a comparable choice? I've researched a number of Monostable Multivibrator chips that offer that. Is there an advantage in doing it the way you show?
I think using a monostable would be overkill, add complexity, wouldnt provide any additional benefit, and would stiil need a way to prevent false triggering. What I've shown is a simple HW debounce that will work fine with the SW debounce.

Battery Drain: It doesn't appear this circuit design would add significant drain while the MCU is in Sleep Mode. Would you agree?
No. Basically just leakage currents (uAmps)

I'll update the schematic to remove D1/D2.
 

Thread Starter

bwanna

Joined Nov 19, 2012
19
Once again. Thank you!

All of that makes sense. (Had to chuckle at the 'belts and suspenders') Motorcycle charging systems are usually a hard stop at around 13.6-14v to prevent unnecessary smoking. I've actually wound my own stators and built charging systems and never let them get above 14v.

On the RC Circuit, the 4.7k/.47uF makes sense as a low pass filter. Do you see those values as being critical or is there some room to adjust, depending on what RC Network Chipsets offer? Haven't searched what's available, but thinking as a low pass filter something between 150-70hz would be sufficient. Thoughts?
 

eetech00

Joined Jun 8, 2013
3,946
On the RC Circuit, the 4.7k/.47uF makes sense as a low pass filter. Do you see those values as being critical or is there some room to adjust, depending on what RC Network Chipsets offer? Haven't searched what's available, but thinking as a low pass filter something between 150-70hz would be sufficient. Thoughts?
The R1/R2 values are somewhat critical as they limit the base drive current to the BJT's. We want to keep that beween about 1-3mA. C1/C2 are not critical but I would base the time constant on what I believe is the worst case switch bounce duration. A real good switch may bounce about 20mS. On the other hand, a poor switch could bounce for 100's of milliseconds. So there's a trade off. You'll want the rise time to be slow enough to allow a worst case bounce to stablize but not so long that there's an intolerable delay. Remember, you'll also have SW debouncing working as well.
 
Last edited:
Top