how can i read 12v negative with digital pins

What is the best way to read 12v negative with Arduino digital pins?

i am wiring up my cars dashboard lights to a Arduino and replacing some of the lights with LEDs

some of them are 12v+
but most of them are 12v-

so i will need to reduce the voltage to 5v and invert it so that the Arduino can read it

any suggestions?

I'm pretty sure your dash lights don't run from -12V (relative to the car's chassis) because that would require a DC-DC inverter to invert the battery voltage. Sometimes, +12V is supplied continuously and the ground is switched/connected to turn the light on.

Use a [u]voltage divider[/u] to knock +12V down to +5V and add a [u]protection diode[/u] to protect from voltage surges.

If you really needed to detect the presence or absence of -12V, that could be done with an optical isolator. Or, it could even be done with a relay. That's easier than actually inverting the voltage.

-12volt can also be detected with a simple voltage divider.
e.g with a 10k pull-up resistor to 5volt, and a 33k resistor to -12volt.
0volt will read as "high", and -12volt will read as "low".

I also have never seen a car with a +12volt and -12volt system.
Leo..

I also have never seen a car with a +12volt and -12volt system.

No and nether has the OP.
The question is clearly a nonsense based on a total misunderstanding of how electric wiring in a car works.

Grumpy_Mike:
No and nether has the OP.
The question is clearly a nonsense based on a total misunderstanding of how electric wiring in a car works.

Yes i am new to car electric wiring
I meant something more like what DVDdoug said
I just didn't know how to describe it

DVDdoug:
Sometimes, +12V is supplied continuously and the ground is switched/connected to turn the light on.

I just didn't know how to describe it

You say "some things need a top switch or current sourcing" that means you have to supply +12 to them as the other end is already connected to ground.

And "some things need a bottom switch or current sinking" that means one end is already connected to +12V and you have to switch the other end to ground.

Grumpy_Mike:
You say "some things need a top switch or current sourcing" that means you have to supply +12 to them as the other end is already connected to ground.

And "some things need a bottom switch or current sinking" that means one end is already connected to +12V and you have to switch the other end to ground.

ok thanks now i know the correct terminology

how would i go about sensing something with a bottom switch ?

should i use a Relay or an Optical isolator or maby Voltage divider
or something completely different ?

I would favor an optical isolator. Wire a resistor to 12V then to the opto. then the other end of the opto to your device, so that when it gets connected to ground so does the opto. Then wire the output of the opto, emitter to ground, collector to the Arduino input and enable the internal pull up resistors.

ok thanks

i was looking at some sharp pc817 optical isolators yesterday i will give them a try

Edit
Thay work very well