Detect 12V from micro

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View


I'd like to detect whether a line has 12V on it or not and read that into my
micro. The 12V will be quite dirty (from a car). I was thinking of just
using a transisitor, feeding the 12V into the base (via a resisitor) and
using the collector to gnd the micro pin. Will this be enough isolation or
should I use an opto isolator?

Thanks,
Michael



Re: Detect 12V from micro



Quoted text here. Click to load it
Assuming you dont mean exactly 12v, an optocoupler is cheap enough and will
keep your micro isolated. If you put a zener, say 10v, in series with the
dropping resistor to the opto diode there will never be any false
indications.
Dont forget using a zener will affect the calculation of the limiting
resistor.

--
Regards ......... Rheilly Phoull



Re: Detect 12V from micro


Quoted text here. Click to load it

that'd work, getting it to treat 8V as "not 12V" could be tricky,
if that's not an issue that's probably the easiest way to isolate
a single input.

Bye.
   Jasen

Re: Detect 12V from micro


Quoted text here. Click to load it

That's fine, I just need to detect if the ignition is on or off. If it's 6V
or above then it can be considered on, if it's below that my boards not
going to run anyway :-)

Just to be clear, you think it will provide enough isolation using a
transisitor? And just using a resistor from the ignition to the transistor
would be ok?

Thanks for the reply,
Michael



Re: Detect 12V from micro


Quoted text here. Click to load it

yeah, something like a 1Meg or 10Meg resistor and an NPN transistor pulling
the pin down. you could put a resistor between base and ground too, but it's
probably not needed.

another way would be a 4.7V zener diode from the input to ground (assuming
5V VCC) and a 100K resistor to the 12V signal  - any voltage that resistor
can witstand isn't going to harm the input.

thses schemes will see anything less than about 2V as "off", if the signal
 if you need the threshold nearer 6v a zener in series with the resistor
could help.

what are you using for your VCC supply?

Bye.
   Jasen

Re: Detect 12V from micro


Quoted text here. Click to load it

VCC is 5V from the standard 7805.

Michael



Re: Detect 12V from micro


Quoted text here. Click to load it

do you know what a "load dump" is?

it seems automotive electrics can be exttremely hostile... surges of upto 200V

Bye.
   Jasen

Re: Detect 12V from micro


Quoted text here. Click to load it

Not really but I'm guessing it's when a device puts power back into the
system for some reason?

Quoted text here. Click to load it

This I'm aware of which is why I asked the original question :-)

Michael



Re: Detect 12V from micro


Quoted text here. Click to load it

yeah, basicaly the alternator is running full tilt and then the battery goes
open circuit for some reason... the regulator stops feeding the altenator
field but typically the field still has to wind down on its own.

Quoted text here. Click to load it

your 7805 won't like 200V very much.
is there other protection before it?


Quoted text here. Click to load it


--

Bye.
   Jasen

Re: Detect 12V from micro


Quoted text here. Click to load it

That bit I haven't done yet but was thinking of just using a few ohm
resistor with a big cap. Sound ok?

Michael



Re: Detect 12V from micro


Quoted text here. Click to load it

maybe a 16V zener and a polyswitch?

Bye.
   Jasen

Re: Detect 12V from micro


Quoted text here. Click to load it

What is a polyswitch?

Michael



Re: Detect 12V from micro


Quoted text here. Click to load it

a type of reasonably fast acting  self-resetting thermal fuse, but they
don't go open circuit but more like a high resistance state

eg jaycar cat RN-3460

probably a bad idea also for the reason that temperatures in automobiles
are somewhat unpredictable and often extreme

Bye.
   Jasen

Re: Detect 12V from micro


You need to clarify what are the thresholds for a good and bad 12v signal
and weather you need hysteresis.


Quoted text here. Click to load it



Re: Detect 12V from micro


Quoted text here. Click to load it

This is just detecting if ignition is turned on in a car so thresholds are
not too important, could be say 6V is considered on. Hysteresis is also not
important because I'm just setting a timeout after which my device will
switch off, if the signal jumps all over the place the countdown will just
go back to zero. I'm more concerned about noise being a problem causing
damage to the cpu or undesirable results.

Michael



Re: Detect 12V from micro



Quoted text here. Click to load it

Don't forget to enable the input-pullup in your micro (if it
has one, if not, then provide one from the collector to the
micro's supply).
Put a filter cap across the base-emitter of your transistor.

I'd pick say 100k for the base resistor and 0.1ufd for
the filter and 10k for the pullup.

Many micros have inbuilt clipping diodes on their I/O lines, so
if you keep the input current low then you won't damage it.

Which micro are you using ?

Re: Detect 12V from micro


Quoted text here. Click to load it

I'm using the phillips p89c668 which is an 8051 derivitive. It has internal
pullups on some of the pins.

Michael



Re: Detect 12V from micro


Opto method would seem the safest and less likely to zap the micro.
JG

With micro's in general - keep all inputs within the data sheet
specifications otherwise weard things can happen.
JG

If product is long term..... allow for  LED opto fading...
JG

----------------------------

Assuming you dont mean exactly 12v, an optocoupler is cheap enough and will
keep your micro isolated. If you put a zener, say 10v, in series with the
dropping resistor to the opto diode there will never be any false
indications.
Dont forget using a zener will affect the calculation of the limiting
resistor.

--
Regards ......... Rheilly Phoull


We've slightly trimmed the long signature. Click to see the full one.

Site Timeline