+ Post New Thread
Results 1 to 19 of 19
  1. #1
    Banned
    Points: 929, Level: 6

    Join Date
    Jan 2015
    Posts
    186
    Helped
    3 / 3
    Points
    929
    Level
    6

    I want to design digital filter in PIC18f

    I am getting 100mv noise at my ADC input channel, how can I remove it using DSP filter in micro-controller.

    I am using PIC18f.

  2. #2
    Super Moderator
    Points: 28,512, Level: 41
    andre_teprom's Avatar
    Join Date
    Nov 2006
    Location
    Brazil
    Posts
    8,475
    Helped
    1078 / 1078
    Points
    28,512
    Level
    41
    Blog Entries
    6

    Re: I want to design digital filter in PIC18f

    You need to determine characteristics of the noise in the frequency domain. The process of digital filtering consists to reduce components of the signal lying within a specific bandwidth.
    --------------------------------------------------------------------------------------------------
    Part of the world that you live in, You are the part that you're giving ( Renaissance )



    •   AltAdvertisment

        
       

  3. #3
    Banned
    Points: 929, Level: 6

    Join Date
    Jan 2015
    Posts
    186
    Helped
    3 / 3
    Points
    929
    Level
    6

    Re: I want to design digital filter in PIC18f

    How can I do that?



  4. #4
    Super Moderator
    Points: 28,512, Level: 41
    andre_teprom's Avatar
    Join Date
    Nov 2006
    Location
    Brazil
    Posts
    8,475
    Helped
    1078 / 1078
    Points
    28,512
    Level
    41
    Blog Entries
    6

    Re: I want to design digital filter in PIC18f

    If the noise behave like a "white noise" ( not showing any dominant oscillation ), you certainly cannot do this digitally by algorithm, but have to check in your design if there is some aspect on layout prone to suffer interferences by induction or heating.
    --------------------------------------------------------------------------------------------------
    Part of the world that you live in, You are the part that you're giving ( Renaissance )



  5. #5
    Banned
    Points: 929, Level: 6

    Join Date
    Jan 2015
    Posts
    186
    Helped
    3 / 3
    Points
    929
    Level
    6

    Re: I want to design digital filter in PIC18f

    I need low pass filter with range 0 to 50Hz , 0 to 500 Hz and 0 to 1KHz



  6. #6
    Administrator
    Points: 69,512, Level: 64
    Achievements:
    Created Album pictures Created Blog entry 7 years registered
    bigdogguru's Avatar
    Join Date
    Mar 2010
    Location
    Southwest, USA
    Posts
    9,832
    Helped
    2355 / 2355
    Points
    69,512
    Level
    64
    Blog Entries
    4

    Re: I want to design digital filter in PIC18f

    Quote Originally Posted by Arrowspace View Post
    I am getting 100mv noise at my ADC input channel, how can I remove it
    What you have failed to mentioned and Andre was attempting to determine is, the frequency or other characteristics of the stated 100mV noise.

    Quote Originally Posted by Arrowspace View Post
    I need low pass filter with range 0 to 50Hz , 0 to 500 Hz and 0 to 1KHz
    I would be prudent to elaborate on the frequency and other characteristics of the signal of interest and its relationship to the 100mV noise.
    The Edge... there is no honest way to explain it, because the only people who really know where it is are the ones who have gone over.
    -- Hunter S. Thompson



  7. #7
    Banned
    Points: 929, Level: 6

    Join Date
    Jan 2015
    Posts
    186
    Helped
    3 / 3
    Points
    929
    Level
    6

    Re: I want to design digital filter in PIC18f

    I want to remove all signal with frequency gearter than 50HZ



    •   AltAdvertisment

        
       

  8. #8
    Super Moderator
    Points: 251,556, Level: 100
    Awards:
    1st Helpful Member

    Join Date
    Jan 2008
    Location
    Bochum, Germany
    Posts
    43,804
    Helped
    13320 / 13320
    Points
    251,556
    Level
    100

    Re: I want to design digital filter in PIC18f

    To make a filter with defined cut-off frequency, you also need to know the ADC sampling frequency. And specify a filter order and type (e.g. IIR with butterworth or chebyshev characteristic). A first order filter can be implemented quite simply:

    y(n) = (1-a)*x(n) + a*y(n-1), a = exp(-ωc/fs)



    •   AltAdvertisment

        
       

  9. #9
    Super Moderator
    Points: 69,598, Level: 64
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster 3rd Helpful Member

    Join Date
    Apr 2014
    Posts
    14,212
    Helped
    3248 / 3248
    Points
    69,598
    Level
    64

    Re: I want to design digital filter in PIC18f

    Hi,

    100mV noise in an analog signal is too much. Where does it come from?

    Maybe you should consider to improve signal quality before ADC.

    If you need help in this, then show us your circuit.

    Klaus



  10. #10
    Super Moderator
    Points: 28,512, Level: 41
    andre_teprom's Avatar
    Join Date
    Nov 2006
    Location
    Brazil
    Posts
    8,475
    Helped
    1078 / 1078
    Points
    28,512
    Level
    41
    Blog Entries
    6

    Re: I want to design digital filter in PIC18f

    Quote Originally Posted by KlausST View Post
    If you need help in this, then show us your circuit
    ...as well the layout and a picture of the noise.

    I guess he's measring a signal wired at a bread board.
    --------------------------------------------------------------------------------------------------
    Part of the world that you live in, You are the part that you're giving ( Renaissance )



  11. #11
    Banned
    Points: 929, Level: 6

    Join Date
    Jan 2015
    Posts
    186
    Helped
    3 / 3
    Points
    929
    Level
    6

    Re: I want to design digital filter in PIC18f

    Input coming from transformer, all capacitor 0.1uf

    Click image for larger version. 

Name:	7883715900_1438873440[1].jpg 
Views:	20 
Size:	106.9 KB 
ID:	119946

    Input frequency 50KHz



  12. #12
    Super Moderator
    Points: 28,512, Level: 41
    andre_teprom's Avatar
    Join Date
    Nov 2006
    Location
    Brazil
    Posts
    8,475
    Helped
    1078 / 1078
    Points
    28,512
    Level
    41
    Blog Entries
    6

    Re: I want to design digital filter in PIC18f

    What about you give more information such as the input waveform and layout on what you are measuring the circuit ?
    --------------------------------------------------------------------------------------------------
    Part of the world that you live in, You are the part that you're giving ( Renaissance )



  13. #13
    Banned
    Points: 929, Level: 6

    Join Date
    Jan 2015
    Posts
    186
    Helped
    3 / 3
    Points
    929
    Level
    6

    Re: I want to design digital filter in PIC18f

    pure sin wave with 50KHz frequency



  14. #14
    Super Moderator
    Points: 28,512, Level: 41
    andre_teprom's Avatar
    Join Date
    Nov 2006
    Location
    Brazil
    Posts
    8,475
    Helped
    1078 / 1078
    Points
    28,512
    Level
    41
    Blog Entries
    6

    Re: I want to design digital filter in PIC18f

    Still lack relevant information: what is the amplitude level ?
    Are there any restrictions on posting a picture of the signal ?
    --------------------------------------------------------------------------------------------------
    Part of the world that you live in, You are the part that you're giving ( Renaissance )



  15. #15
    Banned
    Points: 929, Level: 6

    Join Date
    Jan 2015
    Posts
    186
    Helped
    3 / 3
    Points
    929
    Level
    6

    Re: I want to design digital filter in PIC18f

    10 V , pure sin wave



    •   AltAdvertisment

        
       

  16. #16
    Super Moderator
    Points: 69,598, Level: 64
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster 3rd Helpful Member

    Join Date
    Apr 2014
    Posts
    14,212
    Helped
    3248 / 3248
    Points
    69,598
    Level
    64

    Re: I want to design digital filter in PIC18f

    Hi,

    as far as i can see it is not "random noise". I expect it is 50kHz ripple (of course with itīs overtones).
    The ripple is caused by the half wave recitier you use.

    The 50kHz are not filtered out carefully.
    There is only a fiter first order. the vaues are 1k+1k to 10n parallel to 10n.
    this gives 2k to 20nF. Cutoff frequency of 4kHz, but only on discarging the capacitor. During charge the impedance of the diode is low, and thus the filtering is worse.

    Even with a clean 4kHz filter first orde will leave a ripple of about 8% of 50 kHz input amplitude.

    My hint:

    Connect a 10nF capacitor in parallel to R2 (Iīm not sure is it 30k?).
    This gives another first order lowpass with 1kHz cutoff frequency.
    Lowering the remaining ripple from 100mV to about 2mV.

    If you need even better quality then we need more information...
    (or you could play with bigger capacitors, but this possibly makes your regulation loop slow and therefore unstable)

    Klaus



  17. #17
    Banned
    Points: 929, Level: 6

    Join Date
    Jan 2015
    Posts
    186
    Helped
    3 / 3
    Points
    929
    Level
    6

    Re: I want to design digital filter in PIC18f

    Quote Originally Posted by KlausST View Post
    Hi,

    as far as i can see it is not "random noise". I expect it is 50kHz ripple (of course with itīs overtones).
    The ripple is caused by the half wave recitier you use.

    The 50kHz are not filtered out carefully.
    There is only a fiter first order. the vaues are 1k+1k to 10n parallel to 10n.
    this gives 2k to 20nF. Cutoff frequency of 4kHz, but only on discarging the capacitor. During charge the impedance of the diode is low, and thus the filtering is worse.

    Even with a clean 4kHz filter first orde will leave a ripple of about 8% of 50 kHz input amplitude.

    My hint:

    Connect a 10nF capacitor in parallel to R2 (Iīm not sure is it 30k?).
    This gives another first order lowpass with 1kHz cutoff frequency.
    Lowering the remaining ripple from 100mV to about 2mV.

    If you need even better quality then we need more information...
    (or you could play with bigger capacitors, but this possibly makes your regulation loop slow and therefore unstable)

    Klaus
    All capacitor you seen in my circuit is 0.1uf.

    Ya I try bigger capacitor It make my system response too much slow, which is not acceptable.

    R2 is 33K

    - - - Updated - - -

    What more information do you need? Klaus



  18. #18
    Banned
    Points: 929, Level: 6

    Join Date
    Jan 2015
    Posts
    186
    Helped
    3 / 3
    Points
    929
    Level
    6

    Re: I want to design digital filter in PIC18f

    Hello Klaus I use 100uf capacitor to filter out ripples from output amplifier, but new problem is that DC output which i get it's moving up and down around 200mV



  19. #19
    Super Moderator
    Points: 69,598, Level: 64
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster 3rd Helpful Member

    Join Date
    Apr 2014
    Posts
    14,212
    Helped
    3248 / 3248
    Points
    69,598
    Level
    64

    Re: I want to design digital filter in PIC18f

    Hi,

    Ya I try bigger capacitor It make my system response too much slow, which is not acceptable.
    Hello Klaus I use 100uf capacitor to filter out ripples from output amplifier, but ...
    I suggested to use 10nF... and you say it makes it too slow...
    Now you talk about 100uF (wich is 10000 times my suggested value) this makes no sense.

    new problem is that DC output which i get it's moving up and down around 200mV
    Your circuit is something inbetween peak measurement and average measurement. You shoud decide what you need. It seems your circuit is a voltage regulation circuit.
    Therrefore a RMS calacualtion may be the best. But is is more difficult and - as long as voltage waveform is known - you may work with average.
    I donīt recommend peak measuremet, because the influence of waveform (error) is bigger than with other circuits.

    Now you tell DC output voltage is moving (Please specify where exactely the voltage changes and where are what value capacitors):
    This may be because: input voltage does change, waveform (peak) does change, your GND reference is not stable.

    Please tell us what response time you want to achieve. And what precision you need (what ripple voltage do you allow).

    Klaus



--[[ ]]--