We have successfully done this by monitoring the input voltage. If at 11 to
12.6 the engine is off, if the motor is running it will be at 13.2 to
13.8V. We have used this on motorcycles (6 to 6.8), Petrol and diesel cars as well as Diesel trucks (24, 27.6).
Just a few warnings, when the starter motor is kicking in the voltages go all over the place, especially on older vehicles, so use a TVS at least. Also beware that if the battery gets to the end of its life it acts more like a cap, the voltage will jump up quick but drop if the motor is idling. We used 30 samples on one second interval to overcome most of these issues.
To overcome different readings on different hardware mostly due to resistor values we did not go to the extent of calibrating the ADC but we just added an ignition voltage as a soft setting. Example: my car indicates ignition if the input voltage rises over 12.8V, in my wives car its set as
13V.
Have fun
--------------------------------------- This message was sent using the comp.arch.embedded web interface on
formatting link