Shop OBEX P1 Docs P2 Docs Learn Events
reading 12 volt signal — Parallax Forums

reading 12 volt signal

Alex41Alex41 Posts: 112
edited 2007-11-20 18:41 in General Discussion
Hello,

I am looking to read a 12 volt signal with an SX chip. All I need is a simple on/off. The 12v signal will either be on or off. Lets keep it simple and say I need to read when the brakes are applied in a car by reading the pos voltage signal going to the brake lights. The signal is either 12v or 0v.

I know an input port can only take 5v. Would a resistor work? I know that only limites the amperage, but the 12v would still get to the input port? or would limiting the amperage be OK?
I know I could probably us the 12v to signal a transistor which could swith a 5v source to signal the input port, but is there a simpler way?

Thanks for any help,
Alex

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When I go, I want to go peacefully in my sleep, like my grandfather, not screaming and yelling like the people who were in the car with him.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2007-11-20 17:30
    The best thing would be to use an optoisolator since that will also help to keep noise from the car's electrical system out of the SX system. You would choose a series resistor for the LED in the optoisolator based on the 12V input. A 1K resistor would work just fine. You'd need a pullup on the output of the optoisolator ... 10K would work there.

    You could also use just a voltage divider with a 4.7K resistor between the SX pin and ground and a 10K resistor between the SX pin and the 12V input. This would give you a roughly 4V input on the SX pin when the signal light turns on.
  • BeanBean Posts: 8,129
    edited 2007-11-20 17:32
    If you use a resistor value large enough, that is all you need. The SX has input protection diodes that limit the voltage at the pin.

    Something like a 22K should work okay.

    You'll have to determine if the input is REALLY 0volts or just floating. If it is floating, then you should add a pull-down resistor too.

    Edit: Mike beat me to it, but the voltage divider would function as the pull-down too.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    www.iElectronicDesigns.com

    ·
  • Alex41Alex41 Posts: 112
    edited 2007-11-20 18:41
    Mike - thanks for the reply.

    Bean - thank you also, BTW thanks for the info you gave me a while back on using the hardware timers on the SX-48. The info got me to solve the problems I was having.

    Alex

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When I go, I want to go peacefully in my sleep, like my grandfather, not screaming and yelling like the people who were in the car with him.
Sign In or Register to comment.