Jump to content
Electronics-Lab.com Community

Comparator usage.. Help!


Recommended Posts

Hi All,
I've got a small project on the go and need some advice. It
concerns the use of voltage comparators, in particular the LM311 and
LM393. I've got a breadboarded ( plywood and cup screws!! ) test setup
and I've managed to get both comparators to work including some
hysteresis, but I am still having a problem in understanding why they
won't switch around the reference voltage. The comparators are set up
with single supply, +5V from a 7805 regulator and 0V ground as they are designed for. The reference voltage is to +ve input at 2.5V with about 0.1V hysteresis. I vary the input voltage to the -ve input using a cermet potentiometer. I expected the comparators to switch around 2.5V (allowing for hysteresis), but I am finding that they will only switch a
full 0.5V below this value at around 2V. I've scoured the internet, tried all the example comparator circuits I can find but no joy. The datasheets are no help either. What am I doing wrong? My project involves use of more complicated IC's for which I can get working no problem, it's just that these pesky comparators won't play ball! Any help much appreciated, before I go completely nuts!

Thanks,
Salvatore

Link to comment
Share on other sites

Hi Salvatore,
Welcome to our forum. ;D
You didn't attach your schematic showing all resistor values so I am just guessing.
The comparators don't have an output transistor that pulls up, an added resistor must do it. If the hysteresis resistor has a value too low then it will load-down the output resistor. Also if the load resistance to ground is too low then it forms a voltage divider with the output resistor.

Thia circuit is in the datasheet for the LM393 and it works fine if the load resistance is high:

post-1706-14279143241276_thumb.png

Link to comment
Share on other sites

Hi,
To keep things simple, I've reduced the circuit to not include hysteresis. I can't seem to find how to attach a schematic (sorry!), but the circuit is literally the LM393, +5V supply to the comparator and two pots, one 1Mohm for the -ve reference input and a 10K for the +ve input, all connected to ground. The output of the comparator has a 2K pull-up resistor.

Link to comment
Share on other sites

The 1M vaue of the pot is way too high. If the comparator has its max rated input bias current of 250nA then at 2.5V the error is 0.175V. Maybe your comparator has too much input bias current. Replace it to see.

Even the input resistance of your voltmeter will load down the voltage of the 1M pot.

To add an attachment, click on Additional Options in your reply, then Browse for the file on your hard drive and double click on it.

Link to comment
Share on other sites

Hi Again! ;D
Following on from the problem with the comparator ( which is now solved, thanks! ), I've since progressed with my circuit and have managed to get things more or less working. This sub-circuit is ultimately to act as a light detector ( using a laser diode as the light source ) to serve as input to a larger tachometer circuit measuring frequencies up to 2500Hz. The output of the comparator will be fed into the HCF4018B CMOS divide-by-N IC which will function as a first stage frequency divider. I've attached a schematic of the light detector, the blue and red parts depicting alternative versions. The blue part ( 10K pot ) is for testing the switching function, the red part ( Laser diode and phototransistor ) is as it is supposed to be in the final circuit. In testing the circuit ( using the 10K pot ) the switching seems fine, the hysteresis behaves as it should and the LED on the comparator output switches on an off as expected. I then added the red part of the circuit ( I took a guess at the 10K value of the pull-up resistor ) and initially things seem to work fine, switching the output LED on when the photo transistor is exposed to the light from the laser. On further tests I noticed that when VERY SLOWLY introducing the phototransistor to another light source ( a household lamp bulb ) that the LED wouldn't switch fully on, it would start to glow, brightening more and more as exposure to the light bulb increased. I investigated the output voltage of the comparator and found that it was swinging very slowly. With the +ve input of the comparator set at a threshold of +2.5V the comparator output starts to drop when the –ve input rises to just +2.2V, within 0.3V of the threshold. The current passing through the phototransistor at this point is around 400uA. This is a very similar result to the one that I had when I made the mistake of using too high a pot on one of the inputs. I suspect that I have the same problem here with the phototransistor not being able to provide enough current for the comparator to work properly. I swapped the phototransistor and resistor around and changed the resistor for a 1K, the thinking being that if I supply enough current first and then drain it with the phototransistor things would work better but I seem to be getting similar problems. Is it possible to boost the current in some simple way ( if this is indeed the problem! ) while maintaining the same input signal? Thanks in advance!

post-26836-14279143254474_thumb.jpg

Link to comment
Share on other sites

Hi Salvatore,
Your phototransistor is an emitter-follower without any gain. If its emitter is grounded and the 10k resistor is connected from its collector to the positive supply then its collector output would have lots of gain so it can switch quicker.

Then the comparator output would be the reverse of the way it operates now. The output of the comparator would go high with light. You can change around the comparator's inputs the make its output go low when there is light.

A household lamp bulb flickers at double the mains frequency, so photo-transistors can easily pick it up.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
  • Create New...