Actually IMO it's easier to do than understand. Or certainly easier than trying to understand my gibberish above. In some ways it may be easier than that SAAB circuit.
All I reckon you need to understand is...
- a comparator is a device (chip, circuit,
(gate??) with 2 inputs and an output.
- the output is ON when the comp's '+' input has a lower voltage than its '-' input.
NOTE - that + & - input has nothing to do with +ve or -ve voltage; it's merely the
labels used to designate which input, namely non-inverting (+) or inverting (-). That jargon comes from
Op Amps (Operational Amplifiers) on which Comparators are based. (Instead of buying quad OpAmp chips/integrated-circuits) and adding components to make them into Comparators, manufacturers have already done that in chips like the LM339.)
- you connect your tested voltage to one input.
- the other input has the 'reference' voltage - ie, the voltage where you want the output to turn on or off (aka change state).
- the Ref voltage is set using a (resistive) voltage divider (see
Wiki).
That's basically it.
The other considerations are whether it's to be on or off when the tested/probed voltage is above or below the Ref voltage [that determines if the Ref is a + input or - input and hence tested input is - or + (ie, inverting or non-inverting) respectively] and misc other things...
The Misc's include supplying power to the Comp circuit (ie, the chip) and whether the output can handle the load.
Also voltage supply & ranges but that's not an issue since the LM339 etc uses a "single supply" (eg, +12V & GND, not +12V, 0V/GND and -12V) and your sampled voltage falls within its 0V to +12V range. (When I say +12V, I really mean whatever voltage the car is - eg, 10V to 14.4V etc.)
Then there are esoteric misc's like spike protection, noise filtering, tested voltage variation (from what the book said) etc. That's also called bluddy OldFart's rambling and is probably not an issue in this case. Or to paraphrase, an LM399 is cheap enough to suck and see and then worry about that esoteric crap if required (or if going into production...).
So yet again I have added extra ramble to a mere '
simple understanding', but maybe it will now be clearer.
BTW - my replies often take several reads - ie, a bit at a time. And my parentheses denote extra or incidental info that may not be needed but may pre-empt future questions or make readers aware of
possible issues or alternatives.
Re one Comp per door hence one "quad pack" LM399 for 4 doors - yes, BUT...
It may be possible to do all (or 2) with a single comparator.
EG - from the
National LM339 Datasheet page 5 is the following "OR" circuit - ie, output
f is OFF if A or B or C are
high.
- with thanks to National Semiconductor
Firstly, that circuit is merely an example. You would use different resistor values and have a different Ref voltage.
Secondly, merely to explain how it behaves (without going into the resistive voltage divider Voltages that appear), I've written the following.
NOTE - I thought the circuit was wrong but even I got confused about "ON" versus "high" or "low". Don't worry about such "
[Logic" issues - they'll blow
my your brain. Suffice to say it is all easy to change later if you get confused (ie, swap + & - inputs).
If output
f is OFF, the 3k resistor to V+ pulls f high (aka Logic 1), ie...
If any of inputs A or B or C go
high to V+, then the + input voltage is higher than the Ref - input voltage (+0.075V in that circuit) and hence the output is off (high).
If no inputs are high, then the inverting (-) input's voltage is
higher than the non-inverting (+) input thereby turning the output (transistor) on which pulls output f
low to GND.
(So yes oldfart, that circuit is correct. Of course it is - it's
National!)
The point being that if you only want one output if any door is open (or closed, whatever), then you could use that circuit.
It's the same if you only want to combine 2 doors so you only need one chip (LM339) for the lot.
Or combine more so that you have spare comparators to invert or buffer the output... (that's another story!)
And now your brain should well and truly be fried! As if
circuitry isn't bad enough, you have also been introduced to
Logic circuits where low & high and 0 & 1 and off or on are totally arbitrary and depend on what you call "active" (eg, high, or 1, or 1 but low, or....
Oh yeah, just as these comparators are almost infinitely configurable, so too there are almost infinite ways to do this.
However IMO it's either something DIY like this, or DIY using a PIC 08M2 etc, or more expensive circuits whether commercial & processor or analog based etc.
PS - IMO there no need to include the previous reply in your reply. Of course that's merely my view (I like to save screen space, bytes, & paper).
If I do, I usually only
quote the relevant lines(s) else delete and use dots ... to replace the bulk between the first & last lines.