Comparator CD4063B

Thread Starter

dledge

Joined Feb 11, 2014
60
Need some help understanding this chip.

I've used LM339 comparators before with no issue; however, I'm creating a 12V circuit now and will be using a CD4063B chip.

The circuit will be a light detector. When the surrounding ambient light reaches a certain level, the output needs to go to Logic High. I will need some hysteresis to eliminate bouncing.

I've built the circuit using the LM339, but when I am trying to map this over to the CD4063B chip, I cannot figure out out to get the hysteresis implemented. Basic schema is attached.

Any help would be appreciated.
 

Attachments

ScottWang

Joined Aug 23, 2012
7,400
LM339 is an analog comparator, but the CD4063 is a digital comparator, they are complete different, if you wish to do that then you need to adding a schmitt trigger as 74HC14 or MC14584 before the CD4063.
 

lightingman

Joined Apr 19, 2007
374
Yes, the 4063 is a digital comparator. It is designed to compare two, four bit binary signals. It can also be cascaded to any binary value upward of that. It gives three outputs: A>B, A=B and A<B.

It is a totally different beast to the LM339.

Daniel.
 

eetech00

Joined Jun 8, 2013
3,951
Need some help understanding this chip.

I've used LM339 comparators before with no issue; however, I'm creating a 12V circuit now and will be using a CD4063B chip.

The circuit will be a light detector. When the surrounding ambient light reaches a certain level, the output needs to go to Logic High. I will need some hysteresis to eliminate bouncing.

I've built the circuit using the LM339, but when I am trying to map this over to the CD4063B chip, I cannot figure out out to get the hysteresis implemented. Basic schema is attached.

Any help would be appreciated.
Hi

Like ScottWang indicated, the CD4063 is a digital comparator. There is no hysteresis that applies to it.
It compares digital input word A to digital input word B.

I don't think I understand what you want to do.
Are you trying to replace the LM339 with the CD4063?

eT
 

ScottWang

Joined Aug 23, 2012
7,400
Hi

Like ScottWang indicated, the CD4063 is a digital comparator. There is no hysteresis that applies to it.
It compares digital input word A to digital input word B.

I don't think I understand what you want to do.
Are you trying to replace the LM339 with the CD4063?

eT
The LM339 already have quad comparators, so I really don't know why he tried to do that.
 

crutschow

Joined Mar 14, 2008
34,432
To use the CD4063 digital comparator with an analog signal you would first have to convert the signal to digital with an A/D converter and then feed its output to the CD4063. Obviously that's overkill for a simple task that can be done easily with a single analog comparator.
 

Thread Starter

dledge

Joined Feb 11, 2014
60
I hope I didn't waste everyone's time...I made the mistake of assuming the CD4063 was a higher voltage version of the LM339 comparator I was using. My mistake.

I have since been better educated and have modified the circuit to utilize a simple 741 op amp set up as a non-inverting comparator. What I am now dealing with, is how to properly set the hysteresis. The circuit I am trying to create is a light sensor. The output needs to mimic a digital 0 / 1 output that will be feeding into a CD4063 IC.

Attached is the schematic I am using. Where I am getting tripped up, is how to properly set the hysteresis. I found several formulas, but I haven't been able to find anything that will tell me how to set the resistors so that the triggering thresholds are biased towards low.

The real world application of this circuit is for a chicken coop door. The light sensor will tell the master logic circuit if it is light enough to open the door. It would be very bad to lock the chickens out because of a cloud crossing the sun, or just a darker day. So, I need to figure out how to create a decent threshold overall, but heavily biased in keeping the output high (door open). I ONLY want the output to go low if it is really and truly dark
I believe there are TWO values I need to be playing with.
1. The reference voltage as seen by V-.
2. The resistor between the OpAmp output and V+

I believe that #1 sets the change point
I believe that #2 sets the width of the threshold

Am I correct in my thinking?
Is there anything else I should be thinking about here?
 

Attachments

ronv

Joined Nov 12, 2008
3,770
Don't let anyone see you making a circuit with a 741 op amp. They are almost as old as I am.
I think this is what you are looking for. You can adjust the spread with R1 and move the trip point with the pot.
 

Attachments

Thread Starter

dledge

Joined Feb 11, 2014
60
Don't let anyone see you making a circuit with a 741 op amp. They are almost as old as I am.
I think this is what you are looking for. You can adjust the spread with R1 and move the trip point with the pot.
I think this is good...I cannot see the bottom portion of the circuit diagram. Would you be willing to repost that?
 

Thread Starter

dledge

Joined Feb 11, 2014
60
Don't let anyone see you making a circuit with a 741 op amp. They are almost as old as I am.
I think this is what you are looking for. You can adjust the spread with R1 and move the trip point with the pot.
Also, I swapped out the part to no longer be named for an LM339.

The configuration is set, but the comparator is returning a change of only a couple of mV...I'm guessing I've set something up wrong. Is there a way to increase the voltage returned on the output?
 

ScottWang

Joined Aug 23, 2012
7,400
I hope I didn't waste everyone's time...I made the mistake of assuming the CD4063 was a higher voltage version of the LM339 comparator I was using. My mistake.
...
Am I correct in my thinking?
Is there anything else I should be thinking about here?
If you use 741 then maybe you need to in series a 1N4148 diode with base of bjt, because the low output voltage maybe too high and drive bjt to turn on, or increasing the value of 1K to 8.2K, and then decreasing the Rbe to about 3.3K, using Rbe as a shunt resistor to turn off the bjt when the output of op amp is output low, the Rb and Rbe are need to adjust to suit the current of relay.
 

ronv

Joined Nov 12, 2008
3,770
Here is the schematic with the whole thing.
I set it up for a LDR that I had. 39K in the light and 1 meg in the dark. Yours may be different and we would need to change some things.
If you can measure the voltage on the + & - inputs in light and dark and the output we can probably figure it out.
 

Attachments

ScottWang

Joined Aug 23, 2012
7,400
Here is the schematic with the whole thing.
I set it up for a LDR that I had. 39K in the light and 1 meg in the dark. Yours may be different and we would need to change some things.
If you can measure the voltage on the + & - inputs in light and dark and the output we can probably figure it out.
What's the reason make you to connect relay to e of bjt, when you connected that way the relay only can get about 11V?
 

ronv

Joined Nov 12, 2008
3,770
Hi Brevor, The circuit is called common collector or emitter follower:
http://www.opencircuits.com/Basic_Circuit_Building_Blocks#Transistor_Emitter_Follower
It has current gain only, but the voltage on the emitter will follow the voltage on the base as long as the base current times the gain of the transistor is high enough to turn it on. In this case the relay only needs about 25 ma and the gain of the transistor is at least 100.
If the relay were in the collector like Scott mentioned The emitter is at ground so it needs something to limit the base current. The reason I used the emitter follower was because Deledge wanted a lot of hysteresis, so I wanted the output of the 339 to swing all the way from ground to 12 volts. The relay specs say it only needs 9 volts to pick so I didn't worry about the drop from base to emitter.
 

Alec_t

Joined Sep 17, 2013
14,313
Be aware that in Ron's circuit the relay will draw current continuously in daylight.
There are threads on this site relating to controlling chicken coop doors. Have you checked those out?
 

Thread Starter

dledge

Joined Feb 11, 2014
60
Be aware that in Ron's circuit the relay will draw current continuously in daylight.
There are threads on this site relating to controlling chicken coop doors. Have you checked those out?
Thanks Alec - I did notice that. Do I have another option? I was going to try switching the comparator to be a 'non-inverting' version.

As to looking to other threads...I have. The portion for which i am seeking help is only the "light" sensing switch. The rest of the circuit problem has been figured out.
 

ScottWang

Joined Aug 23, 2012
7,400
Hi Brevor, The circuit is called common collector or emitter follower:
http://www.opencircuits.com/Basic_Circuit_Building_Blocks#Transistor_Emitter_Follower
It has current gain only, but the voltage on the emitter will follow the voltage on the base as long as the base current times the gain of the transistor is high enough to turn it on. In this case the relay only needs about 25 ma and the gain of the transistor is at least 100.
If the relay were in the collector like Scott mentioned The emitter is at ground so it needs something to limit the base current. The reason I used the emitter follower was because Deledge wanted a lot of hysteresis, so I wanted the output of the 339 to swing all the way from ground to 12 volts. The relay specs say it only needs 9 volts to pick so I didn't worry about the drop from base to emitter.
Could you upload your *.asc file, thanks.
 
Top