I have a switch circuit on a 12V (runny from car battery) branch of my circuit. I need to use the Arduino Digital input to sense whether the switch has been activated. I need to reduce the 12V to 5V at 40mA max (I think) I'm not try to measure the voltage just whether it is on or off. I need to know what components i need to wire it up. Would appreciate a wiring diagram if possible.
now i'm really confused. Just to be clear the motor is a 12V Motor with a max amp draw of 400A. The motor is existing and i can really do much as the motor is concerned.
Putting a diode across the motor as suggested by CrossRoads will fix that. Alternatively, increase the resistor values to 200k and 100k, or even higher. This will limit the current going in to the protection diode on the Arduino input to a safe value.
geostu34:
now i'm really confused. Just to be clear the motor is a 12V Motor with a max amp draw of 400A. The motor is existing and i can really do much as the motor is concerned.
400A, really? I would love to see a picture of that motor.
A pullup on the arduino and a diode with cathode side to the motor and anode to the digital pin will provide a logic 0 when the motor isn't powered and a safe level logic 1 when it is. He is only after a quanitative value not a qualitative one. Motor powered arduino sees its logic supply, not powered it sees ~.538V.
You seem to assume that the positive line will always have a voltage >= 0V. This is not necessarily true since the motor is an inductive load. If for whatever reason a transient <0V is created this will fry the Arduino.