0
\$\begingroup\$

I want to sense a circuit state in an Automotive circuit (12V nominal) from a 3.3V microcontroller (MSP430Gxxxx). The circuit is normally 12V (or VBat) until either the Wireless ECU or a Door Key grounds the line, triggering an event. How can I safely (in terms of not frying the MCU or affecting the state of the line) sense this?

From the Manufacturer description, this seems to be a simple Open Collector system, it is not a power circuit, so I don't know how much current can be sourced.

enter image description here

I would tap into junction J6.

As this is automotive, current consumption is a concern as well. My MCU will be set up to interrupt on a falling edge trigger, and asleep unless that happens.

\$\endgroup\$
  • \$\begingroup\$ This is separate from my other question. \$\endgroup\$ – Passerby Sep 13 '14 at 21:46
  • 2
    \$\begingroup\$ Check this question: electronics.stackexchange.com/questions/73857/… \$\endgroup\$ – Mike Sep 13 '14 at 21:49
  • \$\begingroup\$ Updated question to reflect that the line/circuit is not a power source. @mike my concern is that the line is pulled high by an unknown resistance, by default, then grounded. How would the 2mA draw of the opto + resistor to ground affect that? And I would like to avoid that scenario as having the 2mA on the car side and the 1mA on the mcu side, in an always on circuit, while small, might lead to drained battery at one point. If the signal was active high instead of active low, I can see that working. \$\endgroup\$ – Passerby Sep 13 '14 at 22:11
4
\$\begingroup\$

Use a pullup on the input. Put a diode reverse-biased on the input. When 12V is applied to the cathode no current will flow and the input will be pulled high. When 0V is applied to the cathode the input pin will be pulled to 0.7V, triggering a low.

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$
  • \$\begingroup\$ I added a schematic to visualize what you describe. Is this correct? \$\endgroup\$ – Passerby Sep 13 '14 at 22:05
  • 1
    \$\begingroup\$ @Passerby: Exactly correct. I would use an internal pullup though, if available. \$\endgroup\$ – Ignacio Vazquez-Abrams Sep 13 '14 at 22:06
  • \$\begingroup\$ Of course, that resistor was for illustration. Just to confirm, this should result in only leakage current unless the switch is grounded right? Minimal current draw if anything by the default level high state (MCU quiescent current not included)? \$\endgroup\$ – Passerby Sep 13 '14 at 22:14
  • 1
    \$\begingroup\$ Leakage through the diode, and leakage on the input. Although to be fair, the leakage through the diode may be enough to keep the input high and the pullup disabled. \$\endgroup\$ – Ignacio Vazquez-Abrams Sep 13 '14 at 22:21
  • \$\begingroup\$ What happens if the left ground is lower than the right ground? \$\endgroup\$ – Spehro Pefhany Sep 13 '14 at 23:03
1
\$\begingroup\$

By far the safest way to do this is with an opto-isolator. Simply power the LED from the 12V source, perhaps with a limiting diode to block very high voltages (e.g. zener). The phototransistor side is connected to your microcontroller, in a fully isolated and safe manner.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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