Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Low Pass Filter

Status
Not open for further replies.

Suraj143

Active Member
Can somebody tell me what this filter do?

Thanks
 

Attachments

  • Low Pass Filter.PNG
    Low Pass Filter.PNG
    3 KB · Views: 1,542
It is a poor quality lowpass filter. It reduces high frequencies (noise).
 
A single resistor and a single capacitor makes a simple poor quality lowpass filter.
A inductor and capacitor makes a better one.
An inductor, a capacitor and a second inductor makes a much better one.
You can keep adding inductors and capacitors to make it better.

The inductor might be big, heavy, expensive and might pickup hum.
But an opamp can replace the inductor.
 
Ok now I understood a bit.Due to unavailability of having inductors I like to build an opamp based filter.

I need to read the AD value of the LM35 nicely without any noise.If you have any idea of making opamp based low pass filter help me.
 
Last edited:
You can use a simple RC filter since the response time doesn't need to be that quick. Simply choose a very low cutoff frequency, such as 1Hz or less, and any 60Hz noise will be cut substantially.
 
Last edited:
If you changed the capacitor to 100uF you would have a corner frequency of 0.7Hz.
 
I found this LM35 interface circuit in erics blog.

My question is why eric uses a opamp circuit, why not directly connecting LM35 to PIC.

If I use this circuit what gain do I need to adjust?
 

Attachments

  • LM35_LM358a.gif
    LM35_LM358a.gif
    11.8 KB · Views: 5,984
I found this LM35 interface circuit in erics blog.

My question is why eric uses a opamp circuit, why not directly connecting LM35 to PIC.

If I use this circuit what gain do I need to adjust?

That circuit is an adjustable amplifier, not an active filter. LM35 output is probably not going to go high enough to drive PIC input. You should amplify so that highest expected temperature reading is close to 5V and lowest is close to 0V - given that you are powering your PIC with +5V and ground. This will allow you to convert the voltage into temperature with a higher sensitivity.

You can use the design below for a 50 Hz Butterworth (2nd Order, Unity Gain) Low Pass Filter with values (you may want to change frequency response to achieve more attenuation):
R1= 22 kΩ
R2= 22 kΩ
C1= 200 nF
C2= 100 nF
 

Attachments

  • lowpass.JPG
    lowpass.JPG
    7.7 KB · Views: 779
Last edited:
I found this LM35 interface circuit in erics blog.

My question is why eric uses a opamp circuit, why not directly connecting LM35 to PIC.

If I use this circuit what gain do I need to adjust?

Suraj,
The LM35 in this application is used from +2Cdeg thru 100Cdeg
As the LM35 is 10mV/Cdeg, if you multiply the 10mV *100Cdeg *5 = 5Volts which is the Vmax the PIC adc accepts when using the internal +5Vref.

Without the OPA at 30Cdeg for example, the LM35 would only output 35 * 10mV = 0.35V.

Do you follow OK.?

What level of jitter do you have on the display and what resolution is shown on the display.. eg: 00.00Cdeg.. etc
 
Hi guys thanks for the replies now you have come upto the point.

My main problem is this.

I built a temperature display. It displays the temperature on three seven segments with a 0.5C accuracy (ex-26.5C will show on SSDs).I connect LM35 directly to PIC pin. References are Vdd & Vss.

When it’s changing its value between two points the display is getting jitter. Means it will show 26.5 & when reaches 27.0 it will shift between these two values 26.5, 27.0,26.5, 27.0……so the display is not stable always shift between two values.

This is the one I want to stop. I over sampled & averaged but still the problem is there.

I need a solution for this.
 
How many samples did you average?

What you could do is a running average which simulates a low-pass filter. For example you continually subtract the new temperature reading from the previous running average and add a fraction of that difference (with sign), say 1/4, to the running average (in a processor it's easy to divide a binary number by shifting the number to the right, 2 bits for divide by 4, for example). That way the running average can only change by a small amount each reading, minimizing the fluctuations

To vary the effective time constant of the filter you alter the amount you change the difference (divisor) before adding.
 
Is everything decoupled properly? You could be picking up enough noise from a power line or a signal line or from inside the chip itself to cause the jitter when the ADC is right at it's boundary for two values, very common. If you average enough samples it will go away, that noise can also be used to actually increase the resolution of your ADC readings. I've posted a link bellow to an AVR appnote that stands true for any ADC on any micro controller or system. If your sampling rate is flexible and you have enough memory you can increase precision quiet a bit.

https://www.electro-tech-online.com/custompdfs/2009/04/doc8003.pdf
 
Last edited:
Hi Carl I'm taking 16 samples.

I'm not subtracting, I continually sample & load the results into 16bit register.After taking 16 samples I divide it by 16 (right shifting 4 times).I have integer byte & a 4 bit fraction byte.

Again I have to divide my integer byte by 2 to display the actual temperature.This is the place I don't know how to add hysteresis.

Help me.
 
Last edited:
Hi Sceadwin I have only a 0.1uF decoupling capacitor on the power rails & LM35 directly to the AD input nothing else :)
 
How is your PIC setup? Can you post a schematic for it? To get full usable resolution out of your PIC's ADC isn't always easy. Also have you tested this on an o'scope (a sound card would work) to see if the noise is from the opamp or the sensor itself or from the PIC? If the actual voltage from your temperature sensor is clean completly read the ENTIRE ADC section of the PDF for your specific PIC and follow all it's precautions and suggestions for getting clean ADC readings. The single biggest thing you can do to increase stability of the ADC is to slow the conversion time down generally speaking the faster tha ADC clock the higher the noise. Depending on your PIC you may be able to bypass the analolg VREF all by itself, and there are grounding considerations as well.
 
Last edited:
Suraj,
Is the PIC's adc set to 8bit or 10bit.??
 
Hi ericgibbs I use 10bit right justify.

The maximum LM35 goes to 1V.That means maximum AD steps that can go 204.6.So I use only ADRESL all the time in 10bit result :)

hi,

So you have 204 counts to represent 100Cdeg, what resolution are you expecting.?:)
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top