Using a 12vdc input signal

69-cat

Member
Question, what would be the best way to use a 12vdc signal to operate an input pin? Resistor or zener diode to bring the voltage down that the picaxe can handle without making the chip disappear from the circuit board in a cloud of smoke?
Dave
 

westaust55

Moderator
Both methods are capable of working.

For the use of two resistors as a potential divider,
How stable is the 12 Vdc signal?
What is the absolute max and minimum voltage levels for the high/on state?
 

AllyCat

Senior Member
Hi,

Nearly always a simple resistive potential divider is best. Perhaps 22k from 12v to the PICaxe pin and 10k from the pin to ground (since you may have those values to hand ;) ), but other values may be as good, or better. Also, 10k is around the optimum value if you want to read the 12v as an analogue value using READADC{10}.

Beware that on rare occasions you might experience "phantom power" issues: If the 12 volts is present but the PICaxe power supply is NOT connected, then current can "leak" through the top resistor and through the internal "electrostatic protection" diode (on most PICaxe pins) to the supply rail. Probably not enough current to run the PICaxe normally, but perhaps enough to defeat the "Hard Reset" procedure, if you ever have need to use it. But there's no risk of "releasing the magic smoke". ;)

Cheers, Alan.
 

hippy

Technical Support
Staff member
A resistor divider is probably best as it is cheap and simple and means the voltage reaching the PICAXE can always be kept below the power rail voltage.

A current limiting resistor is often okay by itself but be aware that this requires the input pin to have an internal clamping diode to the power rail. Most of the PICAXE pins have that but some do not so that needs to be added externally; those pins are usually those labelled 'input only', for example leg 4, pin C.3 , on 08M2.
 

cypherf0x

New Member
A voltage divider as has been mentioned or a zener diode can be used. This is a 3.3v example but 5v is similar.
rqaA7OP.png
 

oracacle

Senior Member
another thing you may want to look at is a potential divider with a zenner in parallel with the bottom resistor, this should drain anything over the power supplied to the picaxe - it would have to be matched to the supply voltage. I have a small sketch on my wall (I have no idea why it there) stating a zenner of 5v1 for a 5v supply, I think this was a battery charge reader for the bike but can't really recall to be honest
 

fernando_g

Senior Member
In addition to all the good suggestions above, if you require galvanic isolation or common mode noise rejection, an optocoupler is the way to go.
Just remember, when you write the software, to take into consideration that the logic level will be inverted.
 

BESQUEUT

Senior Member
In addition to all the good suggestions above, if you require galvanic isolation or common mode noise rejection, an optocoupler is the way to go.
Just remember, when you write the software, to take into consideration that the logic level will be inverted.
+1
Used many times, and bullet proof...
If the question is "what is the best way..."
 

fernando_g

Senior Member
Best.............indeed.

That is what I like about the English language, it does have words with very specific meanings that don't require context to be understood.

In Spanish, both best and better translate as mejor.
Correct me if I'm wrong, but in French I believe it is also meilleur for both, but for emphasis you must add plus.

???
 

BESQUEUT

Senior Member
Correct me if I'm wrong, but in French I believe it is also meilleur for both, but for emphasis you must add plus.

???
Sorry, you can't use "plus" with "meilleur" as "meilleur" is already the word for "plus bon" (literaly more good)
You can say : "plus efficace que ", "plus performant que ", "plus fiable que ", "meilleur que" but not "plus meilleur que"
If you want to ask for the best, you can say : "le plus efficace", "le plus performant", "le plus fiable" or "le meilleur"

Anyway, if your 12V signal is quite good and/or your application does not need to be very reliable, use resistors.
If you require galvanic isolation and/or common mode noise rejection, an optocoupler is the way to go.
 

69-cat

Member
Thanks for the feed back! Yes the power is stable, even though the voltage is coming through a battery source, I still have it going through a 12vdc regulator before it hits any parts on the board.
Dave
 
Top