I want to use an LM311 comparator to compare my 12V battery voltage to some reference I have, but I want it to output 5V so I can read it with my microcontroller. Due to this, I'd think I have to set the V+ pin to 5V. If I do this, can I still input 12V to it?

  • 1
    \$\begingroup\$ It looks to me like you can hook this up in an open-collector configuration to whatever voltage you want. It does not output any voltage, but rather its output is the state of a transistor, whether on or off. \$\endgroup\$ – Hearth Nov 25 '19 at 20:36
  • \$\begingroup\$ @Hearth Oh! That's true, I forgot it was an open collector output! What do I have to put on V+ though? \$\endgroup\$ – Iaka Noe Nov 25 '19 at 20:38
  • \$\begingroup\$ take a look at the recommend operating conditions \$\endgroup\$ – Christian Nov 25 '19 at 20:44
  • \$\begingroup\$ @Christian so... my max Vin + 1.5V? \$\endgroup\$ – Iaka Noe Nov 25 '19 at 20:48
  • \$\begingroup\$ When you are confused what to use, try to write a spec for input range and output. You can divide down to Vcc/2 for Vcc=5V or 3.3V and choose better devices that are Rail to Rail using CMOS instead of BJT's which of course have saturation and darlington drops \$\endgroup\$ – Tony Stewart EE75 Nov 25 '19 at 21:22

The LM311 is not very good to power with just 5V as it will have a very restricted input range (only 0.5V to 3.5V when powered from 5V) I would power the VCC+ from a 12V supply (possibly the voltage you are measuring if appropriate). A more modern comparator would not have this restriction - even an LM393 which is 40 years old would be better.

The output is open collector so you can use a pull-up resistor to 5V to produce a 5V logic signal even if powering it off 12V.

The allowable input range is only up to (VCC+) - 1.5V, which is 10.5V if the supply is 12V so you cannot put the 12V you wish to measure directly into the IN+ pin. You will need a divider to bring it below 10.5V even when the 12v level is at it's highest (for example if it could be 15V then divide it so the input voltage is 10.5V under that condition).

  • \$\begingroup\$ Why is an LM393 better? I'm reading its datasheet and it says Vin(max)=(V+)-1.5V as well... \$\endgroup\$ – Iaka Noe Nov 25 '19 at 20:54
  • \$\begingroup\$ @IakaNoe THese and the LM339 (Quad) can sense to gnd (0V) . That's what counts. Then use your Vref =1.2 or whatever. to compare your scaled input down to that Vref. \$\endgroup\$ – Tony Stewart EE75 Nov 25 '19 at 22:10
  • \$\begingroup\$ No I am saying the LM393 (dual) and the LM339(quad) digikey.ca/products/en/integrated-circuits-ics/… have Vcm to 0V \$\endgroup\$ – Tony Stewart EE75 Nov 25 '19 at 22:20
  • \$\begingroup\$ @TonyStewartSunnyskyguyEE75 I'm not sure I understand... You're saying Vin(min)=0 on these? What's it on LM311? \$\endgroup\$ – Iaka Noe Nov 25 '19 at 22:26
  • \$\begingroup\$ They only spec Vin +/-15V with Vcm = -14.5 or 0.5V above Vee but that's not well defined below this \$\endgroup\$ – Tony Stewart EE75 Nov 25 '19 at 22:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.