Best way sensing ground on wire

Go To Last Post
13 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm doing little project for my car. And I want to connect to wires like brake pedal, neutral switch etc.. many of them are usually left disconnected / hanging wire when inactive, but when are active they connect to the +12V etc... and that's not big deal but some of them when are active are connected to ground.

Doing all electronics myself I will perhaps use pull-ups but when I'm connecting to many wires on my car and many of them are going to the Engine Control Unit and I don't want to harm the unit so I want the transparent way to connect to the wire and detecting ground on it.

I'm thinning about P channel FETs, perhaps that's the answer to my question, but I'm not sure. Do somebody experience with this? Is the P FET good idea, or not?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Most switches are not electrically neutral when they are not being operated. For example, the brakelamps will keep the switch node at 12V (or ground); unless both (or three) lamps are all broken.

Connecting an AVR to car electrics has been discussed extensively in this thread:

https://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&p=587915

HTH

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The best way is a voltmeter/ohmmeter to see what the line rests at. Use the voltmeter to see if +12vdc is present in active state, if it is, then ohmmeter reference to ground to see what you have in inactive state.

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Something to be aware of in cars: Switches sometimes will have leakage across them for various reasons. It's entirely possible to have a normally open switch between your DVM (or AVR ADC) and +12V that reads +12V when off, because the leakage across the switch is much higher than your DVM. Basically a resistive divider in the many-megohm range.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Would that leakage not be the load (usually a lamp or a relay which are both quite low impedance) that's connected to 12V?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ok and when I don't want to use SmartFETs because I think I don't need so much of protection? And when I will find out that the wire is really disconnected (I have very good workshop manuals, they cost my 260euro but I can rely on them). Then is the P FET good way to electrically connect to such wire (just as input)?

And at all I don't care so much to protect the MCU as to protect the car :)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I see no reason to use a P-Fet.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

jayjay1974 wrote:
Would that leakage not be the load (usually a lamp or a relay which are both quite low impedance) that's connected to 12V?

No, I'm talking about conductive "gunk" across the switch, or wiring harness connectors, or wherever.

Not enough current to light a lightbulb, but maybe large microamps.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You may want to identify which wires actually connect to the PCM, and scope them. There may well be pullups already in place since the PCM also needs to sense the presence of a ground.

However, I can't imagine that something like a 10K pullup would cause an automotive PCM input any issues -- certainly not any permanent damage. Should be able to sense that pretty easily.

Don't knw what you're doing, but you probably want to scope the signals anyway. Auto environments are pretty awful from a noise standpoint. Might give you some hints on protection for your circuits.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You may want to identify which wires actually connect to the PCM, and scope them. There may well be pullups already in place since the PCM also needs to sense the presence of a ground.

However, I can't imagine that something like a 10K pullup would cause an automotive PCM input any issues -- certainly not any permanent damage. Should be able to sense that pretty easily.

Don't knw what you're doing, but you probably want to scope the signals anyway. Auto environments are pretty awful from a noise standpoint. Might give you some hints on protection for your circuits.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Don't know if there was a conclusion here.

I'm facing a similar question.

I need to attach MCU input to read a car switch that is normally open, and switches to ground when closed. The MCU will be Vcc=5.

The switch high side may or may not already have a logic level pullup on it, to some other control module in the car. But certainly there is no lamp or relay low impedence floating it high, it is a control line only. This design has to support cars of different possible configurations over time, so accommodating different environment conditions is a must. (Degree of design longevity robustness needed).

Here's a few cheap options, one should do, but which?

1. a series resistor at MCU pin to switch, say 4K7. And use the MCU internal pullup, assume pullup is nominal 35K to 50K.

2. a series signal diode at MCU pin, cathode to switch. And use the internal pullup.

3. maybe 1 and 2 in series, lowering the resistance perhaps to 1K. Would there be any added benefit for this over just a diode?

4. an external 4K7 pullup at the pin to MCU Vcc, followed by a series diode cathode to switch, like above.

5. some other arrangement of maximum 2 or 3 simple parts, resistor, diode... I don't need any caps, all debounce is done in software. Board space is tight.

I think the best protection for my MCU would be the options using an "outward facing" diode.

But which option/s would best "respect" other possible car controller MCU's. My design is 5V, what if the other controller was 3V, would this change the answer?

Regards,
Scott

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I found this link that walks through the process of adding more and more input protection parts... with scope shots. Very nice.

http://www.digikey.com/ca/en/techzone/microcontroller/resources/articles/protecting-inputs-in-digital-electronics.html

... but it doesn't cover adding an outward facing diode. I'm really curious as to why not?

Maybe because it only offers "half protection": adding such diode would prevent any inbound voltage (ringing, whatever...) from going higher than Vcc. But it offers no protection on difference of grounds where input ground goes lower than MCU ground, as the ringing on the line shows as low as -Vcc.

In this zone, the internal protection diode on the low side of the MCU pin would begin conducting. I guess that's why a series resistor on the pin is needed to limit current. Learning: a series resistor is more important that "just a diode", to handle the low inputs that drop really low.

Combo option 3 (previous post list) would be wise, to protect on low side as well. But if the resistor chosen is good enough to limit current for protect on low side, it's probably good enough to also protect the same way for high side as well. What's the need for outward facing diode? Maybe to protect from really high input voltage differences, ESD, EMI... can't hurt.

My take on this: series resistor essential. Diode optional. Use the internal pullup. Do debounce in software.

Link suggests chose resistor an order of magnitude lower than intenal impedence. So if internal pullup provides 35K-50K to Vcc, then 4K7 is bang on.

Keeping this to 2 to 3 parts hanging off the pin, probably better off forgetting about the diode and adding a capacitor to ground (a la low pass filter), to catch the really fast transients. A value of 0.1uF would mean a signal / noise spike faster than about half millisecond are ignored / absorbed by the cap. Recovery rate to recharge the cap through the internal pullup is ten times the noise duration.

I think this is all fine for a button press type input.

Regards,
Scott

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This reference touches on input protection, but should be a sticky reference for general MCU design considerations. Thank you [del]Motorola[/del] Freescale:

http://cache.freescale.com/files/microcontrollers/doc/app_note/AN2764.pdf

Regards,
Scott