Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Poor man's analogue comparator using a couple of CMOS logic gates.

Status
Not open for further replies.

Hero999

Banned
Sitting in the PAT lecture yesterday, being bored because I already knew what was being taught and I came up with an possible way of using a couple of logic gates as an analogue comparator.

The circuit works in simulation and should also work in real life but I haven't tested it yet.

Unfortunately I don't have any CD4069 ICs in through hole packages so I can't breadboard it but I'll give it a go with the CD4011 which should work just as well/poorly.

I know this isn't a very good comparator but it might be useful if you have a couple of spare logic gates on an IC and would rather avoid using another comparator IC.
 

Attachments

  • CMOS logic ana comp.PNG
    CMOS logic ana comp.PNG
    818 bytes · Views: 751
A CD4011 is available only as a CD4011B which has a buffered output. So its voltage gain is very high. A CD4069 inverter does not have a buffered output so its voltage gain is much lower and is affected by the supply voltage.

The threshold voltage of Cmos logic circuits is not half the supply voltage but is anywhere from 0.3 times to 0.7 times.
 
All right so the CD4011B looks like a better option anyway.

I'll get my breadboard out and test it, if not today, I'll certainly do it the following week, when I get back from holiday.
 
I've just tested it on a breadboard this evening and it works quite well.

I used a 5V supply and the CD4011 instead of the 4069.

The hysteresis was around 0.5V which is to be expected given the resistor values used. I tried omitting R4 but as I predicted, will operate in the linear region when the input voltages are close to each other so you should always include a hysteresis resistor to prevent this.

I didn't test the common mode range but I suspect it won't work down to 0V or +V, depending on the device used, with the IC I used, the output voltage of a single gate with a feedback resistor was 2.66V which means the inverting buffer will saturate when the input voltage goes below 160mV. I suspect this will be different if a different IC were used so it's probably good practise to assume the common mode range will be a couple of hundred mV of either supply rail.

This is certainly a viable solution if all you need is a comparator, have a couple of logic gates to spare and don't want to use another comparator IC, for example, it could be used to monitor the supply voltage or part of an IR beem break detector.

This circuit could also be used as a an inverting or non-inverting Schmitt trigger with settable hysteresis, by replacing R2 or R, respectively, with a potential divider consistinge of two 2M resistors connected accross the power supply.
 
Can this Logic gates comparator be a substitute for an ic comparator in making a mobile robot?the inputs will be the voltage in the potentiometer and the voltage in the LDR sensor.Please help.thanks
 
The threshold voltage of Cmos logic circuits is not half the supply voltage but is anywhere from 0.3 times to 0.7 times.

This is always quoted, but I have yet to see one that isn't Vcc/2 in many years of engineering. Still we design our circuits with this tolerance as if it failed because this was the case, heads and bodies would roll.
 
Can this Logic gates comparator be a substitute for an ic comparator in making a mobile robot?
Should be ok except where great precision is required (the threshold point being somewaht supply-voltage dependent). BTW this thread is 2 yrs old!
 
Last edited:
Thanks. I really need a design of logic gates that would replace the op amp comparator. Do you have any new idea?please.
 
I really need a design of logic gates that would replace the op amp comparator.
Why? Comparators are designed specially to do the job.
 
yeah,i know. But that's the requirement for our project. It can be implemented using nand gates and inverter in theory. But i don't know if it would work. BTW thanks.
 
It can be implemented using nand gates and inverter in theory. But i don't know if it would work.
Time to get your hands dirty. Try it and see :D. You learn more by hands-on experimenting than you do from theory alone.
 
yeah,i know. But that's the requirement for our project. It can be implemented using nand gates and inverter in theory. But i don't know if it would work. BTW thanks.
You sure you need a voltage comparator and not logic level comparator or something else? You should better check the requirements to be sure what you actually need.
 
Status
Not open for further replies.

Latest threads

Back
Top