I am looking for a few good resources on the web to advance my knowledge of filter design for interfacing to an ADC of an uC.

I am looking to brush up on a few things: Determining proper cut off frequency,
Type of filter selection, when to use buffers, how to select the proper gain if using buffers

I have been searching the web but I am having trouble finding a general tutorial of, Here is your sensor, here is how you would go about interfacing to an ADC.

  • \$\begingroup\$ Are you looking for information on analog filters or digital filters (such as IIR, FIR, to be implemented in software of the microcontroller)? \$\endgroup\$
    – Jay Greco
    Commented Jun 27, 2013 at 14:23
  • \$\begingroup\$ Anti-alias filters, buffering sensors, amplifying sensors, connecting sensors and possibly powering (some) sensors. This is far to wide to cover in one question. Maybe restrict your question a little bit and 9say) concentrate on anti-alias filtering. \$\endgroup\$
    – Andy aka
    Commented Jun 27, 2013 at 14:27
  • \$\begingroup\$ Im looking more for the correct hardware design techniques. And rule of thumb suggestions. I understand filters are a HUGE topic, but I would assume that there are some best practices / steps to properly follow when you are presented with a sensor and a micro. ie say a Photoresistor and a PIC how do you determine the proper buffering or do you even need a low pass filter? etc. \$\endgroup\$
    – EE_PCB
    Commented Jun 27, 2013 at 14:51

4 Answers 4


Okay, first step is anti-aliasing. That's a big deal right there if you don't get that right. To take your example of a photosensor, let's imagine what happens in adverse conditions without an anti-alias filter.

For example, you have designed a battery powered device with a transflective LCD display because it can be seen with a backlight in the dark, and by ambient light in the day. You have a photosensor to switch the backlight off when the ambient light is bright enough, so you save battery charge. To save processor power, (this is not a high bandwidth requirement), you have some spare CPU time every 10ms and sample the photosensor then with the ADC. So far, so good.

Now your product is being used by a nurse, on a night shift, in low ambient light levels, but has a desk lamp to work by. She recently replaced the tungsten bulb, but could only find an eco-CCFL bulb. This fluorescent light flickers at 100Hz, (she's in Europe), which is too fast for her to see. But plays havoc with your product.

When the product is turned on, it samples the photosensor every 10ms and happens to match the peak of the light flicker waveform every sample. It records several consecutive samples of high light level and turns the LCD backlight off. But because the 10ms sampling interval is not synchronised to the a.c. cycle frequency, the sampling wanders in phase and a second or two later, the photosensor is sampling at the bottom of the flicker waveform. After several consecutive samples of low light level, your software turns the LCD backlight on.

The result is that the LCD backlight flashes on and off erratically, at a frequency of precisely the difference between the flicker frequency and your sample frequency. The product is considered faulty and is sent back to you for repair. You test at your bench, by the window, covering and uncovering the sensor and find it works as you expected. But the product IS faulty, it's faulty by design because you didn't listen to Uncle Nyquist.

The Nyquist Sampling Theorem states that you must sample at a frequency of at least twice the highest frequency in the input signal. Put the other way around, you must be sure to filter the input signal to reject any frequencies of half the sample rate or higher, and you must do this BEFORE sampling. Adding a software filter after sampling doesn't save you if you already have a low frequency alias present. By all means use digital filtering to process the sampled data as required by your application, but if you want to know where to start with filter design for sensor sampling, you must begin with correct anti-alias filtering before sampling.

As an extension, I was once caught out writing code for pressure control of a suction device using a small electric pump and a digital pressure sensor. The pressure sensor made a measurement every 10ms or so, but the pump was providing significant pressure fluctuations at awkward frequencies that the sensor was aliasing. There was nothing I could do in the electronics or software, the aliasing was happening inside the sensor itself. In the end, the solution was a pneumatic Nyquist filter at the input to the sensor.

I learned a valuable lesson that day.

  • \$\begingroup\$ +1 good examples. You're not a silly person are you LOL \$\endgroup\$
    – Andy aka
    Commented Jun 29, 2013 at 15:23

It really depends on the application

  1. Determine what kind of filter you need low..high..bandpass.
  2. You want to look at the different classes: Butterworth, Bessel, Chebychev, etc.. and decide which one fits your requirement.
  3. Need to determine the filter order, what is the minimum that can be used to achieve this goal

You can use matlab, spice or some software to simualte it prior to attempt Microchip has nice application notes and design software for examples and simulating

Here's one tutorial: Anti-Aliasing, Analog Filtering for Data Acquisition Systems

  • \$\begingroup\$ TI has FilterPro which looks useful for filter design: ti.com/tool/filterpro \$\endgroup\$
    – Renan
    Commented Jun 29, 2013 at 2:23

TI and Analog Devices are good companies to be followed for good technical documentation. AD link contains most of the interfacing part to be used during circuit design. If you are looking for high speed ADCs with more than 100 MSPS of sampling, I suggest to go with TI High Speed for quad channel and octa channel ADC. These are some of the links from TI for ADC basics:




So, now I've convinced you (hopefully) of the need for an anti-alias filter, let's look at how to go about specifying and designing one with a simple example. Let's take an easier problem than your photo sensor example to show the basic process, (or one approach to solving this).

Let's say you have a circuit which is battery operated, at a nominal 12V, but that voltage can vary between 10.5V and 14.5V. This battery supply feeds both a high-frequency buck converter to drive your microcontroller, and some actuator whose drive must be altered to compensate for changes in battery voltage as it discharges, to an accuracy of ±5%. So you need to measure the battery voltage with a 12-bit ADC in your microcontroller, which has a 2.0V reference, and which you can set up to read at 1ms intervals to an accuracy of ±1%.

The simplest approach is to feed the ADC pin with the output of a potential divider. The ADC requires a source impedance of less than 3k, so we can use a potential divider with a 3k3 to 0V and 22k to Vbat will give us a good resolution, zero offset and a range up to 15.3V. It also gives a source impedance of 2k87 which is just below the ADC limit. But we can get the same division ratio with 2k7 and 18k which gives better impedance margin at 2k4. So we'll use that.

With standard 1% resistors, the potential divider contributes nearly ±2% of uncertainty, making a total of ±3% for the whole measurement so far. So we have ±2% left for residual aliasing.

Now, the Nyquist theorem requires that your sample frequency must be at least twice the highest frequency in your signal to prevent aliasing. Put another way, and involving the residual tolerance derived above, we must make sure that any component of the signal likely to alias makes no more contribution than ±2% of full range, or ±300mV.

The buck converter we have chosen is used in another battery powered product, and while it gives good output stability, low loss and low component cost, we know it tends to inject around 900mV of p-p noise at 130-180kHz into the battery supply, which is otherwise very stable. Because our application is not identical, we decide to design for a worst case of 1.5V p-p, (±750mV) at 120-200kHz.

This is a particularly nice scenario, because we have a defined signal with the potential to alias, and that signal has a very high frequency, compared with the sampling frequency. If we knew nothing about the potential interference, we would have to design a filter to reject all frequencies above 500kHz, (half the sampling frequency), which is a much tougher challenge.

So now we need to design a filter which will reject ±750mV at 120kHz, leaving less than ±300mV. That's a doddle!

If you recall any filter properties, you might remember that a first order filter, (like a single RC), attenuates frequencies above the cut-off frequency, and that every doubling of frequency beyond the cut-off frequency halves the signal amplitude, (or by a factor of 10, 10dB, per decade). [Note that signal power drops off twice as fast, because power is proportional to amplitude squared].

Now, we need <300mV from a 750mV signal, which is <0.4. So our cut off frequency only needs to be <0.4 x 120kHz, which is 30kHz. But it is only sensible to have a cut off frequency no higher than half the sample frequency, so we could drop in a 500Hz filter which would attenuate the buck converter noise to 750 x 500 / 120,000 = 3mV.

We can achieve a cut off frequency of <500Hz simply by adding a 220nF capacitor across the 2k7 bottom resistor of the potential divider, (the cut off frequence Fc = 1 / (2pi RC), where R is the 2k4 parallel impedance of the potential divider. Simples!

Does that help further?

  • 1
    \$\begingroup\$ I'm pretty sure gain (and thus amplitude) drops off at 20 dB/decade, and power at 10. \$\endgroup\$ Commented Jul 1, 2013 at 22:30
  • \$\begingroup\$ @Scott: Thank you, you are quite right. Will edit to correct when I don't have to sleep. :-) \$\endgroup\$ Commented Jul 2, 2013 at 0:24
  • \$\begingroup\$ Thanks again this is the exact type of thing that I was looking for. You have really helped a ton! \$\endgroup\$
    – EE_PCB
    Commented Jul 2, 2013 at 13:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.