Op Amp in Comparator mode doesn't work

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Hi guys, I don't know what's wrong, but I've got a project in which I use an Opamp v1.10 to make an active filter with external components, and it works like a charm when I check it with an oscilloscope (I use three analog pins to route the V+, V- and Vout signals outside and inside the psoc).

   

But if I try the same component with the same analog pins to make an operational amplifier in comparator mode, the oscilloscope graph never change. Instead of showing a digital like signal (high voltage signal when V+ > V-, and low voltage signal when V+ < V-) it only shows a noisy and unchanged level signal, whatever values I plug in to the V+ and V- pins, there's no variation in the noise.

   

I've also tried the Low Power Comparator v2.10, but again I can't obtain anything else that a noisy signal that doesn't change it's level whatever voltages I plug in the V+ and V- pins.

   

Thus, I ask here because I want to know if PSoC have some kind of problem, or special configuration  needed in order to use the low power comparator or the internal op amp in comparator mode.

   

 

   

PD: I haven't uploaded the project because analog pins and op amp was working flawlessly in active filter mode with external components, so I think my code is fine with the opamp_Start() function, and in order to use the op amp in comparator mode it doesn't require anymore than remove the external components used before, and just plug in two different DC voltage signals in V+ and V- that I can vary, and check the Vout with the oscilloscope.

0 Likes
1 Solution
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

You have a cascaded G ~= 250  x 200 = 50,000.

   

 

   

The offset is 1 mV, so due to offset alone you would saturate the output of the 2'ond

   

opamp. Possibly AC couple stage 1 to 2.

   

 

   

One possibility is convert first stage into a TIA configuration. Might be able to take

   

more effective G there thereby lower stage 2 G, and overall noise.....

   

 

   

https://en.wikipedia.org/wiki/Transimpedance_amplifier

   

https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=7&ved=0CEwQFjAGahUKEwiit6LLsoTIAhXJVz4...

   

 

   

One approach to minimizing offset and noise

   

 

   

http://www.cypress.com/documentation/application-notes/an66444-psoc-3-and-psoc-5lp-correlated-double...

   

 

   

Regards, Dana.

View solution in original post

0 Likes
7 Replies
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

First question, why are you trying to use a comparator as a replacement or G element

   

in an active filter configuration ?

   

 

   

The reason why this is not a good idea is a comparator has no phase margin compensation ,

   

the internal comp cap normally seen in second stage of OpAmp is removed. So an active

   

filter config will typically turn into an oscillator because of this. Even worse, under the

   

right conditions, is you could get a phase reversal of output if an input is driven outside

   

its CM range, actual latchup can occur. Depends on the way the OpAmp/Comparator

   

was designed.

   

 

   

Regards, Dana.

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

I'm not trying to use a comparator to replace an  element in an active filter. Indeed, I was trying to do a similar project to this http://www.edn.com/design/medical/4421721/Product-how-to--Heart-rate-monitor-using-a-programmable-So...

   

In the attached picture, you can see that the comparator is used to "translate" the analog signal pulses into "digital" (low level and high level) signal pulses, so I can use the rising edge of the pulses to count it into the psoc.

   

I tried to use the comparator, and the output were just an unchanged level noise, whenever input voltage I put in the inputs. So just to check if I was doing anything wrong, I tried to use the op amp that was really configured and well working as a comparator (I disconnected all the active filter components, and just used the op amp with the 2 input voltages and 1 output pin plug in to the oscilloscope).

   

So my question is still alive, there's some known problem with the psoc 4 ble internal low power comparator or the op amps in order to use it as comparators? (I was measuring the voltage applied to the inputs, so there's no wireling or linking error)

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

You have a cascaded G ~= 250  x 200 = 50,000.

   

 

   

The offset is 1 mV, so due to offset alone you would saturate the output of the 2'ond

   

opamp. Possibly AC couple stage 1 to 2.

   

 

   

One possibility is convert first stage into a TIA configuration. Might be able to take

   

more effective G there thereby lower stage 2 G, and overall noise.....

   

 

   

https://en.wikipedia.org/wiki/Transimpedance_amplifier

   

https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=7&ved=0CEwQFjAGahUKEwiit6LLsoTIAhXJVz4...

   

 

   

One approach to minimizing offset and noise

   

 

   

http://www.cypress.com/documentation/application-notes/an66444-psoc-3-and-psoc-5lp-correlated-double...

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

Thanks Dana. The above project was just a reference. I changed resistance and capacitor values.

   

The point is, that even with a new blank project, with only one op amp connected to three analog pins (V+, V- and Vout) in order to route in and out from the psoc, I'm unable to get it work as a comparator. (A comparator just need 2 input voltages and it generates 1 output). So please, don't focus my problem in if I'm using a wrong resistance or capacitance value, because I don't used it when I tested the most simple comparator case (3 analog pins and 1 op amp).

   

Just to be sure that I'm not making something wrong, could you please upload a simple project for the PSoC 4 BLE, placing just 1 op amp and 3 analog pins (I will power the 2 inputs and graph the output in an oscilloscope) that you tested yourself and you're sure it work? I don't know a simple comparator project more than this, but it doesn't work when I test it.

   

Thank you again.

0 Likes
lock attach
Attachments are accessible only for community members.
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Did you try the example project in Creator, see attached -

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

Yeah, I tried the example project, the low power comparator, the comparator, and a standalone op amp, and I couldn't get it work.

   

So forget it, there must be something wrong in somewhere. I will use an external op amp (LM2904)  that I tested as a comparator and worked fine in the oscilloscope output.

   

Thanks Dana.

0 Likes
lock attach
Attachments are accessible only for community members.
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

I set one up on a BLE board, see attached, started it in main, and

   

just used 60 Hz pickup on my finger and comparator generated a 60

   

Hz pulse train, ~ 66% DC due to ref not at 2.5 V, rather at 3.3V.

   

 

   

Regards, Dana.

0 Likes