Electronics > Microcontrollers

Fast software signal filtering

<< < (5/5)

IanB:

--- Quote from: Lesolee on January 28, 2012, 11:06:39 am ---I noticed on the first post that your desired waveform is not physically possible.
--- End quote ---

Yes, I noted that too. The green line rises to its final level in the first picture long before the amplitude of the yellow trace has got there. It would be impossible to achieve the green line in real time, although if some kind of look ahead and processing delay between input and output were allowed it might be possible.

Which brings up a general observation about problem solving: it is important to develop a clear high level description and specification and understanding of the expected outcome before delving into filters and programs and circuit designs.

As far as I can tell this thread has never contained an adequately precise statement of the problem, consisting of a thorough description of the properties of the input signal, its range, its variations and its characteristics; an exact description of the output signal; and a statement of how the output signal needs to relate to the input signal in the time and frequency domains.

Without such a problem statement, designing a solution is going to be a somewhat ad-hoc process and the result buggy.

(Sad to say, this situation also crops up far too much in the software world and computer programs are accordingly full of bugs.)

Mechatrommer:

--- Quote ---The green line rises to its final level long before the amplitude of the yellow trace has got there
--- End quote ---
my imagination tells me by using comparator, it might be possible. but not a comparator alone, i think there will be "adjustable voltage divider" to define hi volt value, and then a hysterisis or delay/low pass circuit etc etc. but it could get messy after that, let alone the detection for hi->lo pulse.

IanB:

--- Quote from: Mechatrommer on January 28, 2012, 08:24:38 pm ---my imagination tells me by using comparator, it might be possible. but not a comparator alone, i think there will be "adjustable voltage divider" to define hi volt value, and then a hysterisis or delay/low pass circuit etc etc. but it could get messy after that, let alone the detection for hi->lo pulse.

--- End quote ---

Yes, if you bring in more information about the yellow signal than we have been given it might be possible. For example if you know ahead of time that the yellow signal is amplitude modulated and it has only two states, "low" and "high", and you know the amplitude ranges that low and high correspond to, and you know the shortest possible duration of a low and high state before it can change again--then if you are currently in the low state and you detect an upward trend in amplitude that exceeds the noise threshold of uncertainty and which occurs after the minimum low time has passed, then you can switch to the high state.

But if you can't nail down the description of the input signal that tightly, you will be subject to false detection and errors on output. Most likely a real system would include a digital error correction code (ECC) to guard against the inevitable bit errors that occasionally will occur no matter how good the decoding circuit is.

ejeffrey:

--- Quote from: Mechatrommer on January 28, 2012, 08:24:38 pm ---
--- Quote ---The green line rises to its final level long before the amplitude of the yellow trace has got there
--- End quote ---
my imagination tells me by using comparator, it might be possible. but not a comparator alone, i think there will be "adjustable voltage divider" to define hi volt value, and then a hysterisis or delay/low pass circuit etc etc. but it could get messy after that, let alone the detection for hi->lo pulse.

--- End quote ---

The real issue is that the yellow curve contains essentially no information in the troughs.  A rising edge of the green curve anywhere between one falling edge and the next rising edge will give rise to the same signal, therefore it is not possible to distinguish the possibilities.  If you have some external clock and you know that the green curve can only change state at certain times, then you can reconstruct the signal nearly exactly.  Otherwise you will always have an uncertainty window of approximately half the carrier period in the timing of the rising and falling edges.

Psi:
Thanks guys,

Yeah, i probably should have given more information at the start but i don't like to get too bogged down in specifications limits when trying to solve a specific problem.
I've been burnt before when the specification were set so tight that the solution ended up being more complicated than it really needed to be.

Sometimes it's good to throw the specs out the window and just look at ideas, even if they probably wont work, because they prompt other ideas that may turn out to be better.

The signal is from a photodiode with pulldown which is pointing at a computer screen. An application is flashing binary data on the screen in black and white.
The higher frequency is the LCD backlight pwm and the low frequency is the actual flashing of data.

The pictures i gave are from 40% and 0% brightness on the lcd.

What i want to do is recover the binary data in code.
I've already put a hardware envelope filter on the input as AntiProtonBoy recommended and it looks much better but the filtered pulses are still quite chaotic under 30% brightness. Currently i'm trying to improve my adc sampling code to filter and recover the data.
I'm using Manchester code to encode the data and that is all working fine.


My current technique is to do a 32 sample running average and then trigger a timer when a crossover is detected (average moves between halfway point).
The timer is set to skip any subpulse (Manchester polarity correction) and then start looking for the next data pulse.  Being Manchester code,  the rising or falling edge give the high or low bit state.

Navigation

[0] Message Index

[*] Previous page

There was an error while thanking
Thanking...
Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod