Band Pass frequency selector with digital potentiometer?

Thread Starter

SirKinguin

Joined Mar 24, 2021
10
Hello everybody,

I am trying to build an LED audio spectrum analyzer with 5 different band frequencies. For the actual filter i decided to use a gyrator circuit which utilises OpAmps and I came up with 2 diffrent designs. The first one is to just use 5 different gyrators for each band and the second design is to use only one gyrator and then using some kind of switch, be able to cycle through diffrent bands by changing only the resistors' values(basically a digital potentiometer as shown in the schematic). The problem i run into is choosing the actual switch since I want it to work at AC and not affect the rest of the circuit and mess up with the filtering. Each band will be updated 30 times per second which means that (since i have 5 bands) I'll need to change from band to band every 6ms roughly using some kind of controller (in the schematic shown as clock). What switch should i use and what are your opinions on the whole concept? Should I abort the second design entirely?

The schematic only has 3 switches for simplicity reasons. The finished version will contain 5 switches, one for each band.
LEDSpectrumAnalyzerSwitchingCircuit.png

Thanks,
Chris
 

Papabravo

Joined Feb 24, 2006
16,785
First things first. You don't want to connect loads to the input of an operational amplifier. Loads go on the outputs and can be buffered if you like. There is no source of current from the non-inverting input to the load resistors. They will forever have 0 volts across them.
Second. You need a DC path to ground from the opamp input for the amplifier to work.
Third. A gyrator is a type of circuit used to simulate an inductor. This is seldom necessary with active filter circuits.
As it stands this circuit has dubious utility.
 
Last edited:

Thread Starter

SirKinguin

Joined Mar 24, 2021
10
First things first. You don't want to connect loads to the input of an operational amplifier. Loads go on the outputs and can be buffered if you like.
Second, the purpose of a gyrator circuit is to replace an inductor, Was that your intention? Have you simulated this circuit? what is the purpose of the switches?
I have done an AC sweep from 10Hz to 30kHz and the circuit works as intendent. The purpose of the switches is to connect different resistors with the rest of the circuit resulting in the change of the center frequency of the band pass filter.


EDIT: The simulation below is not from the above circuit but from a similar one tuned to pass 2.7kHz
Output.png
 
Last edited:

Papabravo

Joined Feb 24, 2006
16,785
How can you say it works if the simulation is from a different circuit. You're a laugh riot!
Show me the current in R3, R4, and R5
 

Thread Starter

SirKinguin

Joined Mar 24, 2021
10
How can you say it works if the simulation is from a different circuit. You're a laugh riot!
I can't simulate the exact circuit because as i said i don't know what switches to use. The circuit from the simulation is below and as you can see it's the same just without the switches. The circuit with switches is an idea of mine in order to cycle through all the bands without using 5 different OpAmps, effectively making the circuit more compact and possibly cheaper. In order to change the center frequency one of the things i could do is to just change the value of the resistor R14 and that's when the switches come into play. They will allow me to cycle through each band by connecting different value resistors.LED.png
 

Papabravo

Joined Feb 24, 2006
16,785
What is the opamp supposed to do while you are making and breaking switches?
You have the circuit drawn in a strange way.
R5 and C2 form a single stage lowpass.
C3 and R14 form a single stage highpass

So this looks like a multiple feedback arrangement. I think you will ultimately be disappointed by the results.
Let me try something and I'll get back to you
 
Last edited:

Audioguru again

Joined Oct 21, 2019
3,515
The LM358 has trouble with frequencies above about 3kHz due to its poor slew rate. Most low noise audio opamps work well up to 100kHz. An OPA134, OPA2134 dual and OPA4134 quad audio opamp works well up to 250kHz.
 

Thread Starter

SirKinguin

Joined Mar 24, 2021
10
The LM358 has trouble with frequencies above about 3kHz due to its poor slew rate. Most low noise audio opamps work well up to 100kHz. An OPA134, OPA2134 dual and OPA4134 quad audio opamp works well up to 250kHz.
LM358 is just what i had available on me and all the simulations i run didn't show anything unexpected for frequencies up to 20kHz so i had no reason to doubt. Thanks for the advice. I'll look in to it and choose a more appropriate OpAmp.

Chris
 

Papabravo

Joined Feb 24, 2006
16,785
What I did was redraw your circuit in a conventional way and run it with five different values of R14. Those values were 10K, 50K, 100K, 200K and 300K. The higher the value of R14 the lower the peak of the bandpass response. As I anticipated the lowpass section is being loaded by the highpass section which follows it such that as you go higher in frequency the the response becomes more highly attenuated. What you want for is for all the peaks to be at the same level. You can achieve this, but not with this design.
 

Attachments

Thread Starter

SirKinguin

Joined Mar 24, 2021
10
What I did was redraw your circuit in a conventional way and run it with five different values of R14. Those values were 10K, 50K, 100K, 200K and 300K. The higher the value of R14 the lower the peak of the bandpass response. As I anticipated the lowpass section is being loaded by the highpass section which follows it such that as you go higher in frequency the the response becomes more highly attenuated. What you want for is for all the peaks to be at the same level. You can achieve this, but not with this design.
Yes. That's something that i noticed too in my simulations and the solution i came up with is that after the filter i'll connect onother OpAmp in a non-inverting configuration and choose the gain for each band just right so that all channels are at the same voltage output.
 

Papabravo

Joined Feb 24, 2006
16,785
The OpAmp is part of the gyrator. Here's an article on gyrator filters. Go at section 4 and at figure 4 you'll see that the right circuit is the one that i am using. It's a bandpass filter
I am asking you to put on your thinking cap and stop responding like a robot. When a high impedance input, like that of an opamp, is allowed to float for some period of time then the output becomes uncontrolled. How will your gyrator filter respond? The answer might not be in the article.
 

Papabravo

Joined Feb 24, 2006
16,785
Yes. That's something that i noticed too in my simulations and the solution i came up with is that after the filter i'll connect onother OpAmp in a non-inverting configuration and choose the gain for each band just right so that all channels are at the same voltage output.
There are better solutions, but if you're not interested...

Oh. The answer to your question about analog switches is to find one that is compatible with your analog voltage levels and has a low rds(on) characteristic. Think milli-Ohms. One more thing. Analog switches a WAY more expensive than opamps. Your approach may be pennywise, but pound foolish.
 
Last edited:

Thread Starter

SirKinguin

Joined Mar 24, 2021
10
There are better solutions, but if you're not interested...

Oh. The answer to your question about analog switches is to find one that is compatible with your analog voltage levels and has a low rds(on) characteristic. Think milli-Ohms. One more thing. Analog switches a WAY more expensive than opamps. Your approach may be pennywise, but pound foolish.
Ok, i think i understand what you mean. So what do you recomend?
 

Ian0

Joined Aug 7, 2020
3,235
If you switch between circuits at 6ms intervals, then you have a sampling system, the frequency response of which will be constrained by its sampling frequency. How do you propose to measure frequencies below 160Hz if the lowest frequency band is only switched in for 6ms?

The only way that will actually work is to put in 5 separate bandpass filters, I suggest using the MFB bandpass filter.
https://sound-au.com/project63.htm
followed by 5 active fullwave rectifiers
https://www.analog.com/media/en/training-seminars/tutorials/MT-211.pdf
then into your MCU's A/D?
 
Last edited:

Thread Starter

SirKinguin

Joined Mar 24, 2021
10
If you switch between circuits at 6ms intervals, then you have a sampling system, the frequency response of which will be constrained by its sampling frequency. How do you propose to measure frequencies below 160Hz if the lowest frequency band is only switched in for 6ms?
You're right, i didn't think of that. I chose to go for 6ms because that way as i explained each band will end up updating 30 times a second. I want each column of LEDs to move up and down smoothly so i chose 30 times a second refresh rate because in games 30fps is considered the minimum for a smooth experience. So I'll probably have to scratch the swithcing circuit anyway.
 

Ian0

Joined Aug 7, 2020
3,235
Assuming that audio is 10 octaves (20Hz to 20kHz), then each filter will be two octaves wide.
The lowest one will be 20Hz to 80Hz, which means your refresh rate will only include 2 and a bit cycles of waveform or less.
You'll need to average the response (at least for the lowest filter) for a lot more than 30ms.
I've seen this implemented completely in analogue*, using the circuits I described in Post #15 followed by a set of LM3915 LED bargraph drivers. There's no need for a refresh rate at all if done that way.

*In a magazine about 4 decades ago.
 
Top