Detect 12V from micro


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
Reply to
Michael C
Loading thread data ...
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
Reply to
Rheilly Phoull
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
Reply to
Jasen Betts
You need to clarify what are the thresholds for a good and bad 12v signal and weather you need hysteresis.
Reply to
Joe G (Home)
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
Reply to
Michael C
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
Reply to
Michael C
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 ?
Reply to
MC
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
Reply to
Jasen Betts
I'm using the phillips p89c668 which is an 8051 derivitive. It has internal pullups on some of the pins.
Michael
Reply to
Michael C
VCC is 5V from the standard 7805.
Michael
Reply to
Michael C
do you know what a "load dump" is?
it seems automotive electrics can be exttremely hostile... surges of upto 200V
Bye. Jasen
Reply to
Jasen Betts
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)"  wrote in message 
 Click to see the full signature
Reply to
Joe G (Home)
Not really but I'm guessing it's when a device puts power back into the system for some reason?
This I'm aware of which is why I asked the original question :-)
Michael
Reply to
Michael C
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.
your 7805 won't like 200V very much. is there other protection before it?
--
Bye.
   Jasen
 Click to see the full signature
Reply to
Jasen Betts
That bit I haven't done yet but was thinking of just using a few ohm resistor with a big cap. Sound ok?
Michael
Reply to
Michael C
maybe a 16V zener and a polyswitch?
Bye. Jasen
Reply to
Jasen Betts
What is a polyswitch?
Michael
Reply to
Michael C
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
Reply to
Jasen Betts

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.