Detect 12V from micro

M

Michael C

Guest
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
 
"Michael C" <nospam@nospam.com> wrote in message
news:43b334b1$0$16676$afc38c87@news.optusnet.com.au...
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

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
 
On 2005-12-29, Michael C <nospam@nospam.com> wrote:
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?
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
 
"Joe G (Home)" <joe.g@optusnet.com.au> wrote in message
news:43b3c82f$0$21039$afc38c87@news.optusnet.com.au...
You need to clarify what are the thresholds for a good and bad 12v signal
and weather you need hysteresis.
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
 
Michael C wrote:

"Joe G (Home)" <joe.g@optusnet.com.au> wrote in message
news:43b3c82f$0$21039$afc38c87@news.optusnet.com.au...

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


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.
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 ?
 
On 2005-12-29, Michael C <nospam@nospam.com> wrote:
"Jasen Betts" <jasen@free.net.nospam.nz> wrote in message
news:431b.43b3b362.ca894@clunker.homenet...
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.

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?
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
 
"MC" <MC@nonexistent.place> wrote in message
news:dp1ev2$mp5$1@news-01.bur.connect.com.au...
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 ?
I'm using the phillips p89c668 which is an 8051 derivitive. It has internal
pullups on some of the pins.

Michael
 
On 2005-12-30, Michael C <nospam@nospam.com> wrote:
"Jasen Betts" <jasen@free.net.nospam.nz> wrote in message
news:5055.43b46264.bb6ea@clunker.homenet...
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?

VCC is 5V from the standard 7805.
do you know what a "load dump" is?

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

Bye.
Jasen
 
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


"Joe G (Home)" <joe.g@optusnet.com.au> wrote in message
news:43b3c82f$0$21039$afc38c87@news.optusnet.com.au...
You need to clarify what are the thresholds for a good and bad 12v signal
and weather you need hysteresis.


"Michael C" <nospam@nospam.com> wrote in message
news:43b334b1$0$16676$afc38c87@news.optusnet.com.au...
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
 
On 2006-01-01, Michael C <nospam@nospam.com> wrote:
"Jasen Betts" <jasen@free.net.nospam.nz> wrote in message
news:1025.43b4deb7.c8828@clunker.homenet...
do you know what a "load dump" is?

Not really but I'm guessing it's when a device puts power back into the
system for some reason?
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.

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

This I'm aware of which is why I asked the original question :)
your 7805 won't like 200V very much.
is there other protection before it?



--

Bye.
Jasen
 
On 2006-01-02, Michael C <nospam@nospam.com> wrote:
"Jasen Betts" <jasen@free.net.nospam.nz> wrote in message
news:50c1.43b843af.cf043@clunker.homenet...
your 7805 won't like 200V very much.
is there other protection before it?

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

Bye.
Jasen
 
"Jasen Betts" <jasen@free.net.nospam.nz> wrote in message
news:5a8c.43b8dfca.49675@clunker.homenet...
maybe a 16V zener and a polyswitch?
What is a polyswitch?

Michael
 
On 2006-01-02, Michael C <nospam@nospam.com> wrote:
"Jasen Betts" <jasen@free.net.nospam.nz> wrote in message
news:5a8c.43b8dfca.49675@clunker.homenet...
maybe a 16V zener and a polyswitch?

What is a polyswitch?
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
 

Welcome to EDABoard.com

Sponsor

Back
Top