Ideas for adjustable notch filter

Go To Last Post
34 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I need to make an adjustable notch filter for frequencys from 27 to 4200 hz
I want it to be able to detect 8 bands of resolution, 27hz to 55hz would be the first band 2000hz to 4200 hz would be the last band. I need to detect the frequency band within about 1 second.

I am using tiny 13's in the project or tiny 45, tiny 24's 25's or something else if needed.

I also need to auto detect and adjust the input for low level sound environments to high level sounds (Band stage) so that the frequency detector is not saturated at high levels of sound as well as being responsive at lower levels.

Adjustable via a pot.

Low cost around 5 bucks in parts maximum

Any rough ideas on what direction to go in?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I don't think this is something you can achieve at all with the
target processors you've outlined, assuming you are trying to get
them into DSP functionality. At the bare minimum, you need CPUs
with a hardware multiplier.

Why not simply use an existing filter IC?

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

That's the Idea i was looking for, What would you suggest, I don't know what I am looking for and google is giving me way to much to digest at the moment.

Perhaps something like this?
http://pdfserv.maxim-ic.com/en/d...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Google for SWITCHED CAPACITOR FILTERS.

These are sampled signal filter structures which can be configured into low pass high pass band pass or band reject ( notch) filters.

Their corner respectively centre frequency can be adjusted simply by changing the external clock signal.

Typically the National Semiconductor switched capacitor filter chip would be clocked at up to 50 times the frequency of interest.

For further information http://www.national.com/pf/MF/MF...

In conjunction with an avr the micro could provide control that is variable clock rate and data gathering and post filter processing.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I ordered: LMF100CCN/NOPB from digikey

I read through the datasheet, Monday I will have some chips to play with. Right now I am trying to figure out what MODE I should start with to accomplish the task.

I see how it uses a clock frequency in 100 or 50 x the frequency target, not sure yet how to adjust the band width on either side of that frequency target or if the rolloff curve is adjustable. I will keep reading but feel free to toss in any ideas on the MODE to use or anything else that comes to mind. I see the input power is 3 mA on some pins as well.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Switched cap "building blocks" from Linear Tech and Maxim will to bandpass, band reject (notch), low pass, high pass. Center frequency is tuned with an external clock (typically some mulple of the center frequency, like 50X or 100X). You could use a micro to generate the clock very nicely.

You can get them from DigiKey and other sources.

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

the MODE is the least oof your problems; it will become apparent once you decide on just exactly what kind of filtering you require and what the frequency response of the filter needs to be.

Sayng notch filter is a good start. However typicaly you would need to specify the skirt shape factor that is the inband gain flatness and the selectivity of the filter skirt. You may also have to specify the phase response of the filter across the band of interest alternatively group delay may be stated.
You will also have to specify attenuation characteristics that is minimum out of band attenuation.
So tell us more about your requirements and may be the modality will " come out in the wash ".

Note that modality determines the general type of filter , it does not address the the other issues such as gain, group delay and return loss ( in case of matched impedance filters ).

Modality determines general relationship of poles and zeroes of the filter transfer function not the absolute relationship of the pole zero constelation.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Filter Requirements

Frequency band from 27.5 HZ to 4186 HZ The range of a piano.

Adjustment to center frequency from user in that range

A 1/3 octave skirt on each side of the frequency selected. Similar to this:

http://www.rane.com/note101.html

Perhaps a 1/2 octave or even a full octave on each side. Three way switch to select. Depending on the number of stage lights used, if only 4 lights then a full octave on each side where each light could overlap the edges of another light.

I want to control an LED stage light from the output of the filter like a graphic equalizer display only instead of a vertical bar that gets higher with volume the light would glow brighter with volume of the music.

So each light would have a dial to set the center frequency, I may use a pot or a dip switch or a digital pot to allow the user to adjust the center frequency.

I guess this would be called a band pass filter although to me they are just the same but inverted signal output but maybe they function quite differently. That's why I need a starting point to eliminate some variables at the start. I see from reading about filters one should have quite a good math background, something I do not have.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ok.. this is abit better.

You do indeed need aband pass filter. Your 1/3 octave requirement dictates a Q of approx 4.3, a fairly easy requirement to meet.

The skirt steepness is not terribly well defined in your tatement, however for the purposes of discussion i would think that at least a fourth order filter m ight be required.

Fortunately one chip contains two stages each of which is a second order solution. Cascading two identical stages ough to do the trick. JUST BE AWARE OF SIGNAL LEVELS not to saturate the filters.

Now comes the issue of the Q factor.

First lets look at bandpass filter topology and the expression for Q factor.

Note that since the two stages are going to be activelly connected in series, the Q factor of each stage needs to be smaller than the overall required Q of the chain.

Qchain = 4.3 = Qstage/( SQRT(2^(1/n)-1)

rearanging this and given the number odfstages is 2 each stage neeeds a Q given by

Qstage = 4.3 * SQRT(2^(1/2) -1)

= 4.3 * SQRT( sqrt(2) -1)

= 4.3 * SQRT(.414)

= 4.3 * 0.64

Qstage = 2.75

Looking at the various topologies listed in the application note in particular the compariosn in TABLE1 mode 3 is recomended as best universal state variable filter.

While this holds true since all three forms of output present, inspection of the design equations indicates that the Q factor and gains for various of the three outputs are coupled.

Inspection of mode1 however suggests that the Q and gains are not as tightly coupled since gain is dependent on R1 which does not figure in the expression for Q. So by making R1 adjustable over a limited range the gain of the filter can be adjusted keeping Q constant ( one of Your design objectives).

So in Summary mode 1 will give you the constant Q p-erformance with the option of independent gain adjustment over a limited range of R1.

The output of band pass filter will need to be sampled by ADC at the top rate available to the AVR and further processed to generate a PWM signal todrive the light show.

Alternatively it could be rectified through a precision rectifier ( an active circuit consisting of a couple of op amps and some diodes and a filter capacitor ) and sampled at some much lower rate to generate a PWM signal as a function of signal level.

Good luck with your project.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have been reading everything I can find on these filters. Quite complicated I must say. I can not find a specific schematic for all the connections so I did the best I could as the clock passes midnight I thought i would post where I am. I have not looked at values yet for R3...R6 I am using the single supply MODE3. I am not really sure if you were recommending MODE 1 but i see the clock frequency for center frequency is not available in the table for mode 1. I want to be able to adjust the center frequency via the clock output from my uC across the full range.

Ok, enough thinking for one day, i just know I am going to dream I am in some kind of loop now as my brain mulls over the input it has received today.

My plan for adjusting the input was to control the microphone gain before input to the filter, I need to make an auto gain adjustment algorithm as well. I plan to use a frequency sweep though for testing this filter part first and work on the microphone input after I get this working.

Thanks a ton for the help I am afraid most of it is going over my head at this point though.

Attachment(s): 

Last Edited: Tue. Feb 27, 2007 - 08:57 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I found this schematic that uses plus and minus 5volt supply mode 3.

Should I use a positive and negative supply voltage? I searched digikey in vain looking for a regulator, I know someone makes them.

The device will be using a 12V unregulated DC supply, so I would need a +5 and -5 output regulator. Aby suggestions for part numbers?

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Download National Semiconductor's Introduction to Filters. This tells you more than you probably wanted to know about filter theory and leads right on into how to implement them in switched-cap. Your application is specifically covered.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Just a couple of notes to open the possibilities.

Using monolithic switched capacitor filters, you will exceed your US$5.00 budget by very a long way (unless that is your budget per channel).

The switched capacitor filters may require antialiasing filters ahead of them, depending on whether out-of-band signals are likely to cause problems.

It sounds as though you intend to design some sort of simple spectrum analyzer.If the performance is not to critical then you might want to consider one of the two approaches below:

You may want to go with active opamp filters for the whole thing. Quad opamps are cheap, but the parts count would be high.

You could make a transversal filter using the tiny13. Digitize the input signal using the A/D converter, then march the samples through a cue in RAM, picking off and adding or subtracting various taps. This would not require hardware multiplication if you only use coefficients of -1,0, and 1. One question about this approach is whether the code could run fast enough (I would think a 20 Mhz Tiny13 would not have a problem if written in assembly language).

--
"Why am I so soft in the middle when the rest of my life is so hard?"
-Paul Simon

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks Peret I will read that.

Farang, I am not trying to make a spectrum analyzer just a single adjustable frequency filter, (perhaps that is a spectrum analyzer just a small one). Each light will have its own filter, that single light will have an adjustment knob that will allow it to be set for one band of frequency.

My uC will monitor the output and make the light brighter when it sees that frequency band. It will start to fade as the frequency is not seen.

As a demo, look at microsoft windows player and set the visualizations to musical colors..night lights.

Imagine the background is a wall behind a live band and you have a number of these lights along the floor pointing up at the wall. Each light would also have red/green/blue and the ability to mix the colors. I plan to use the input from both volume and frequency to adjust the color and intensity of the lights.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If that is your application, then the filters will not be critical, and you can get by with fairly simple filters.

--
"Why am I so soft in the middle when the rest of my life is so hard?"
-Paul Simon

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I always start with simple because for me that's hard usually.

So I took pins 1..4 and 17..20 from one schematic, and the single power supply from the other one.

I am going to use sound forge and my line output from my PC for the test signal. Sound forge has a simple frequency generator I can make sweeps with and overlay additional signals. I plan to show the frequency input on my scope and the output on the second channel of the scope.

I need to make the clock generator from a tiny13 next. I will start with a single clock frequency and then sweep the frequency input from the PC output. Perhaps reverse that and sweep the clock with a constant frequency. Once I see the output (if any) I should be on my way.

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I finally tested the circuit and it failed. Using two tiny13s one for a 300 hz clock and another one as a frequency sweep I get 0V on the output using the 10V as shown in the one schematic. When I use only 6V the output stays high through the sweep.

I ordered some negative regulators so I can hook it up the same as the one schematic instead of combining the two. Attached is the plot of the test. I will retest this weekend when I get the regulators.

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

metron9, could you please point us to your code and your circuit? It is not clear to this reader what it is that you tested.

With respect to your application - do you want to detect a single narrow band of frequencies, for example 400 Hz +/- 50 Hz and use that to drive one light, using a Tiny13 as the filter?

--
"Why am I so soft in the middle when the rest of my life is so hard?"
-Paul Simon

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'd like to know a little about the user interface.... is this gizmo an audio analyzer, a color organ, a telemetry by light device? How did you arrive at the filter specs? How did you estimate the computational complexity to do the filtering in sw? (evidently you are heading to a hw filter approach... I thought programmers always tried to do as much as possible in sw?) You asked about a notch filter, which I think is easier than a bp filter, but maybe you really want a bp filter? Or a lp filter? Lets brainstorm on how its supposed to work... lots of smart engineers here..... I have a statevariable filter subroutine... It has hp, bp lp and notch outputs... I'm not using the notch output, but Whoop! There it is!

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

bobgardner wrote:
I'd like to know a little about the user interface.... is this gizmo an audio analyzer,a color organ, a telemetry by light device?
*********
Yes, I want to analyze music on stage and filter 8 octaves. I would like to allow the user to select the center frequency and get a voltage that rolls off about 1/2 octave in each direction. The unit would then control the intensity of the lights, like a color organ.
**********

How did you arrive at the filter specs?

*************
I posted originally asking how to do a notch filter, I was led to the LMF100 as the chip that could do the job. I am just floating around the net looking for schematics that I can test the chip with as I do trial and error , put a frequency in and see if I can filter it. (I am way over my head here)
**************

How did you estimate the computational complexity to do the filtering in sw?

**************
I am assuming that I would take the output of the LMF100 and run it into a RC circuit to create a voltage when a frequency is being passed through that I can read with the uC ADC. I assume a bandpass would block output and give lower voltage the further away from the center frequency the input was.
***************

(evidently you are heading to a hw filter approach... I thought programmers always tried to do as much as possible in sw?)

**********
Yes that was my first choice but the first response I got was

"I don't think this is something you can achieve at all with the
target processors you've outlined, assuming you are trying to get
them into DSP functionality. At the bare minimum, you need CPUs
with a hardware multiplier. "

Since I have never worked with filters I thought why not try and learn about filters, found the LMF100 and here I am. As I play with it I do see I could just analyze the frequency with a uC and be done with it I think. If the learning process of this LMF100 filter doesn't work I will fall back to that but I have some chips now and I want to make it do something.
*****************

You asked about a notch filter, which I think is easier than a bp filter, but maybe you really want a bp filter? Or a lp filter?

****************
I thought of notch as just the inverse of a bandpass thinking a notch would when connected to an rc circuit give me a low voltage vs a bandpass to give a high signal. Perhaps a bp allows a wider frequency range than a notch but it seems they are just the inverse of each other.
****************

Lets brainstorm on how its supposed to work...

***********************
I will use a tiny MIC and opamp to get the input
so I want to filter Frequencys from 20hz to 4200hz

User selects Select center frequency
The LMF100 simply puts out the frequency selected, I will use a simple resistor network with a pot and read the voltage using the ADC to set the output clock frequency. ( not sure here if I need a square wave that goes + and - or just a pulse wave, maby that's why it's not working.)

I can then calculate 1/2 octave down and 1/2 octave up to give a bandpass of 1 octave.

From there I can do many things like change colors, change intensity, etc...
*************************

lots of smart engineers here..... I have a statevariable filter subroutine... It has hp, bp lp and notch outputs... I'm not using the notch output, but Whoop! There it is!

To sum up, I am getting some adjustable negative regulators Friday. Then I need a schematic to connect the LMF100. The one I have is posted above, perhaps that will work or you have a better schematic I can use.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

farang wrote:
metron9, could you please point us to your code and your circuit? It is not clear to this reader what it is that you tested.

****************
I just whipped up a loop to toggle a pin and a pause delay. I used approx 300hz to drive the LMF100 fclock input.

I then used the same code but varied the pause delay to create a sweep of frequencies output on another tiny13. Very crude but I woke up at 3am and decided to give it go, I went back to sleep at 5am. When I woke up I realized I was just using a +5v to 0V pulse and not a square wave that goes + and -. I also realized I was using a pulse wave instead of a sin wave for input. I was going to use my PC line output and a sound file to test but it only outputs 1.6V I think so I will hook up an op amp to use that for further testing. I have a program I can generate sweeps and of course play music through it to test the filter as well as my o-scope to see the results. I just need a better education I never got when I had to go to work starting before I got out of high school.

I better go to work now...
*************

With respect to your application - do you want to detect a single narrow band of frequencies, for example 400 Hz +/- 50 Hz and use that to drive one light, using a Tiny13 as the filter?

******
YES to the 400hz +/- 50 but I thought I could learn how to use the LMF100 to do the filtering.
******

Last Edited: Thu. Mar 15, 2007 - 05:18 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ramsey electronics sells a 3 channel color organ... Dontronics sells em too... the schematics are on line I think... the filters are just simple rc type... I like the idea of using a micro to give some pattern and variation to the lights... I think envelope like boomp boomp boomp has more correlation to intensity than frequency... might be able to make something with solid state relays... they are just off-on, but clever little bursts of off-on might simulate dimming

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Bob. I don't need SSR's I am using Luxeon III LEDS and I will use PWM to vary the intensity. They will be powered by a wall wart using a current driver and the uC will use a 5V regulator. Tiny13 or something with more pins not sure yet what processor.

I just want to figure out how this LMF100 frequency filter works, I think that will give me the best response that I am looking for. Typical par lighting automatic devices simply start and stop a set pattern of lights with increase of volume and then the patterns have nothing to do with the music. I want to make an improved artificial intelligence light controller that's lower cost than the DMX stuff that poor bands can use to better their stage presence. (Sure this stupid mack doesnt even have spell checking on it, I hate macs except for graphics, then again my PC computer at work i cant seem to log in to this forum but I can on my home PC and this G5 Mac)

What I am really after is an AI concept to stage lighting. Being able to analyze the volume,frequencies, and pulse of the music to create repatable scenes of light so that the same song played will make the lights react the same each time it is played, not just blinking lights in all sorts of random colors. Assigning color pallets to frequency bands, perhaps strobe effects for fast double bass drum sounds. That is what I am after in the end. But for now if I can just hook up this frequency filter chip and make it do anything at all is the first step.

I have never used dual + and - supplys I would think if I use 2 5V battery packs in series I would have the ground in the center -5V at one end and +5 at the other but alas I don't know much about negative supplys yet.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Cool project. The windows media player visualizers are pretty cool in response to music. We could probably find the c source to some linux screen savers that do something similar... The guy that wrote Cool Edit which became Adobe Audition (Davey Jones? David Johnson?) wrote Kaliedoscope and Windchimes screensavers... both responded to music... I like the spectrum analyzer in cooledit.... I always wanted to run one of these music sensitive screen savers thru a projector onto a screen behind the band like a light show... never could borrow a projector... darn things are too expensive....

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So lets get going on this Bob. Work out the details of the frequency chip I have here post a schematic for me to build from and I will do the rest. When it's done I will send you a complete prototype. I will be using 1/2 inch sand blasted acrylic and edge lighting it with 3 or more (perhaps white for the strobe effect) I have the metal guy making a proto of the body that holds the circuit board and LEDS. Another thing could be just a 110V plug strip with the ability to plug in par lights and have the system run those with the SSR's you mentioned.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Just a note. If you merely low pass the output of the LMF100 with an RC filter, you will get nothing out because the output of the LMF10 is AC.

You will need to add some kind of detector (rectifier) to the output of the LMF10 before low passing it.

--
"Why am I so soft in the middle when the rest of my life is so hard?"
-Paul Simon

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes Farang, I understand the output is AC, I would be using a diode as well for detection.

I also have to think about an automatic clip detection circuit that will lower the input to the filter or lower or increase the gain on the microphone output from sound levels at 0 up to cover yor ears and pray you dont go deaf levels. A circuit that listens for sound and increases it's gain to maximum then reduces its gain to keep the output from clipping. i have not yet even googled that part of it yet.

I think I found a good place to start with this lab experiment.

http://www.sccs.swarthmore.edu/u...

I have some -5V regulators now so i can use the exact circuit outlined in the text. I will give this a try as it seems pretty simple now after reading in more depth this lab and the datasheet again. I will post my progress...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I used the schematic from the e72 lab 6 link above and got the following results.

What do you think.

Some notes:

The input frequency sweep at the bottom of the picture high and low voltages are 920mv and -1280mv the input signal voltages are .36V and -.44V Expected results for the schematic are 2.5 times input for the center frequency and it looks like I got 3x

So, success for this simple test. I am not sure if I can suppress the unwanted frequencies to more define the center frequency but i would wager there is a way. It is 2:30 am and I simply must retire.

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Nice traces.

Now go back to the circuit values associated with the filter and do a handraulic calculation of centre frequency at a fixed clock and the filter Q.

Then analyse the results and compare calculated centre frequency and Q to the measured parameters.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Handraulic calculation - to do a calculation by hand - not using a computer application.

Sorry, I was not clear in the above post. These four plots are output from a fixed clock frequency of 340khz. The sweep from 1khz to 6khz and the stepped 1khz through 6 khz is what was used for the input, I used sound forge to generate a sine wave and the line out jack on my computer for the input.

From a layman's point of view let me describe what I think I am doing. The resistor network on the LP,BP and HP pins and input pin determine the amount of amplification of the (clock frequency input/100) The resistors used here are designed to amplify the center frequency by 2.5 times. Only one side of the chip is being used. I do not understand how to effect the Q factor or modify it's characteristics so I can't analyze the results for that part of it. Really I have a pretty much 8th grade education in math and the formulas for example on page 9 of the lmf100 data sheet under Definitions I don't understand most of the terms used in the equation such as Hap(S) = some equation divide by another equation with funny looking "w" in it, it is simply Greek to me.

I do know from the results I have that I want a more narrow band pass but the only idea I have is to increase the amplification of the center frequency I am passing by adjusting the resistor network on pins 1 thru 4. I suspect this will be exactly the same roll off though. I suspect I will need to use the other side of the chip to further narrow the frequency target in what I understand second order and third order filtration means. I don't understand the term pole either.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

A new plot. Top blue is the input signal, bottom red is the output of the bandpass pin 2. I changed the resistor from 50k to 100k so I now have a 5X amplification around the center frequency. The clock signal is the same as before. The output then goes through a bat35 diode and a .1uf cap to ground with a 100k bleed resistor holds the voltage.

My plan now is to amplify the input signal from a small microphone until it hits the rails +5 and minus 5 from an op amp and then run that signal through a resistor divider to bring it to 1V. I then have a known signal input strength and a peak value to monitor with the ADC input.

Since I am not passing the original signal I don't care if it gets totally clipped by amplifying it to the rails. I am not totally sure if this method alters the frequency but the picture was made from a sine wave amplified this way and then dropped back down using the volume controls on the audio software.

Now I will set up an op amp and mic for some more testing and see if this method will work.

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Metron, looks like your envelope detector is doing the business.

You want to try and avoid clipping your input signal if at all possible while making it as large as you can (since clipping will introduce lots of high frequency harmonics, and since your output of the envelope detector is dependent on the input from the mic amp).

Perhaps you might look at AGC (automatic gain control) mic amps - google finds plenty of examples.

Neil

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes the automatic gain control is initially what I thought I would have to do, then I played with idea of amplifying and clipping. I did not think about the high frequencies that would introduce.

I guess the main point to be able to tell that you have or do not have a peak from the programming logic is you need to know the input level so you can compare the input vs output.

I shall research that subject today. Thanks for the reply.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You have the circuit for an 'ideal diode' peak detector? Eliminates that big .7V hump if using a regular diode. Hang those on the output of a 3 way crossover. Might work great.

Imagecraft compiler user