4
\$\begingroup\$

I have an existing automotive circuit simplified in the image. The loads (2 or more solenoids in parallel) share a 12V supply and are individually switched to ground through the car's ECU.

I need to detect when any one of the circuits close (only one closes at any one time), using a single PIC digital in (or comparator if I must), and with the minimum of wiring (the car's wiring is buried and a pain to get to although the common 12V rail is easy to get to). I can't disturb the ground plane(s) and can't add much load.

I have looked at highside current sense ICs but can't find them in DIP and don't want to use SOT if I can help it as I will be hand-soldering to stripboard. Anyway, I don't need to know how much current is flowing, just whether it is or not.

There must be a simpler solution that I'm missing?

two loads in parallel

\$\endgroup\$
4
  • \$\begingroup\$ To be clear - the switches are not real, they are logical and internal to the car's ECU so I cannot get to their low sides. \$\endgroup\$
    – Jon
    Commented Apr 29, 2013 at 11:15
  • \$\begingroup\$ What would the maximum current be, when either "switch" is closed? \$\endgroup\$ Commented Apr 29, 2013 at 13:08
  • \$\begingroup\$ I've measured this to be around 150mA. \$\endgroup\$
    – Jon
    Commented Apr 29, 2013 at 15:25
  • \$\begingroup\$ Then the solution in my answer below will work well with a 0.2 Ohm shunt resistor and 100x gain to give 3 Volts output and leave some margin of safety. \$\endgroup\$ Commented Apr 29, 2013 at 15:34

5 Answers 5

3
\$\begingroup\$

Here is a simple solution:

R1, R2, SW1, and SW2 represent the circuit in the car that you can't modify. D1 and D2 perform a OR function so that the bottom end of R3 goes low when either or both switches are closed. I would put D1, D2, and R3 close to where these switches are, then R4 by the PIC.

You have to assume the long line will pick up noise and transients, so R4 provides some impedance for D3 to work against to clamp the signal at the PIC to safe levels.

Added:

There is confusion as to whether or not you can get at the low sides of the loads. My first reaction was that this would be the easy way to connect because you only have to monitor the voltage. It therefore doesn't require breaking any connections, just tapping off existing connection points.

However, if it is really better to break into the high side power connection to the loads for some reason, then here is a simple way:

Again, R1, R2, SW1, and SW2 are the switches and loads that you presumably can't get into. This requires breaking the power connection to the loads and inserting R3, R4, and Q1. R3 is a current sense resistor sized to produce enough of a voltage drop to turn on Q1 when either of the loads is on. R4 is just to limit current thru the base of Q1 to safe levels.

The long wire to the PIC board is intended to be between the collector of Q1 and the top of R5. With the R5, R6, and Q2 receiving circuit, a lot of noise and nasty spikes can be tolerated on that line. When Q1 is on, Q2 will be driven on, which will drive OUT low. Th collector of Q2 goes directly to a PIC pin with a internal pullup. Noise shouldn't be much of a issue here since R5, R6, and Q2 are intended to be on the same board close to the PIC.

Overall, when a load is turned on, the PIC input will go low.

\$\endgroup\$
6
  • \$\begingroup\$ I like this but my only reservation is the additional connections to each load. It is certainly my favourite if I can't work the opto solution. \$\endgroup\$
    – Jon
    Commented Apr 29, 2013 at 12:25
  • \$\begingroup\$ @Jon -- Wait a minute! You just told us (me) that you can't access the low side of the load. \$\endgroup\$ Commented Apr 29, 2013 at 14:51
  • \$\begingroup\$ @DrFried: He said in a comment to the question that he can't get to the low sides of the switches, not the loads. \$\endgroup\$ Commented Apr 29, 2013 at 14:56
  • \$\begingroup\$ Yeah, that's what I thought. I was questioning his understanding, not yours. His comment on my answer is wrong... or at least confused. \$\endgroup\$ Commented Apr 29, 2013 at 15:00
  • \$\begingroup\$ It's me that's confused as I didn't notice the zener (or didn't pay enough attention more like... \$\endgroup\$
    – Jon
    Commented Apr 29, 2013 at 15:24
1
\$\begingroup\$

If you can access the 12V side and, all you care about is any one-contact (or more) closing then possibly an opto coupler may work (although it will "lose" something like 3V including current limiting and diodes across the LED to protect the opto-diode from being over-stressed when more contacts close).

The opto-coupler output will be a transistor that, with the appropriate pull-up resistor on the collector, will provide an input to your monitoring device.

\$\endgroup\$
1
  • \$\begingroup\$ I like this. The loads are solenoids so I can probably deal with a volt or two drop, but need the current. I have simulated it with a small resistor for the LED side of the opto and a second small resistor in parallel to reduce the current through the opto, and nothing blows up. I wonder if this would work? \$\endgroup\$
    – Jon
    Commented Apr 29, 2013 at 12:30
1
\$\begingroup\$

You can use the Analog Devices AD626 single supply Differential Amplifier available in a DIP-8 package ($8.62 in single units at Digikey) for high side current sensing.

The AD626 can handle 24 Volts common mode input if powered by 5 Volts, or 6 x (Vcc -1) per the supply voltage. In case your device uses a 3.3 Volt supply rail, the CMR is +13.8 Volts, which may be somewhat borderline with a 12 Volt automobile circuit.

As the part has a maximum gain of 100, a very small value shunt resistor would suffice to sense presence / absence of current: If expected maximum current is in the 0.5 Ampere range, then a 0.1 Ohm shunt resistor would provide a full-scale (5 Volts) output.

If expected current is significantly higher, then either a lower shunt resistance (thus lower heating issues) or reducing the gain to 10x would be preferable.

The linked datasheet provides a current sense schematic for the application:

Schematic

Notes:

  • For sensing the two paths individually, two of these diff-amps would be needed, and these are not inexpensive parts.
  • Allowing for significant headroom in the output signal is suggested: As the purpose is solely to detect current flow, not to measure it, a small designed voltage level for the output would allow this headroom.
  • As other answers have pointed out, in an automotive environment, overvoltage clamping, fast flyback diodes and other precautions are a necessity.
\$\endgroup\$
0
\$\begingroup\$

The Voltage Divider

If you are looking for a simple solution above all else, you could just add two resistors, but they'll have to be very large:

schematic

simulate this circuit – Schematic created using CircuitLab

This will produce 2.8V at the MCU input (e.g. designed for a 3V logic) when the switch is open and 0.0V when the switch is closed.

Please Note:

  • It will add about 1uA each (2uA total) continuous leakage to the system. That should stay below the 10uA guideline I see typically used in automotive applications.
  • You should add a clamping diode if the load is inductive (relay, solenoid)
  • You should add a series resistor to the MCU input path to protect against the general automotive environment (voltage spikes)

Hopefully, adding four passives isn't too bad...

\$\endgroup\$
7
  • \$\begingroup\$ sorry, I will edit my question to be clearer that those switches are not real, they are internal to the car's ECU and I am unable to get to the lowsides. \$\endgroup\$
    – Jon
    Commented Apr 29, 2013 at 11:14
  • \$\begingroup\$ So what can you get to? Just the high side of the LOADn resistors? \$\endgroup\$ Commented Apr 29, 2013 at 11:16
  • \$\begingroup\$ The high side of the loads is easy. The low sides are separate wires into the ECU and are not easy but possible. I'd rather avoid connecting to each load separately. \$\endgroup\$
    – Jon
    Commented Apr 29, 2013 at 11:20
  • \$\begingroup\$ Your only option at that point is to splice small sense resistors into the lines and use a high-side current-sense amplifier. You haven't given us anything else to work with... although it's probably easier to open up the ECU and implement what I suggested above, since the ECU is behind a connector (and therefore removable). \$\endgroup\$ Commented Apr 29, 2013 at 11:29
  • \$\begingroup\$ Unfortunately getting into the ECU isn't an option in this case as the circuit is to be an add-on for fitting by the end user. I was hoping there would be something simpler to implement but if a current sense amp is the only way forward I'll have to look into the options. My biggest problem there is that I can't seem to find a highside current-sense package I can easily use with 0.1" stripboard. \$\endgroup\$
    – Jon
    Commented Apr 29, 2013 at 12:08
0
\$\begingroup\$

If you have physical access to the solenoids, you could mount a hall effect sensor to detect the magnetic field generated when the solenoid is energized. This would require 1 sensor per solenoid, but it would be completely non-invasive, from the standpoint of splicing into existing wiring.

\$\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.