Bandpass Filter Help

Discussion in 'General Electronics Chat' started by prodigyaj, Dec 11, 2007.

  1. prodigyaj

    Thread Starter Active Member

    Dec 11, 2007
    48
    0
    Hy ,
    I have designed a Bandpass filter 400Hz to 2.4Khz with centre frequncy as 1Khz.The input is a 1Khz square signal. Although the circuit attenuates any signal out of the bandwidth i get a sinusoidal output(this is also justified by fourier transforms). But I need to get the same square wave as output.I use passive filters single pole with R and C. What modifications to get square wave as output ?
     
  2. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Well, a square wave is the sum of all of the odd harmonics of a frequency.

    Since you're eliminating all of the harmonics below 400Hz and above 2.4KHz within the filter, you're not going to get a square wave out of the filter! For a 1KHz square wave, you would need to pass at least the 3rd harmonic (3KHz) and preferably the 5th (5KHz) to even approach a decent square wave. As things are, you COULD pass through a 400Hz-480Hz square wave with a reasonably decent-looking output (best would be @ 440Hz)- that is, if your band edges are really at 400Hz and 2400Hz.

    What you COULD do is send an FSK signal through your filter, where both frequencies were within the range of your filter - let's say, 1KHz and 1.2KHz. On the other side of your filter, detect the shift in frequencies; when 1KHz is detected, output a low, 1.2KHz a high.
     
  3. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Check out this Wikipedia entry:
    http://en.wikipedia.org/wiki/Square_wave

    Scroll halfway down to the "Examining the square wave" entry. There's a Fourier series formula and a great graphic that illustrates what happens with the odd harmonics.
     
  4. thingmaker3

    Retired Moderator

    May 16, 2005
    5,072
    6
    How about using a zero-crossing detector to trigger a flip-flop? Or how about simply over-driving the sine wave?
     
  5. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    You could do what Thingmaker3 suggests (using a zero-crossing detector), or a comparator circuit (similar, except you set the reference point) or something like a CMOS 4093, which is a quad NAND gate with Schmitt Trigger inputs. The advantage of using a 4093 is that you'll avoid any instability that you might experience if you used a comparator; but it would not be suitable for a low-level signal.

    Your other solution is to open up the bandwidth of your filter; make it start around 900 Hz, with the stopband at around 5.1KHz to allow the 3rd and 5th harmonic, or 10.2KHz to allow the 7th harmonic as well. The wider your passband, the better your square wave will be.

    Scotty to Kirk: "But Captain, I canna change the laws of physics!"
     
  6. prodigyaj

    Thread Starter Active Member

    Dec 11, 2007
    48
    0
    I want to make a Distance Calibrating sensor using only IR emitter and photo diode. In short I need an electrical voltage as an output for the corresponding intensity of IR emitter that falls back on photo diode after reflection. Once a I get a voltage that is consistent to the distance of the object my purpose is served. The object to be detected is always a smooth white surfaced wall and my sensors at all times are perpendicular to the plane of the wall. All the external parameters like ambiance because of sun , camera flashes and other sources of noise should be considered. Kindly Help me with a circuitry or some really nice implementable ideas.
    Thank you
     
  7. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    This is a completely different request from your original post.

    I suggest you start a new thread, so things don't get all confused.

    Back to the bandpass filter - did you decide what you're going to do? Or are you still "stuck"?
     
  8. prodigyaj

    Thread Starter Active Member

    Dec 11, 2007
    48
    0
    sit my original application was distance calibrating sensor. I decided to modulate my IR at 1 Khz and using a filter i can accept this modulated signal and hence eliminating all the ambiance , but now after reading this i understand that my output would not be similar to my input i.e i will get a sine wave which will not serve my requirement
     
  9. prodigyaj

    Thread Starter Active Member

    Dec 11, 2007
    48
    0
    sir my original application was distance calibrating sensor. I decided to modulate my IR at 1 Khz and using a filter i can accept this modulated signal and hence eliminating all the ambiance , but now after reading this i understand that my output would not be similar to my input i.e i will get a sine wave which will not serve my requirement
     
  10. gootee

    Senior Member

    Apr 24, 2007
    447
    50
    It sounds like what you want/need is some type of analog level-detector for the filter output. You could search for "envelope detector" circuits, or RMS-to-DC converter ICs.

    Basically, if you use a rectifier (or, probably, instead, an "ideal diode" full-wave rectifier opamp circuit), followed by a low-pass filter, you will get a quasi-DC signal that is representative of the amplitude of the detector's input. It will be the average amplitude of the rectified signal, rather than the actual peak amplitude. But that's OK. Just calibrate for that, instead. (Or, if you do really need the actual peak, look for "peak detector" circuits, which are similar, but might be a little more problematical for what you're doing.)

    Be aware that depending on how smooth you want the DC output to be, there will be a "settling time" involved, which will get longer with better lowpass filtering of the output. (If that becomes a big problem, later, you might be able to make a lowpass filter with a variable time-constant, that might be able to significantly lower the settling time. I'd probably use something like a Fairchild H11F1M, or maybe a Perkin-Elmer Vactrol [or even just an LED encapsulated with a CdS photocell], as a current-controlled resistor, for that. But don't worry about it, right now.)

    Look at the first circuit on page 18 of application note AN-31, from national.com:

    http://www.national.com/an/AN/AN-31.pdf

    You could probably use something very similar to that. (Note that you probably won't have C1 and C3, if you don't use that same type of opamp.)

    You should simulate your filter and the circuit from the appnote, together, with a representative square-wave voltage source for the input, using something like the free LTspice software, from http://www.linear.com , since some of the component values will probably need to be tweaked, for your frequency and amplitude range.

    The following appnote will probably also be a very good reference for you:

    http://www.national.com/an/AN/AN-20.pdf

    In fact, the first circuit on page 9 of that appnote is very similar to the one already mentioned, but AN-20 also includes a text description with the theory of operation.

    Note that you don't necessarily have to use the same diode and opamp parts that they used in the AN-20 circuit, although they might have been optimized for temperature stability, or something else (I didn't read the full accompanying text.). And you might need to add some small capacitances in parallel with some of the feedback resistors (similar to what was done in the AN-31 circuit), if you see any stability problems or high-frequency oscillation, in the simulations. The input AC-coupling (DC blocking) capacitors are a very good idea, since they will eliminate possible accuracy problems due to any DC offsets up to that point.

    - Tom Gootee

    http://www.fullnet.com/~tomg/index.html
     
  11. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
  12. gootee

    Senior Member

    Apr 24, 2007
    447
    50
  13. Dave

    Retired Moderator

    Nov 17, 2003
    6,960
    144
    Can I ask prodigyaj to clarify if indeed this thread has been superseded by the one linked to by SgtWookie?

    If so, for the purposes of clarity and sanity of our members, I can lock this thread an direct answers to the active thread.

    Any clarification would be appreciated.

    Dave
     
  14. prodigyaj

    Thread Starter Active Member

    Dec 11, 2007
    48
    0
    well it was but then i have modified my approach a little bit and i think i can work with this and i have some more things to clarify here :
    well sir now i have decided to increase my bandwidth my input frequency is 2Khz and i can increase my bandwidth as 400hz to 40Khz ( but centre frequency is not 2khz but i dont think it would be a problem as long as 2khz is in my passband )
    So now i give a 2khz square wave input to my filter.
    now i have 6,10,14,18,22,26,30,34,38 ( all odd harmonics of 2khz) so i i think i must now get a fairly good square wave good enough to work with right ?
    now the second problem i face here is high attenuation in the passband as i increase my bandwidth(for 5V i get 0.2V op) , so i m facing a problem there , although i m sure my gain of the filter is getting affected cos of improper selection of resistances and caps ( yeah btw i use passive filters as matched filters ) so kindly tell me a good combination of RC values for with good gain ( even 2V for 5V i/p would be really gr8 ) ?
    lastly my i/p = 0-5V square wave and my ouput with " x "Volts ( that wold be decided by amount of attenuation ) is not 0 -x but -x/2 - +x/2 and obviously this wld be expected as the band pass filter completely removes the DC offset and for this i plan to use a clamper ( which would mean again loss of 0.7V but again if my o/p is 2V and clamper take 0.7 i.e 1.3 volts i can very nicely work with this o/p also )

    so tell me if my appraoch is correct purely with respect with filters ( i think i will come to distance later but right now only as filter application) ?
     
  15. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Well, using RC only, you're going to have a fair amount of attenuation.

    What type of filter are you constructing? Butterworth, Sallen-Key, Chebshev, etc?

    If you use an active filter (op amp with unity gain), you won't have to deal with the losses - need good bypassing though.
     
  16. prodigyaj

    Thread Starter Active Member

    Dec 11, 2007
    48
    0
    matched filter for the moment ! but i can re invent my design if someone tell me !
     
  17. gootee

    Senior Member

    Apr 24, 2007
    447
    50
    You might want to look into using active filters (or at least put an opamp buffer before each filter stage, and probably after the last one), and an active clamp if needed. They can usually work better in every way. You would only need to add opamps. Download something like ti.com's free FilterPro software. It will make this very easy.
     
  18. prodigyaj

    Thread Starter Active Member

    Dec 11, 2007
    48
    0
    hey thanks for all the valuable suggestions , so as it goes now i have decided to go for active filters !
    but since i have have space constraints i am going for maximum 2 pole wide bandpass active filter ! ( using lm 358 as i get both the opamps in built in 1 IC ).
    I tried simulating the circuit in multisim but I am not getting any of the expected output !
    its been a persisten problem with multisim , i dunno if i am simulating it wrong but the circuit is surely perfect as i myself designed it from Malvino and also made the same from filterpro, if anyone can simulate it in any simulating software ( in multisim or any other : in case of other do mention ) please send it to me at prodigyaj@gmail.com .
    I need 2 pole wide band pass filter cut off at 1Khz to 20Khz.
    And one more question is it necessary to pass majority of the odd harmonics in the pass band like in case of RC filter cos of fourier compnents ! ??
     
  19. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    I did some fiddling with the filter thing the other day using Linear Technology's FilterCad and Texas Instrument's FilterPro. One thing I'd failed to consider (which is likely going to impact your output) is phase shifts; by the time you get near the upper edge of the passband, there is a very significant phase shift (which is what causes the rolloff to begin with...) and this is going to have a negative impact on your output.

    But anyway... you could connect a 2-pole high pass with a 2- or 4-pole lowpass, and wind up with a fairly decent filter; that would give you 6 poles using three op amps. You COULD use something like National's LM146/LM346, but you might be better off using a single op amp for the high pass portion, and a dual op amp for the low pass. You could use an LM1458 for the duals, but they can exhibit latchup or phase reversal if you get near the rails. You might consider looking at Linear Technology's LT1007 low-noise single op-amp, and it's siamese twin, the LT1057 (dual opamp) - they have phase reversal protection circuitry built in, and are very low noise; important when you're cascading several amps. You COULD use an LT1058, but the specs aren't quite as good as for the 1057 or 1007, and in the datasheet it states that latchup is possible across pairs of amps. The 1007 has the best specs of the three, but you can start taking up a lot of real estate and doing lots of wiring with all discrete components.

    The software tools I mentioned are available for free at the manufacturer's websites - just do a search once you get there, and it's yours for the downloading.

    The wider your passband, the better your output pseudo-squarewave will look. If you had an infinitely wide passband, you would have a perfect squarewave, but of course that's only possible in theory ;)

    However, all is not lost. After all, you're controlling the input square wave with a microcontroller, and I presume you are also the code writer. If you're programming in assembly language, it'll probably be a good bit easier to determine how much time your instructions take to execute. Send the signal to turn the light on, and then it's a race between your uP instructions and the various propagation delays through the rest of your system before the emitter comes on and you take the reading. If you time it closely, you can get your reading at a reasonably flat area of the square wave output.
     
Loading...