3
\$\begingroup\$

I'd like to start / stop a piece of software running on an in-car computer depending on the 12V_IGN rail going on resp. off. This happens when the ignition switch goes in / resp. out of position RUN. See these two scans from the original service manual. The computer corresponds to the radio on the schematics:

12V_STBY rail 12V_IGN rail

During my dry tests, I simply used a switch (connecting the IGN pin with GND), a pull-up resistor, and a CD4093B Schmitt trigger:

CD4093B

The output of the trigger goes to a level shifter because the computer expects +3.3 V on its GPIO inputs.

Now I'd like to know whether I will still need a pull-up / pull-down resistor when using the 12V_IGN rail of my car as input, or I can attach the IGN input pin directly to the rail.

UPDATE: In the service manual, the power junction block stands for the permanent (aka standby) +12V rail, and the wire labeled BRN in scan #2 is 12V_IGN, as it is only hot when the ignition switch is in position RUN.

\$\endgroup\$
7
  • \$\begingroup\$ What is "resp." short for? \$\endgroup\$
    – Aaron
    Jun 14, 2022 at 21:06
  • \$\begingroup\$ where is the 12V_IGN in the two diagrams? \$\endgroup\$
    – jsotola
    Jun 14, 2022 at 21:33
  • 1
    \$\begingroup\$ it may be a bad idea to connect a 10 kohm resistor between 12 V and IGN \$\endgroup\$
    – jsotola
    Jun 14, 2022 at 21:38
  • \$\begingroup\$ Pull-down in case the connector disconnected or no voltage at all. Overview the input may be floating and non-predictable. \$\endgroup\$
    – user263983
    Jun 14, 2022 at 22:53
  • 1
    \$\begingroup\$ that is yours to decide ... R7 may or may not interfere with the ignition system \$\endgroup\$
    – jsotola
    Jun 21, 2022 at 21:28

3 Answers 3

5
\$\begingroup\$

The CD4093, and many other chips as well, will be wiped out of existence by transients in short order if you connect their inputs directly to any DC power circuit in the car. Same goes for supply voltages: you have to regulate them down. The “12V” in the car can temporarily become +/-50V, with shorter spikes going even higher. Even the voltage regulators you’re using need to be able to take such transients.

You need at the very least a current limiting series resistor. Say four 250k resistors in series to minimize their capacitance. No need for a pull-down: the loads attached to the V_IGN line do that job already. No need for a pull-up either.

You don’t need the separate CMOS Schmitt trigger nor a special level shifter. In any case, leaving CMOS inputs floating should never be done - in case you’ll be designing other CMOS logic circuits.

You can scale the voltage down to 5V or 3.3V using a resistive divider. Schmitt inputs on MCUs will handle that fine. The divider’s Thevenin resistance should be between 100k and 1M. The higher the better usually, since the inputs are CMOS and thus like open circuits at DC. The upper resistor connecting the input pin to the ignition voltage should be split into 2, 3 or 4 series connected resistors to lower the parasitic series capacitance.

\$\endgroup\$
2
  • \$\begingroup\$ The CD4093's output goes straight to a GPIO input of a Raspi, which will only tolerate +3.3 V. \$\endgroup\$
    – Neppomuk
    Jun 15, 2022 at 20:50
  • 1
    \$\begingroup\$ @Neppomuk That's why you would use a resistive divider to take the 12V down to 3.3V. There's just no need for the CD4093 at all, nor for the level shifter. All you need is like 5 resistors. That's it. \$\endgroup\$ Jun 23, 2022 at 21:04
7
\$\begingroup\$

You need a pull-up (or pull-down) resistor to set a default in case the IGN wire isn't connected.

More importantly, the '12V' in automotive is not a clean 12V signal. It can vary up to 40 V under some fault conditions, and also has superimposed noise and spikes to +/- 100 V or more. Your schmittt trigger IC will be destroyed by these without some filtering. A reasonable filter would be a 10k resistor betwen the IGN wire and pin1, together with a 12 V zener with 0.1 uF in parallel to GND.

Secondly, never leave unused CMOS inputs floating -- tie them to GND.

3rd -- if you just want to detect IGN or 0 V, you can drive IGN via 100k to a 3.3 V zener diode (with 0.1 uF in parallel), and that via 1k to the MCU's input. You don't need the schmitt trigger IC -- do debouncing in software if needed.

\$\endgroup\$
3
  • 1
    \$\begingroup\$ Maybe I'm a coward, but the signal can be so spikey I would be tempted to use an optocoupler. \$\endgroup\$
    – abligh
    Jun 15, 2022 at 5:54
  • 1
    \$\begingroup\$ I'm with abligh on this one. The IGN signal is not changing rapidly so propagation delay through an opto is not going to cause any trouble. And you get robust isolation between a (potentially) horrifically dirty signal and your processor. \$\endgroup\$ Jun 15, 2022 at 15:43
  • \$\begingroup\$ Yes, I know that automotive power rails can be dirty. This is why I've got the Zener diode. I will also de-chatter the signal by querying the CD with a rather low frequency (4× per second). \$\endgroup\$
    – Neppomuk
    Jun 15, 2022 at 19:50
3
\$\begingroup\$

Looking through some old vehicle electronics I've worked on, there have never been pull-ups to VBAT on the ignition signal. Sometimes a weak pull-down and always RC-filtering and protection diodes. Your U3 is lacking decoupling and if you want filtering with C18 it would be good to place a resistor in front of it. Or do the filtering at U3 pin 1.

\$\endgroup\$

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.