# Digital equalizer

I built this project as task on one of my university classes. Its purpose was to demonstrate idea of working hearing aid. When I got a score I turned it into 6 point equlizer.

This is a schematic of device:

Building equalizer we must ask ourself a question about how many frequencies we wnat to equalize and in what range. Number of points depends on how many frequency we choose. Let's say we chose 10 points. Now we need to divide our bandwidth for ten equal parts. If we choose acoustic bandwidth (20Hz - 20kHz), then case is easy, because we only need to choose each frequnecy being in ratio 1:2 and then we will get octave equalizer. If we choose smaller range, then we need to take smaller ratio but always in that way, to divide them, to equal parts.

Next step is to take beginning value of Q (quality factor) of resonant circuits, but first I need to mention about design.

In this device we can distinguish two blocks. First one is analogue part. It consists from six resonant circuits, two filters and operational amplifier. Each resonant circuit is built from capacitor and coil, which for resonant frequency becomes short circuit. You may wonder what coil, when you don't see a single turn. Well, here coil is replaced by gyrator, built on voltage duplicator, two resistors and capacitor. Less experienced electronic engineers must believe me and more advanced may count input impedance using method of admitance matrix. Schematic of one circuit can be seen below.

That kind of coil in connection with capacitor gives resonant circuilt LC. In very big simplification, we can say that resistance of this circuit depends on frequency and for one value this two elements can be treat as short circuit (almost like wire).

Trust me, it is a really big simplification, because serial resistance and other symptoms also matter, but let's don't go to deep into the details. Important is a fact that on quality of this circuit depends sharpness of amplitude characteristic. As bigger Q factor then more sharp characteristic. We are getting closer to the key moment. When we count Q factor, we always need to keep on mind, to not overlap each bandwidths too much (picture below), but also to get as most as possible flat characteristic in passing bandwidth for potentiometers set on max value.

When we have counted Q factor, we can calculate rest of elements. The hardest things are capacitors. Value coming from calculations need to be combined from couple of them, because they often are out from series. So, we can start from other side and assume some available value of capacitor and then count value of resistor which is far more easier to combine then capacitors. Inductance of this coil is give by equation:

L = R1 * R2 * C1

And Q factor:

Q = (sqrt(L/C)) / R1

resonant circuit frequency LC:

f = 1 / (2*pi*sqrt(R1*R2*C1*C2))

To count value of resistors, we may use two equations but still keeping in mind, that value R1 must be much lower then R2

R1 = 1 / (2*pi*f*C2*Q)

R2 = Q / (2*pi*f*C1)

Of course, resistors in each resonant circuits will be the same and values of capacitors will be changing.

So now we have LC circuits ready and we need to connect them into one piece. We will connect it between slider of a potentiometer and ground. All potentiometers are connected paralel into input of amplifier. See picture below:

simulated in PSpice gives a result:

Analogue part is a half of success. We need also to discuss digital part. Its heart is microcontroller AT89c8535 from Atmel. Digital potentiometers are connected to it and are used to control amplitude characteristic. There is also EEPROM memory on I2C for saving settings and 2*16 alphanumeric display for better communication with user. To control device, user must user four button keyboard (Up, Down, Left, Right). Keys "left" and "right" allow to choose appropriate potentiometer and keys "up" and "down" let to choose level.

Devices MAX5402 are programmed using SPI interface. Each byte sent to potentiometer is stored in EEPROM under address assigned to it. Value of the first potentiometr is saved under first address etc. That kind of memory organization allowed to simplify program as much as possible.

Last thing I want to mention is code. As I wrote, this device was project on my university, where one of terms to pass was write whole code in assembler. That is why, this is the only source code I have and can be downloaded below. I put many comments into code, so I will not go into the details of it here. I hope it will also help to understand how it works.

Wszelkie prawa zastrzeżone. Projekt i wykonanie strony SrcPro.pl