Thought I might put this question out to see if anybody else has some ideas.
I am using a PIC to detect a signal. Nothing too amazing about that. I have two methods with which I detect it. Either with a high impedance detector circuit which the pic can see high or low logic levels, or the on board ADC.
I use the later because there is more than enough signal to work with and it's a little more flexible. The PIC is any 8 bit PIC with an ADC converter, like a 16F877.
The sample rate is flexible, I can sample as fast or as slow as I like within reason and the signal is only going to be a single frequency that never changes. It's phase changes which is where the information is in the signal. For the example I'll say it's a 1KHz sine wave.
The amplitude will also vary but it contains no information. There is a reasonable amount of noise. When the signal is strong, a zero crossing detector works very well. But as the signal to noise ratio decreases the noise introduces errors and while the zero crossing still works within tollerance, eventually the signal is no longer usable.
So I'm just trying to squeeze a little more out of what I do have.
So the thought is how simple can I make a 1KHz DSP notch filter.
I've tested code which samples at a higher fixed rate and samples 1mS apart are averaged which recovers a reasonable amount of signal by averaging out the noise.
The code is very simple, but it's memory intensive. If I sample at 10KHz over 10mS
I can easily use up 100 bytes of memory.
I can reduce the memory by continuously adding values and let the averaging catch up, but obviously the response is much slower. Using only 10 bytes, each sampled at 100uS which represents about 36 degrees in phase, which is good enough to recover the encoded information. The problem with the successive addition rather than limited addition is the time it takes for the code to realise a phase reversal has occurred.
Does anybody know of any shortcuts for an 8 bit DSP notch filter?
Or other methods for recovering phase information from a fixed frequency in a high noise environment ?