Electronics > Beginners
Circuit to determine whether vehicle is running based on battery voltage level
(1/4) > >>
HwAoRrDk:
I am thinking of implementing an idea I had for something connected to a vehicle's OBD port. It will be powered by the +12V supply on the OBD port, which is usually a permanent non-switched feed direct from the battery. However, my device will only need to function when the vehicle's engine is running, so it should remain in a standby/sleep state at all other times. So, because there are no explicit means of determining 'on' state on the OBD port (no ignition-switched power feed, for example), I thought I could probably look at the voltage level to determine if the engine is running.

When 'off', the voltage will just be whatever the state of charge the battery is at - e.g. 12.x volts (or less). When 'on' and engine running, the alternator will be charging the battery, so the voltage level should be higher - probably at least 13V. Sounds right?

I think a comparator circuit should so the trick, especially as what I want out of it is a simple logic-level signal to feed to a microcontroller to tell it to either wake up or sleep.

I came up with the following circuit:



The salient points:

- Inverting arrangement; active-low output signal.
- Vbat gets divided such that approx. 13V is turned into 4.3V, plus low-pass filtered to avoid errant transients.
- A 5.1V zener protects the inverting input of the comparator should Vbat go any higher than expected.
- Vref is fed from +5V VCC, divided to about 4.3V. Feedback gives some hysteresis, of about 0.4V on Vbat.
- Output will use internal pull-up on connected MCU pin to ensure a defined high level when comparator is not triggered.

How does it look? Is there anything I have missed, or any way I could improve it?

Specifically, one query I have is if the input is low-pass filtered (and thus slow to rise/fall), is there any point in implementing any hysteresis? As the output is feeding an interrupt on the MCU, I suppose it is best to ensure no spurious oscillation, but I can't help wondering if I can get away without it.

Another thing I am concerned with is current draw, as this circuit will be always-on. I think it should be low power, as the simulation suggests that no more than a few hundred microamps will be drawn, but the sim gives no scope to measure current drawn by the comparator itself. What will be the current draw of a single-channel comparator?

For choice of comparator, I have been looking for something ubiquitous and cheap in a SOT package - the noted part nos. (TS391, AP331, MCP6541) are ones I've found so far. Will they be suitable?

By the way, I should probably mention that while my chosen MCU (AVR) actually features a built-in analog comparator peripheral, I cannot use it because disappointingly it does not appear to support waking up from standby/sleep modes upon a comparator interrupt, so I'll have to use an external circuit. :(
t1d:
I am noobish, myself, but here are some points...
- Alternators often put out 14.4 volts, with higher spikes.
- Automobile power is very dirty. Much cleaning and protection will be needed. My guess is that your power supply circuit is not sufficient, in this regard.
- Why does the controller need to sleep, as opposed to turning off. If it can shutdown, completely, you could just power it from the ignition, or auxiliary port/cigarette lighter/etc. If the controller needs to retain settings, maybe add some non-volatile memory. Or, add its own button battery...
- If the controller is a Microchip brand unit, yes, the built-in comparator is very likely not available, for external use. I have already researched that, myself.
tautech:
Why not use something where the work is already done.......alternator light.
Illuminated = High = engine not running.
Extinguished = Low = engine running.
CJay:
If you have access to OBD then why not let the OBD port tell you the engine is running? The data stream contains all the information you need.
Benta:
Depends whether it's OBD II or 'just' OBD. OBD II is standardized, but OBD could be anything.
Navigation
Message Index
Next page
There was an error while thanking
Thanking...

Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod