electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
 
    Front Page  |  Radio
 |  Media  |  Forum  |  Wiki  |  Links
Forum with support of Syndicator RSS
 FAQFAQ   CalendarCalendar   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   LinksLinks
 RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in  Chat RoomChat Room 
 Forum index » DIY Hardware and Software
Simple Window Comparator
Post new topic   Reply to topic Moderators: jksuperstar, Scott Stites, Uncle Krunkus
Page 1 of 1 [11 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
MC1495



Joined: Mar 24, 2009
Posts: 19
Location: baltimore

PostPosted: Fri Aug 05, 2011 4:17 pm    Post subject: Simple Window Comparator Reply with quote  Mark this post and the followings unread

I've been trying out a window comparator circuit lately and have been having trouble for some reason. I thought I'd include the circuit here and see if people had some thoughts on why it might be problematic or share some other design insights. I don't think there is already a thread specifically dedicated to this circuit?


comparator.jpg
 Description:
 Filesize:  40.87 KB
 Viewed:  16817 Time(s)

comparator.jpg


Back to top
View user's profile Send private message
Tim Servo



Joined: Jul 16, 2006
Posts: 924
Location: Silicon Valley
Audio files: 11

PostPosted: Fri Aug 05, 2011 4:41 pm    Post subject: Simple Window Comparator Reply with quote  Mark this post and the followings unread

Hey MC,

Not a detailed analysis, but off the top of my head, I'd say the feedback resistors on the first two op amps are way too small. To make an op amp act like a comparator, you need to eliminate the feedback R, or make it a very high value (5 to 10M). The feedback resistor gives snappier response (look up 'hysteresis'). Here's one example of an op amp based window comparator without the feedback resistors:
http://ecelab.com/circuit-window-comp.htm

If you really want the quickest response, then a comparator chip works better than an op amp. Here's a page with a pretty good rundown of comparator theory, and even includes a window comparator circuit:
http://home.cogeco.ca/~rpaisley4/Comparators.html

And finally, here's a really trick window comparator circuit that gives you voltage control over the window threshold and width. I suspect that a modern op amp like a TL07X would work just fine in place of the part numbers they call for. I haven't tried this one, but it certainly looks useful:
http://www.intersil.com/data/an/an9802.pdf

Tim (window comparator shopping) Servo
Back to top
View user's profile Send private message
MC1495



Joined: Mar 24, 2009
Posts: 19
Location: baltimore

PostPosted: Fri Aug 05, 2011 8:12 pm    Post subject: Reply with quote  Mark this post and the followings unread

Tim - thank you for the advice, I did fail to take the hysteresis into serious consideration..

However, the 10meg resistors are not solving the problem.. the circuit only seems to be able to detect a very narrow window of voltage and even that is somewhat questionable... it mainly operates when the pots are turned all the way..

The other circuit does seem worth a shot, if there is not other possible explanation for my problems with this design. I know this is a pretty standard circuit, so my immediate suspicion would lead me to believe I made some sort of layout error - but I haven't been able to identify that yet...

I do wonder if there is some sort of issue with polarity here..many of the example circuits I've seen are single supply and this application note suggests using a pot that varies between V+ and ground, rather than V- for the max threshold...
Back to top
View user's profile Send private message
StephenGiles



Joined: Apr 17, 2006
Posts: 507
Location: England

PostPosted: Sat Aug 06, 2011 2:37 am    Post subject: Reply with quote  Mark this post and the followings unread

http://www.freepatentsonline.com/5896458.pdf

Aphex have something to say on this.
Back to top
View user's profile Send private message
Tim Servo



Joined: Jul 16, 2006
Posts: 924
Location: Silicon Valley
Audio files: 11

PostPosted: Sat Aug 06, 2011 2:17 pm    Post subject: Reply with quote  Mark this post and the followings unread

Hi MC,

Let's try this one instead. A couple of things I did: first I separated the reference voltage circuits and added input resistors to isolate the references. Then the output goes through a difference amp. Anyway, I've simulated this circuit and it seems to behave nicely. See what you think.


Window Comp01.jpg
 Description:
One way to do a window comparator... I'm sure there are others.
 Filesize:  46.17 KB
 Viewed:  425 Time(s)
This image has been reduced to fit the page. Click on it to enlarge.

Window Comp01.jpg


Back to top
View user's profile Send private message
frijitz



Joined: May 04, 2007
Posts: 1734
Location: NM USA
Audio files: 54

PostPosted: Sat Aug 06, 2011 4:25 pm    Post subject: Re: Simple Window Comparator Reply with quote  Mark this post and the followings unread

MC1495 wrote:
I've been trying out a window comparator circuit lately and have been having trouble for some reason. I thought I'd include the circuit here and see if people had some thoughts on why it might be problematic or share some other design insights. I don't think there is already a thread specifically dedicated to this circuit?

I don't get what you are doing. You have the output opamp pinned at the negative rail. How can it ever switch? And why do you think you can connect the two opamp outputs together? It doesn't look like a standard circuit to me. Where did you get it?

Very Happy

Ian
Back to top
View user's profile Send private message
MC1495



Joined: Mar 24, 2009
Posts: 19
Location: baltimore

PostPosted: Sun Aug 07, 2011 3:39 am    Post subject: Reply with quote  Mark this post and the followings unread

Well, I came to this by looking at the following:
http://ecelab.com/circuit-window-comp.htm
http://www.aldinc.com/pdf/cd_23009.0.pdf
http://www.aaroncake.net/forum/uploaded/audioguru/2008425111635_window%20comparator%20circuit.PNG

....I have to say that the lack of resistors struck me as problematic, but I still find it difficult to trust my instincts with these things..

The resistor in the last op-amp stage was an attempt at a pull-up resistor, because I don't have an entirely symmetrical power supply....There is actually another resistor to ground there that I mistakenly left out of the sketch...

Looking forward to trying out this new design - I really appreciate all the help. What do you use to draw your circuits digitally, Tim?
Back to top
View user's profile Send private message
Tim Servo



Joined: Jul 16, 2006
Posts: 924
Location: Silicon Valley
Audio files: 11

PostPosted: Sun Aug 07, 2011 1:59 pm    Post subject: Simple Window Comparator Reply with quote  Mark this post and the followings unread

Hey MC,

One quick note: the diodes in my circuit aren't needed. They'll actually cause the inputs on the last op-amp to float when reverse biased and so you can just remove them altogether. Thanks to Ian Fritz for the reminder.

I use an old version of Circuitmaker Student to simulate stuff, and the schemo is a screen shot (although it will also export circuits as WMF graphics). I'd love to find something that was as easy to use that worked under Windows 7, but it works great on my Win XP computer.

Tim (reverse biased) Servo
Back to top
View user's profile Send private message
MC1495



Joined: Mar 24, 2009
Posts: 19
Location: baltimore

PostPosted: Mon Aug 08, 2011 2:23 am    Post subject: Reply with quote  Mark this post and the followings unread

Alright - I feel like I'm making a little progress here, although I might still be missing something... I apologize to protract this discussion on what seems to be a very elementary circuit..

Is the last stage supposed to operate as a differential amplifier circuit? It appears the same as the comparators, in which case I don't understand how the logic is working...

If it is a differential amplifier, this would be the operation:

If the voltage does not exceed the low threshold or the high threshold:
Low: -15v, High +15v.
(-15v minus 15v at differential amp)

If the voltage exceeds the low threshold, but not the high threshold:
Low: +15v, High: +15v.
(15v minus 15v at difference amp)

If the voltage exceeds the low threshold and the high threshold:
Low: +15v, High -15v.
(15v minus -15v at differential amp.)

So, one would get zero volts for the window and +15v or -15v for outside the window...is there a way to change this relationship so that there would be a +15v for the window and a -15v for things outside of the window?
Back to top
View user's profile Send private message
Tim Servo



Joined: Jul 16, 2006
Posts: 924
Location: Silicon Valley
Audio files: 11

PostPosted: Mon Aug 08, 2011 11:30 am    Post subject: Simple Window Comparator Reply with quote  Mark this post and the followings unread

Hi MC,

I think you can change the output polarity by just swapping the inputs to the difference amp (R6 to + input, R11 to - input). Keep in mind I haven't actually built this, but a quick simulation seems to suggest that would do the trick.

Tim (just a simulation) Servo
Back to top
View user's profile Send private message
MC1495



Joined: Mar 24, 2009
Posts: 19
Location: baltimore

PostPosted: Thu Aug 11, 2011 8:45 am    Post subject: Reply with quote  Mark this post and the followings unread

Well, this does seem to be behaving rather nicely now...thanks for your help!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic Moderators: jksuperstar, Scott Stites, Uncle Krunkus
Page 1 of 1 [11 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
 Forum index » DIY Hardware and Software
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Forum with support of Syndicator RSS
Powered by phpBB © 2001, 2005 phpBB Group
Copyright © 2003 through 2009 by electro-music.com - Conditions Of Use