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:
DESIGN PREFERENCES:
FIRST EFFORT - FAILED: High power draw, extremely sensitive to ESD, etc.
SECOND EFFORT - WORKED WITH MODERATE ISSUES: Low power draw, Moderately sensitive to ESD, etc.
THIRD EFFORT - WORKING WITH LESS ISSUES: Low power draw, Low sensitivity to ESD, etc.
DISCUSSION:
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
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!