# Window Comparator Exercise

Discussion in 'Homework Help' started by 307pavlos, Aug 19, 2011.

1. ### 307pavlosMember

Joined:
May 11, 2011
Messages:
39
Likes:
0
Location:
Greece
Ok guys, this is an exercise i was given. This is a window comparator and all i had to do is to write down the equation of the sin. signal and then design the circuit in the paper with the right values of the resistances. Can you help me to solve it? In fact i just want the sin. equation and 4 resistance values.

File size:
111.1 KB
Views:
475
2. ### ericgibbsWell-Known MemberMost Helpful Member

Joined:
Jan 4, 2007
Messages:
21,187
Likes:
644
Location:
Ex Yorks' Hants UK
ONLINE
hi,
I will give you a hint.

Both the voltage threshold settings for the window are below 0V, ie; minus voltages.

Assume that the resistor dividers are connected between -10V and 0V.

The question gives the two resistive divider output voltages as -860mV and -3.33V

You now should be able to work out the required resistor divide values. Hint: choose a value for one of the resistors and now work out the others..

Last edited: Aug 19, 2011
3. ### 307pavlosMember

Joined:
May 11, 2011
Messages:
39
Likes:
0
Location:
Greece
yeah i can see that both threshold points Upper (-860mV) and Lower (-3.33V) are shown on the diagram. I tried to find the resistance values by doing that : Vutp=Vcc * [(R1+R2)/(R1+R2+R3)] and Vltp=Vcc * [R1/(R1+R2+R3)] and finally a third equation Vwin=Vutp-Vltp=Vcc * [R2/(R1+R2+R3)]

As for the sin. equation this should be like this : f(t)=A+Bsinωt where A,B and ω (rad/s) must be calculated. I dont know how to calculate A and B.

File size:
12.1 KB
Views:
236

Joined:
Jan 12, 1997
Messages:
-
Likes:
0

5. ### ericgibbsWell-Known MemberMost Helpful Member

Joined:
Jan 4, 2007
Messages:
21,187
Likes:
644
Location:
Ex Yorks' Hants UK
ONLINE

hi,
Using the general equation y(t) = A. sin( ωt+Φ)

For 'A' count the number of divisions on the Y axis of your plotted wave, from the maximum to minimum value, 'A' is half that value.

For the Period count the number of X divisions from the lowest point on the plotted wave to the next lowest, this will give you the period in mSecs... Freq= 1/Period

Also you will see there is an offset from zero on the Y axis also the plot doesn't start at zero degrees.

EDIT:
Your diagram showing the divider is incorrect.
The threshold voltages have to be 'negative' , not positive

Last edited: Aug 19, 2011
6. ### 307pavlosMember

Joined:
May 11, 2011
Messages:
39
Likes:
0
Location:
Greece
hmm so the equation must be y(t)=-3+5*sin628t .

What about the resistances??? I tried to solve with the above 3 equations but no luck. Maybe i'm making a mistake during the calculations??

7. ### ericgibbsWell-Known MemberMost Helpful Member

Joined:
Jan 4, 2007
Messages:
21,187
Likes:
644
Location:
Ex Yorks' Hants UK
ONLINE
hi,
In your equation the Constant -3V is OK, also 'A' but how can it be sin628t. ???

ω is in radians and also Φ

Also your divider diagram is incorrect, the thresholds must be negative not positive

Last edited: Aug 19, 2011
8. ### 307pavlosMember

Joined:
May 11, 2011
Messages:
39
Likes:
0
Location:
Greece
Why is it incorrect? How should I draw the diagram? What do you mean thresholds must be negative? You mean that Vcc in diagram should be -Vcc ?

ω=rad/sec because ω=2*π*f where π=3.14 and f is freq. in Hz.

Φ is in degrees. The waveform diagram starts from 16msec so Φ=0 isnt it?

9. ### KeepItSimpleStupidWell-Known MemberMost Helpful Member

Joined:
Oct 30, 2010
Messages:
9,916
Likes:
1,097
The start of the sin() function is where the sin(0) = 0

10. ### ericgibbsWell-Known MemberMost Helpful Member

Joined:
Jan 4, 2007
Messages:
21,187
Likes:
644
Location:
Ex Yorks' Hants UK
ONLINE
Your original drawing shows the switch over threshold voltages as negative, also your sine wave is 3V below 0V, ie -3V.

So if your divider is set for positive threshold voltages, when will the sine wave cross thru those points.????

The sine wave is not 0deg at time zero, so the phi offset , in rads applies,

EDIT: what do you calculate the frequency to be.??

Last edited: Aug 19, 2011
11. ### MrAlWell-Known MemberMost Helpful Member

Joined:
Sep 7, 2008
Messages:
11,029
Likes:
951
Location:
NJ
Hi,

You already got y=5*sin(w*t+TH)-3 so you know A and B already. To get w, you find the time between the two lower valleys and assuming that the graph is accurate the time between those two points is 10ms, so your frequency f=1/0.010=100Hz. Knowing w=2*pi*f you should get w.
Now solving for TH we take the equation for y above and set it equal to zero:
5*sin(w*t+TH)-3=0

and we know what w is and that the sin goes through 0 degrees at y=-3 and then goes more positive on the graph and that happens at t=0.020 seconds, so we know t is 20ms. Setting t=20ms and evaluating that equation, we find several solutions and one of them is TH=0. Graphing that equation with TH=0 we find that the sine goes through y=-3 at 20ms the same as the graph, so we know that ONE solution for TH is zero and that is the simplest so we keep that TH=0. Thus we have the complete equation for the sinusoidal part.

To get the resistor values, we start with the equations similar to yours but we also include the negative supply rail Vss:
D=R1+R2+R3
Vutp=(Vcc-Vss)*(R2+R1)/D+Vss
Vltp=(Vcc-Vss)*(R1)/D+Vss

and remember that Vss is negative.

To get the resistance values, we first select a rough impedance for the whole resistance string, say 100k. This means R1+R2+R3=100k.
Next we solve for R1 from:
Vltp=(Vcc-Vss)*(R1)/D+Vss

and we get:
R1=((Vss-Vltp)*D)/(Vss-Vcc)

Now that we know R1 we can solve for R2 from the other equation:
Vutp=(Vcc-Vss)*(R2+R1)/D+Vss

and we get:
R2=((Vss-Vcc)*R1+(Vutp-Vss)*D)/(Vcc-Vss)

Now that we know R2 and R1 we get R3 from knowing D too:
R3=D-R2-R1

Note that R3 is the resistor that connects to the most positive supply rail Vcc, and R1 is the resistor that connects to the most negative supply rail Vss. You can also do this by taking Vcc=0 (ground) and connect R3 to ground and solving the above with Vcc=0. That means you dont have to use the positive supply rail. Both set points are negative so we can get away with this for this problem.

Also remember that Vss is negative so it enters the equations as a negative number like -5. So for example if Vcc=5v and Vss=-5v then Vcc-Vss=5-(-5)=10, and this is important.

Last edited: Aug 19, 2011
12. ### ericgibbsWell-Known MemberMost Helpful Member

Joined:
Jan 4, 2007
Messages:
21,187
Likes:
644
Location:
Ex Yorks' Hants UK
ONLINE
hi Al,
I guess you know this is an Homework question.??

Thats why I have not given the answers, only hints.

13. ### MrAlWell-Known MemberMost Helpful Member

Joined:
Sep 7, 2008
Messages:
11,029
Likes:
951
Location:
NJ
Hi Eric,

Oh, do you think i gave too much information? He seemed to be having such a hard time solving for the resistor values and even for w so i thought i would help him along. Note i never said what w really was numerically, and i didnt actually solve for any resistor values

I could reduce the information more?

Last edited: Aug 19, 2011
14. ### ericgibbsWell-Known MemberMost Helpful Member

Joined:
Jan 4, 2007
Messages:
21,187
Likes:
644
Location:
Ex Yorks' Hants UK
ONLINE
hi Al,
I dont wish to offend the OP, but he didn't seem to get my point about the divider network, the Vthresholds having to be powered from a negative supply.

Eric

15. ### 307pavlosMember

Joined:
May 11, 2011
Messages:
39
Likes:
0
Location:
Greece
hey. really thanks for all this support

mral i calculated w as you said thats why i used it in the sin. equation 5sin628t. And as i can see you too say there's no Φ (Φ=0).

As soon as i get home, i'll try to solve the whole thing.

eric, i noticed what you said. You mean that these +Vcc values must be negatives, ie -10volts, right?

Last edited: Aug 19, 2011
16. ### ericgibbsWell-Known MemberMost Helpful Member

Joined:
Jan 4, 2007
Messages:
21,187
Likes:
644
Location:
Ex Yorks' Hants UK
ONLINE
hi,
Thats correct , a -10V connection via the resistors to 0V.

17. ### MrAlWell-Known MemberMost Helpful Member

Joined:
Sep 7, 2008
Messages:
11,029
Likes:
951
Location:
NJ

Hi again,

As Eric said, you need to use at least one negative supply rail to power the divider and that is because (obviously) that the two set point voltages are both negative

With the equations i gave i left it as an option to use also a positive supply rail or you can make that (Vcc) equal to zero and just use Vss, but either way the equations will work to give you the resistor values. I also hope you understand how these equations came about, and if you dont please let us know and i'll provide more information about that.

18. ### 307pavlosMember

Joined:
May 11, 2011
Messages:
39
Likes:
0
Location:
Greece
Why is this +Vss. How did you input it in the equation?
Same here!
Why's that? How can you say D=100k ?
I rewrote your Vltp equation and i end up here : R1=(Vltp-Vss)*D/(-Vss) , Where Vss=-10 and Vcc=0. Are you sure you didnt make a mistake with the Vss sign of the denominator?

I get R2=[Vss*R1+(Vss-Vutp)*D]/Vss , Where Vcc=0, Vss=-10V

I see! So did I upload the proper diagram? Both Comparators will get -10Volts where GND was and 0Volts where Vcc (+10Volts) was!

File size:
12.9 KB
Views:
157
19. ### ericgibbsWell-Known MemberMost Helpful Member

Joined:
Jan 4, 2007
Messages:
21,187
Likes:
644
Location:
Ex Yorks' Hants UK
ONLINE
hi,

File size:
12.2 KB
Views:
154
20. ### 307pavlosMember

Joined:
May 11, 2011
Messages:
39
Likes:
0
Location:
Greece
Hi,
thanks. +5volts apply on the output (that's because the max output voltage is +5V?) and the 2 comparators right? How do you calculate the R4 and why is it for?

Joined:
Oct 30, 2010
Messages:
9,916
Likes:
1,097