At the time of writing, some 9 years ago, the cat was just out of the bag. **PSoC3**, Cypress’s then-new family of paradigm-busting programmable mixed-signal systems-on-chip, was announced. Phew, it’s hot in here, off with that marketing hat (it’s been on and off periodically since then...).

This is the first of two columns showing a simple technique for designing, optimizing and implementing a response-equalizing filter. The second part will look at implementing it on a device such as PSoC3; this part is about the design process. Figure 1 is the first piece of our story. It’s the curve of the sensitivity of a customer’s sensor versus frequency (what *kind* of sensor, do you think?):

**Figure 1**

**Frequency response of the sensor.**

The customer said they wanted to equalize this so that the final sensitivity would be “independent of frequency”. Now, an elementary rule of Filter Wizardry is: *The frequency response of a filter doesn’t stop at the edges of the graph*. It’s important to understand what the response should do outside this range. “Don’t Care” *doesn’t* mean “Don’t Need To Care”.

Now, I’ll wager that the response of that sensor continues to fall off at 20 dB/decade outside the graph limits. But it would be a *terrible* idea to *boost* the response with gain that continues to rise without limits. We’ll want the response to flatten off or even fall back down, to avoid noise problems. For a first try, let’s hold constant the response outside Figure 1’s frequency range, for one extra decade in each direction; Figure 2:

**Figure 2**

**Extend the response on either side.**

Next, we’ll try to design a realizable filter with a frequency response approximating this curve to an acceptable error. The low frequencies involved indicate using a digital filter to avoid bulky external passive components. That’s handy, because PSoC3 has a built-in 24-bit digital filtering engine, its performance so fast that it’ll hardly have to wake up to crunch out anything I’ll ask it to do here. The digital stuff is for the next column; first, let’s design it in the analogue domain.

Figure 2’s response is flat at one end, wavy in the middle and flat at the other end (apologies to Monty Python); that’s a second order ‘shelf’ equalizer. The amplitude response of the general second order transfer function or ‘biquad’ section:

is easily computed in a spreadsheet. With ω equal to the input frequency divided by the frequency to which the transfer function is normalized, a bit of manipulation gives:

Figure 3 is a clippet of a working spreadsheet, using one column for each biquad section, with the cell formula shown in glorious ‘Excelcolor’. The gains of all the sections used are multiplied up (linear gains, not dB) and deposited in column G:

**Figure 3**

Now we need an initial coefficient guess; here’s how I’d do it:

- The middle of the frequency range is around 0.3 Hz so that’s where we’ll normalize everything to.
- At high frequencies we need a gain of 10, so that’s the ratio of the s
^{2} terms.
- At low frequencies we need a gain of 1, so that’s the ratio of the constant terms.
- We need a guess at the dissipation, which is the reciprocal of the ‘Q’ of the denominator, and sets the denominator s
^{1} term. The filter covers a frequency range of about 1000:1. My guess is the *square root of this*, say 30.
- At mid frequencies we need a gain of 0.4, and
*very roughly indeed* we can set the ratio of the s^{1} terms to this. In other words, I guess: