# Frequency of a noisy signal with fixed width pulses

My electricity meter has a front panel LED which pulses in proportional to the current energy rate. The frequency changes but the pulse width is set at 250ms. Due to environmental conditions there's plenty of noise. Currently I'm sampling this at 10kHz, the pulses may be a few seconds apart.

I would like to filter these pulses and ignore anything else that wasn't 250ms long (ie the noise) and find the frequency of the train. Are there any suitable methods to achieve this?

My first thought was to differentiate the signal but this would be easily confused by large noise spikes. I also wondered about testing it's coherence with a simulated pulse train, but as the frequency changes this would be potentially infinitely intensive AFAIK.

If I was to build an electronic solution I'd use edge comparators to find the pulses. I'm wanting to use NumPy/matplotlib and deal with the signal in the frequency domain, if possible (purely as an educational exercise).

• Do you know whether the time between pulses is always a multiple of 250 ms long? Commented Dec 14, 2014 at 19:53
• The time between is not a multiple of 250ms, although I'd be interested to know how you'd approach it if it was. Commented Dec 14, 2014 at 22:18
• If it was, then you would have is an "on-off keying" digital signal with a bit time of 250 ms, and you could use techniques applicable to that. Commented Dec 14, 2014 at 22:32
• How are you sensing how you're LED is on or not? Commented Dec 14, 2014 at 23:32
• A simple photo diode and op amp combo from my junk box. Commented Dec 15, 2014 at 16:32