Maker Pro
Maker Pro

Comparator for anemometer

HgInNY

Jul 2, 2013
6
Joined
Jul 2, 2013
Messages
6
Hello,

This is my first time building a circuit and I'm having trouble getting it to perform the way I had hoped. I have an anemometer to measure wind speed that puts out an AC sine wave from 0 up to 8V athough I don't really anticipate getting 8V unless there is a hurricane. What I want to do is turn the wave into pulses varying from <0.8V for off to between 2 and 2.2V for on. Once I have my pulses digital pulses my software will convert that to windspeed. I have an op amp to use as a comparator. My basic set up is shown in the picture attached. when I hook it up all I'm getting is my sine wave moved to around 2V but the magnitude isn't increased and therefore I'm just getting an on digital signal. If you could tell me what I'm doing wrong and suggest how to make this work I would be super stoked.

attachment.php
 

Attachments

  • cct.gif
    cct.gif
    5.2 KB · Views: 1,047
Last edited by a moderator:

duke37

Jan 9, 2011
5,364
Joined
Jan 9, 2011
Messages
5,364
The TL081 needs a minimum of 5V supply. See TI data sheet.

It is best to have the positive at the top of the diagram and the common connection below.

Have you got the power connected properly, you do not give details of the TL081 pins.
R3 does nothing other than reduce the output voltage because of the low supply voltage.
 

HgInNY

Jul 2, 2013
6
Joined
Jul 2, 2013
Messages
6
Hi,
Sorry the actual op amp I'm using is NE5532AN in an 8 pin configuration. See the data sheet at http://pdf1.alldatasheet.com/datasheet-pdf/view/17978/PHILIPS/NE5532AN.html Output is conected to pin 1 with the branching resistor going to ground. Pin 2 is attached straight to my 15mV supply, inverting input. Pin 3 is attached to my anemometer with the resistors set up in the way shown in my circuit diagram. Pin 4 is attached to ground. Pin 8 goes to the voltage source. This should theoretically work right? Thanks for the help!
 

duke37

Jan 9, 2011
5,364
Joined
Jan 9, 2011
Messages
5,364
The 5532 needs a minimum of +/- 3V supply i.e. 6V with the inputs somewhere near the middle. It has a long tailed pair input which will need to be a volt or two above the negative supply.

Pin 8 is the positive supply and is normally shown at the top of the diagram. You show a negative supply going to the amp.

Comparators often need a pull up resistor but this is a standard op-amp and R3 is redundant.

You may be better off to AC couple the input.
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
Are you aware you have positive feedback around the op-amp? A simple gain stage uses negative feedback, i.e. the feedback resistor, R2, and the input source, are connected to the inverting input ("-" symbol) and the non-inverting input ("+" symbol) is biased at some DC voltage in between the supply rails.

You need to show the connections to the other side of your voltage sources.

You revealed in post #3 that the IC is not a TL081 as shown, but an NE5532. Are there any other differences between your schematic and reality?

As duke37 pointed out, your supply voltage is too low for the op-amp to work properly. Also you should show all pin numbers on the op-amp so we can confirm that the power supply connections are correct.

You mentioned that you're taking the output from pin 1 of the NE5532. Pin 1 is not an output; the output is on pin 6.

As duke37 suggested, you may need to AC-couple the input.

My recommendations would be:

1. Use a higher voltage supply - at least 6V.
2. Bias pin 3 (the "+" input) half way between the supply rails, using a two-resistor voltage divider, or a supply splitter such as a TLE2425 or TLE2426.
3. Apply the input signal and the feedback to the inverting input, pin 2 (the "-" input), not the non-inverting input.
4. AC-couple the input source, or connect its return to the supply splitter output voltage.
5. Add a small amount of hysteresis (positive feedback) to prevent the circuit from amplifying noise: a small resistance between the supply splitter and the non-inverting input, and a large resistance from the op-amp output to the non-inverting input, to provide a small amount of positive feedback.
6. Use a two-resistor voltage divider between the output and 0V to reduce the output voltage swing to the voltage swing required by the following circuitry. You may want to measure the output swing at pin 6 of the op-amp; it will not swing all the way to the positive supply rail. Then calculate the voltage divider resistors based on that swing.
7. Check the output impedance of your anemometer. Your amplifier has a fairly low input resistance, 270 ohms (set by R1) and this may load down the anemometer unless it has a low output impedance.
 
Last edited:

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
attachment.php


Here's my suggestion.

The power supply for the op-amp is 6V. This can be increased for better performance.

The op-amp inputs are biased at around half the supply voltage by R1 and R2. This is necessary to keep the op-amp in its operating region. Usually a decoupling capacitor is connected in parallel with R2 but it's not needed in this application. If you want, add a 1 uF capacitor (value is not critical) across R2.

There is positive feedback via Rf. This produces hysteresis which prevents the op-amp from amplifying noise and producing garbage at its output. To overcome the hysteresis deadband, the input signal amplitude must be high enough to pull the non-inverting input past the inverting input voltage. This is a tug-of-war between the input signal, acting through Rin, and the output voltage, acting through Rf. With a 6V power supply, the output swing will be about 4V peak to peak, and the ratio between Rf and Rin is 1000. Therefore the input swing from the anemometer needs to be at least 4 mV peak to peak; anything less will not be amplified.

This assumes that the anemometer has a low output impedance; if it doesn't, some circuit changes will be required. Also, the input characteristic is not symmetrical, because resistors R3 and R4 will pull the output downwards, so its swing will be something like +4V/0V (assuming a 6V supply) and this is not symmetrical around the half-supply bias voltage. You can adjust the half-supply bias voltage to avoid this asymmetry.

Increasing Rf will make the circuit more sensitive to noise and low-amplitude signals. The NE5534 has a relatively low input impedance so I would not increase Rf too much beyond 1 megohm.

R3 and R4 reduce the output voltage swing to suit the input that you're driving. The output will not swing fully to the positive supply rail; typically there's a drop of around 2V (this depends on the op-amp's architecture). So measure the output high voltage and calculate the R3 and R4 values to give you the output voltage you want.
 

Attachments

  • anemometer preamp.gif
    anemometer preamp.gif
    3.8 KB · Views: 593
Last edited:

HgInNY

Jul 2, 2013
6
Joined
Jul 2, 2013
Messages
6
Comparator

Hello,

Thank you for the replies! Sorry I've been busy with other things so I haven't had a chance to work on this in a few days. I built a circuit similar to yours KrisBlueNZ. Attached is my circuit. I haven't turned the input voltage up because I haven't wired up an output resistor set. How much difference does under-volting an op amp make? My power supply max right now is 5V and I'm making this out of spare parts.

I'm certainly getting an amplification now but my new problem is that my off out which is supposed to get below 0.8V is just winding up at ~1.4V and the signal then swings back to an on of 2.1V. Because of this my digital logic still can't make out my signal and convert it to hertz. Any ideas on how to drop the low end? I tried a zener diode of 1.8V hooked to ground but it just grounded my entire output. Other ideas?

The only thing that differs between my setup and reality is the input frequency will be about 4Hz at 80mV. Based on previous posts it looks like my current set up will start to amplify input at ~79mV which is at the detection limit for the anemometer, ~0.4 m/s. Is this correct?

Thanks again for your help!
 

Attachments

  • Comparator Circuit.jpg
    Comparator Circuit.jpg
    37.4 KB · Views: 253

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
Well, duke37 said that the NE5534 is specified with a minimum operating voltage of 6V. What's the effect of running it at 5V? I don't know. It could work perfectly, just slower, or it could fail to work at all. NE5534s from some manufacturers, or some batches, could work, and others could fail. You're taking an unknown risk if you do that. Unless you have the knowledge to analyse the internal schematic and figure out exactly how it will respond.

Your output will go below 1.4V, and probably below 0.8V, if you put a pulldown resistor on it. Something like 1k from the output to the 0V rail. This will also reduce the output-high voltage somewhat. My design combines the pull-down resistor with the voltage divider which ensures that the high-state output voltage from the circuit is less than 3V.

The output-high and output-low voltages are specified as differences, or "dropout voltages", measured relative to the supply rails. So your figures of 2.1V high and 1.4V low actually correspond to "dropout voltage from positive supply is 2.9V" and "dropout voltage from negative supply is 1.4V" respectively. One effect of inadequate op-amp supply voltage could be an increase in either or both of the dropout voltages compared to the published specification. If you increase the supply voltage to 6V the output-high voltage will probably change to 3.1V or more, while the output-low voltage will remain around 1.4V. With a pulldown resistor, you might get, say, 2.8V high and 0.5V low. That would be a clearer indication to your digital circuitry.

If you stick with a 5V supply, you may find that with a pulldown resistor, the output swing will be something like 0.5V low, 1.8V high. If that's enough for your digital circuitry, that would work, for that particular op-amp, but make sure there's a safety margin, since different batches and brands of NE5534 will have different voltages.

But this is not the proper approach. I strongly recommend that you use an op-amp that's specified to operate at 5V. There are many of these; Microchip (http://www.microchip.com) and Linear Technology (http://www.linear.com) have lots of options. Many of these devices support rail-to-rail outputs, which aren't really necessary but would make your calculations a bit simpler.

The op-amp you use should be (a) specified for operation at a total supply voltage of 5V, and (b) specified with output voltage dropout figures (with resistive load connected from output to negative supply) that will guarantee proper logic-level swings, either at the output pin, or after an output voltage divider (as shown on my schematic).

I would use an input switching threshold significantly lower than the specified lowest output level of the anemometer. If the specification says 80 mV peak-to-peak, I would make sure the amplifier will respond to signals as low as 50 mV peak-to-peak.

You are using very low resistances in your input and feedback circuits. The 200 ohm input resistor is only appropriate if the anemometer has a very low output impedance. Do you have a figure for its output impedance? Or can you link to the data sheet for the anemometer?

You should adjust the bias voltage divider so its voltage is half way between the output high voltage and the output low voltage, so the circuit's switching thresholds (as seen by the anemometer) are symmetrical around 0V.
 

HgInNY

Jul 2, 2013
6
Joined
Jul 2, 2013
Messages
6
Thanks for your help. I just purchased a Texas Instruments OPA2244 for my op amp. It has a minimum single sided volatage of 2.2V so it should work for what I'm doing.

I looked at the spec sheet for my anemometer and is has a 2K output impedance. What would you suggest as an input and feedback resistor for this application?

You mentioned switching the bias voltage divider on the anemometer. I have no idea what this is or how I would do it. But here is a link to the spec sheet for the anemometer maybe you can figure it out?
http://www.youngusa.com/Manuals/05305-90(T).pdf
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
OK, the OPA2244 looks good.

I assume you're still using a 5V supply?

I've updated my design for the higher output impedance of the anemometer, and adjusted the bias resistors to suit the OPA2244. I've also added Cin which may help reduce false triggering due to noise coupled into the cable from the anemometer to the preamp.

The output voltage will be about 2V p-p. Change the ratio of R3 to R4 if you want something different. The op-amp output will swing to around 4.25V when high; I'm not sure what it will swing to when low - probably less than 0.5V.

attachment.php
 

Attachments

  • anemometer.gif
    anemometer.gif
    6.8 KB · Views: 536

HgInNY

Jul 2, 2013
6
Joined
Jul 2, 2013
Messages
6
Okay awesome I'll breadboard it after lunch. Just a quick question, why did you switch the Rin to phase inverting input?
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
To increase the input impedance of the circuit.

The hysteresis is determined by the ratio between the feedback resistor (from output to non-inverting input) to the resistance between the non-inverting input and the reference point (the voltage divider). With the original arrangement, the anemometer itself is part of the resistance from the non-inverting input to the reference point, so its resistance affects the hysteresis. With this new design, the hysteresis is set by the ratio of two resistors, and the resistance of the anemometer is not significant.
 

HgInNY

Jul 2, 2013
6
Joined
Jul 2, 2013
Messages
6
It works great! It is all soldered up on a PCB now and taking in wind data. From everything I can tell it is functioning perfectly. Thanks for your help.

A couple last questions though:
I didn't put the capacitor in because they didn't have one small enough at the radio shack in town. How much will this effect the system?

Is it a could idea to put a zener diode blow off circuit on the input to prevent high winds from frying the op amp?

Thanks again.
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
It works great! It is all soldered up on a PCB now and taking in wind data. From everything I can tell it is functioning perfectly. Thanks for your help.
No problem :)

A couple last questions though: I didn't put the capacitor in because they didn't have one small enough at the radio shack in town. How much will this effect the system?
The capacitor is there to reject short pulses that might appear at the input due to interference. Without it, you may see bogus pulses when heavy equipment turns on and off, when lightning strikes nearby, etc.
Is it a could idea to put a zener diode blow off circuit on the input to prevent high winds from frying the op amp?
Yes, that's a very good idea and I should have suggested it.
Here's an updated diagram with better protection for the op-amp.

attachment.php
 

Attachments

  • anemometer v2.gif
    anemometer v2.gif
    8.1 KB · Views: 772
Top