I have started a new project, an automatic firing system for fireworks, powered by 2 lead-acid batteries (12V). The batteries are connected in series with a common ground (GND), so the power distribution board has 3 power terminals (+12V, GND, -12V).

The firing system will include more firing channels controlled by a STM32 board, so all the MOSFETs used will be controlled by 3.3V signals. Also each channel will have 2 outputs/terminals, NEGATIVE and POSITIVE.

Because of the project requirements, the IGNITION_POS and IGNITION_NEG should be able to handle 4 different states based on the 2 switches (STM32 GPIOs):

  • Both terminals ON -> IGNITION_POS: +12V and IGNITION_NEG: -12V
  • Both terminals OFF -> IGNITION_POS: GND and IGNITION_NEG: GND
  • Positive terminal ON -> IGNITION_POS: +12V and IGNITION_NEG: GND
  • Negative terminal ON -> IGNITION_POS: GND and IGNITION_NEG: -12V

I'm unable to find a solution to switch terminals to GND when the state of the MOSFETs is OFF. Also i want to specify that the current through terminals can sometimes be more than 30A, so we can't use a simple pull-down resistor.

For simplicity i attached a schematic which includes simple ON/OFF switches, not the actual STM32 GPIOs.

Can you help me with some suggestions to achieve this behavior ?


simulate this circuit – Schematic created using CircuitLab

  • \$\begingroup\$ Just to be clear, when "INGITION_POS" [sic] is tied to ground, it is expected to be able to source the current from BATT2, which is then returned to "INGITION_NEG" through the load? \$\endgroup\$
    – Dave Tweed
    Oct 7, 2023 at 15:00
  • \$\begingroup\$ Given this is an automated firing system for fireworks, what are the Functional Safety requirements to avoid inadvertent ignition? \$\endgroup\$ Oct 7, 2023 at 15:26
  • \$\begingroup\$ @DaveTweed You are right, this is the main idea! The circuit needs to be able to deliver the 30A current in any state, except the state 2 (when both terminals are tied to GND). \$\endgroup\$ Oct 7, 2023 at 16:06
  • \$\begingroup\$ @ChesterGillon One of the hardware requirements is to tie both terminals to GND when the device is in Disarmed state. Another requirements are programmed at the software level. \$\endgroup\$ Oct 7, 2023 at 16:09

1 Answer 1


For transferring signals from STM use 4 opto-couplers.
To pulling terminals to GND use mosfets M2 and M3.
In firmware always turn on M2 delayed after M1 turns off (also other changes of mosfet states) otherwise mosfets get shot-through. Another words use dead-times.


simulate this circuit – Schematic created using CircuitLab

  • \$\begingroup\$ Thanks! This looks like exactly what kind of circuit i need. But i just need to turn the MOSFET using only 2 GPIOs. So i adapted your schematic, i removed the optocoupler for simplicity. My question is ... will be there a short circuit for short period of time because the power MOSFET is not fully OFF when the GND one turns ON ? Updated schematic: circuitlab.com/editor/#?id=wv7zeph6t784 \$\endgroup\$ Oct 7, 2023 at 22:40
  • \$\begingroup\$ A little short will occur since turning off of mosfet is more slow than opening. Maybe you can find a driver IC for such a purpose (with programmable dead-time). \$\endgroup\$ Oct 7, 2023 at 23:05
  • \$\begingroup\$ So after some tests i ended up using 4 GPIOs to control the MOSFETs, because i need 2 more possible states: State 5 -> IGNITION_POS: +12V and IGNITION_NEG: OFF, also State 6 -> IGNITION_POS: OFF and IGNITION_NEG: -12V (OFF means not GND, but both MOSFETS of one side turned OFF). The issue now is: when IGNITION_POS = +12V and negative side MOSFETs are OFF, the negative side MOSFET that has the role to tie to GND(M3) turns ON to. Updated schematic & simulation: circuitlab.com/editor/#?id=wv7zeph6t784 \$\endgroup\$ Oct 8, 2023 at 14:20
  • \$\begingroup\$ It is probably a current flowing through parasitic diode of M3 (body diode). The diode is still presented even the mosfet is off. \$\endgroup\$ Oct 8, 2023 at 15:28
  • \$\begingroup\$ Do you have any suggestion to prevent this happening ? \$\endgroup\$ Oct 8, 2023 at 15:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.