Taking inputs from car outputs

Just got my arduino, first board like it i've had...

I was wondering is it safe to take inputs from a 12v source?

I want to be able to read information from my car by tapping in to wires (like an alarm)

If the brake pedal in a car is pressed, the brake light wire has ground when pressed and nothing when let up. How would i use this? What about sources that are 12v when on and ground when off? Or sources that are 12v when on and nothing when off?

Noob here :)

Hmm looks like voltages would be way too high for the arduino... How would I get them to a suitable voltage? Would resisters be appropriate to just get it to a reasonable level for the digital inputs?

Also is it ok that: high is voltage (like +5v or whatever I end up with) low is NOTHING (instead of ground)?

I am also curious how to detect if an input IS ground rather than nothing... (3 way input? high, low, nothing?)

Sorry just a noob, I've searched on google for a while, but I just have not found what I was looking for?

http://www.seattlerobotics.org/encoder/mar97/basics.html

This really helped with the ground/nothing 5v/nothing conditions, I'm learning :)

use a voltage divider to step the 12V down to 5V. If you Google this forum you will find posts describing this.

D

Would this work:

78L05ACM http://www.futurlec.com/Linear/78L05ACM.shtml

Or are you suggesting just using two resisters?

Thanks for the help.

Are larger resisters better for this purpose? (Wouldn’t they take less draw? I guess its not a huge deal draw is negligible on car battery either way)

I know at least in my car with all electronics off voltage sits around 14.4 peaks as high as 14.6… With car off and audio system on I usually see about 11.5 as low as 10.5ish if i let the battery die down some should be able to take all of those voltages with ease.

If I understand correctly the zener would “short” the input ground/center of resisters to ground with anything over 5.6v in your diagram?

Thanks for your help, appreciate it.

edit: Your diagram looks good to me, thanks :slight_smile:

+ 14V  signal-----<<<>>>----------<<< >>>--------- Car Gnd & Arduino GND
                   2.2K      |       1K                |
                                  |                         |
                                  |                         |
                                  |---------|<---------------
                                  |        5.6V zener
                                  |
                                  |
                             Arduino input pin

the ascii diagram was no good, so I will upload a real one to the playground. Even though I don't like cars :)

D

edit: couldn't figure out how to upload to the playground. If you were standing right here, it would take me 30 seconds to draw it up, but on the net it consumes a half hour!

So just look up voltage dividers, use a 2.2K on the top, and a 1K on the bottom. The 10K/5K values you have above are fine too... Don't worry too much about the values, as the Atmega chip will recognize a "high" as low as about a volt. Over-voltage is the thing to be careful about.

You're correct about the zener: it clamps voltages in excess of its rating, acting like a short circuit. Since the current through the 2.2K/1K divider is only about 4ma tops, it will be just fine. Best of luck