High Pass Filter, Low Pass Filter

Hi,

I want to use high pass filter (80Hz) and low pass filter (600Hz) in my project... (4th order)

Maybe is available any library ready to load? Or How can I implement this?

perhaps we need more information, what you want to do?

normal you can build a highpass or lowpass filter in electronics not in software like here:

http://en.wikipedia.org/wiki/High-pass_filter

http://en.wikipedia.org/wiki/Low-pass_filter#Electronic_low-pass_filters

i dont know what you want to do within a programm?!?

Some links http://stackoverflow.com/questions/13882038/implementing-simple-high-and-low-pass-filters-in-c https://ccrma.stanford.edu/~jos/filters/Definition_Simplest_Low_Pass.html

These are stripped straight out of the first google answer.

Let me know if you need me to google anything else, mine works really well.

Two duplicate posts deleted.

DO NOT CROSS-POST - IT WASTES TIME.

Do you have a DSP built into your Arduino? If so the documentation with it should detail how to use it for filtering...

However, I have never seen an Arduino with a DSP built into it - after all, the DSP would be about 1,000,000 times more powerful than the Arduino, so who would want an Arduino in it...?

So you will have to do it with hardware, not software. And for that, yes, you can combine a high-pass and a low-pass filter, but you have to make sure you do it in parallel, not series, otherwise one filter won't have anything to work on as the filter before it will have filtered out all the interesting frequencies.

What you really want (which is what you would end up with anyway if you did it right) would be a single "band-stop" (or "notch") filter. A single filter than passes all frequencies except those in a certain range.

Thanks you for replays. I have only arduino nano...

I built Sallen Key filter (HP and LP), but I was wonder if is possible to implement with in Arduino :)

My project is Hand Prosthesis controlling by EMG signal, so I'm looking for good solution.

I'm interested in this question, myself. I'm working on a project that requires four double balanced mixers, not hard to do in integer math, and two lowpass filters that must all stream from input to output.

There is information online about lowpass and highpass filters in integer math. You really don't want to use floating point, it will take a lot longer.

So is what you need a bandpass filter from 80 to 600Hz, or does this need to be separate filters?

A general article on integer filters in 8 bit microcontrollers:

http://edn.com/design/integrated-circuit-design/4323639/8-bit-microcontroller-implements-digital-lowpass-filter

An article aimed specifically at the Atmel Mega32 8 bit microcontroller:

http://people.ece.cornell.edu/land/courses/ece4760/Math/DigitalFiltersVersion2.pdf

More info: http://www.pearson.ch/download/media/9780131791442.pdf

http://dsp.stackexchange.com/questions/1920/low-pass-filtering-on-short-int-16-bit-pcm-samples

http://www.rowetel.com/blog/?p=1245

In order to use a micro-controller as a LPF or HPF you need to design your filter in C++, generate filter coefficients in matlab or octave. Then write some type of mechanism in the C++ code to load the filter coefficients according to the frequencies you want to filter. Because the order is low you should be fine with butter-worth IIR filter, if you need higher order (>~10order) your best bet is FIR filters. Good luck!

A basic one pole IIR low-pass/high-pass digital filter is trivial:

const float Kf = 0.1;  // Filter coefficient, 0.0 to 1.0 - larger value == higher cutoff frequency
float FilterAcc = 0.0  // Filter Accumulator
float LowPassOut = 0.0  // LowPass Output
float HighPassOut = 0.0  // HighPass Output

...

FilterAcc = FilterAcc + (Kf * (FilterIn - FilterAcc));

LowPassOut = FilterAcc;
HighPassOut = FilterInput - FilterAcc;

Regards, Ray L.