DVDdoug:
Whan you say "monitor" do you just want to check if it's on/off or do you need to measure the voltage? Do you need isolation?
I want to know if it's on / off and would prefer isolation due to the high voltages. It's a Diesel engine and from what I understand, one can get short high voltage spikes when the engine is "cut-off". I've measures 50V once but have heard that it could spike upto 70V. So I want to have isolation for protection of the Arduino.
A 12V petrol / diesel engine can produce between 11.8V and 14.6V (and sometimes higher), depending on the the battery's health, and the type alternator. a 24V engine can sometimes produce upto 27V from the alternator.
I need to monitor both types, and would like to build a "universal" type monitor which can be used on either voltages, safely.
There's another threat in the forum about a "car psu" and it sounds to me like a car's electronics is quite "harsh" for an Arduino.
DVDdoug:
4n25 opto isolator but then realized that it only has a "variable" voltage of upto 70V on the output side, not in the input side.
On the input side, there's an LED.
LEDs are "constant voltage" devices. That means (like with a standard LED) you use a series resistor to limit the current, and as long as the current stays within spec, the voltage across the voltage remains approximately constant with the remainder of the voltage dropped across the series resistor. You cannot "over voltage" an optioisolator's input unless you exceed the current rating or you exceed the isolation/breakdown voltage.
A quick look at the spec sheet says the 4N25 should work between 10 and 60mA at about 1.5V. With 12VDC that's 10.5V across the series resistor. Choosing 15mA and using [u]Ohm's Law[/u], we get 10.5V/0.015A = 700 Ohms. Boosting the voltage to 24V gives 1500 Ohms. (Or, using the same 700 Ohm resistor, we'd get around 30 mA, and the device would still work.)
60mA at 50V (48.5V across the resistor) gives us 808 Ohms as a minimum safe value.
If you use a 1K resistor, the optoisolator should get more than the required 10mA at 12V and less than the emaximum 60mA at 50V.
I know the math in Ohm's law, but is that good enough, or is there a better / safer way?