Tell me more ×
Electrical Engineering Stack Exchange is a question and answer site for electronics and electrical engineering professionals, students, and enthusiasts. It's 100% free, no registration required.

I have a design which expects a TTL level square wave from a radio reciever which is fed into a microcontroller. There is some TTL level noise as no encoding is done on the transmit end. I was wondering if anyone had any pointers on how you could decrease the noise in software? (I understand there are a number of hardware solutions, but I am interested more in learning) I am not looking for anyone to solve my problem for me, just for some advice.

Names/articles/topics would be great!

share|improve this question
1  
When you say 'TTL level noise', do you mean that the signal is staying well out of the TTL forbidden zone, that it's just toggling unexpectedly? If so, is it isolated spikes, or like switch bounce? Or is the signal spending time wandering around between 0.8 and 2.4? The solution will depend on the kind of noise. – JustJeff May 6 '10 at 22:28
I am talking about isolated spikes from 0-5V and back that occur randomly but potentially quite often (up to 25% of the signal) – penjuin May 7 '10 at 8:43
So you're expecting a pure square wave, but there are also glitches in the signal that are much shorter in duration than the expected period of the square wave? – endolith May 8 '10 at 16:38
that is correct – penjuin May 9 '10 at 20:26

5 Answers

There are many ways to work with noise in software, and they are becoming more and more effective to implement in software instead of hardware, reducing system cost.

Instead of attempting to explain it myself, I am going to pass you on to Jack Ganssle, an embedded systems consultant that I have grown from reading the articles of.

He has a listing of his articles online, the first one I would like you to is about analog noise in embedded systems. The second article I have to link you to is about using software to reduce noise in your system.

I would also suggest his article in smoothing digital inputs and self calibrating systems. After spending time working with embedded systems I hard picked up some of this information from my own errors, but I really enjoyed reading his ways of thinking. The self calibrating system was very obvious to me, but the way he suggested going about it was valuable to me. You may not need the information, but his articles have helped me.

share|improve this answer

I've found Digital Signal Processing and the Microcontroller by Grover and Deller to be the only book on filters that I can understand. Unfortunately, it's hard to find cheap.

http://www.google.com/books?id=GzVmQgAACAAJ

share|improve this answer
1  
I will see if I can get a desk copy, the reviews seem good! – Kortuk May 6 '10 at 12:52
Not very relevant to the original question IMHO. OTOH you may want to try dspguide.com . It is available as a free PDF download but I proudly own a copy. It is really great for learning DSP. – jpc May 8 '10 at 21:50

Perhaps the "noise" is a problem caused by the lack of encoding. Simple transmitters and receivers require NRZ - Manchester code is often used.

share|improve this answer
I am certain that these transmitters do not use any encoding mechanisms and I am not able to modify the transmitter, hence my problem. – penjuin May 6 '10 at 20:16
You need to add encoding, then, if NRZ is required. – Leon Heller May 6 '10 at 20:30
2  
unfortunately I cannot add or change anything on the transmit end so there is no way to add encoding – penjuin May 7 '10 at 8:42
You encode the data before it is input to the transmitter. – Leon Heller May 7 '10 at 12:33
He specified that he could not change how the transmission was done, I think that implies Penjuin cannot change the data being sent to it. – Kortuk May 14 '10 at 21:00
show 1 more comment

From your latest comment, I would suggest oversampling the input. Record several consecutive samples, and then your output should be whatever the majority of the recorded samples are.

For instance, say you record 10 samples. If you get a noise spike, only one or two of the samples will be corrupted, while the majority of them are the correct value. If you get actual data, then eventually the 1s will outnumber the 0s and the output will change.

share|improve this answer

Does your software poll this input, or do you use an interrupt scheme to process it?

If you're polling, presumably you read the input at a much higher rate than the expected changes in the signal. If the noise is well separated, very high frequency spikes, these would then look like isolated samples of the 'wrong' polarity. You could mitigate this by keeping the most recent N samples and deciding to read the input as whichever polarity is in the majority. I.e., if N=5, then if you have 3, 4 or 5 '1' bits, your input is a '1'; if you have 0, 1, or 2 '1' bits, your input is a '0'. This is really just a sort of low-pass filter in software.

If you are using the input to trigger interrupts on change (both edges), you can have the interrupt routine (ISR) start a timer to cause a second interrupt a short time later, but longer than the noise spike time. Rather than have the input pin ISR directly accumulate signal bits, you have the timer ISR do it. For example, if the signal is low, and a high spike comes along, the rising edge start the timer, but before the timer count expires, the falling edge of the spike resets it, so when the timer interrupt finally does go off, you're looking at the signal, not the noise. The signal, on the other hand, will kick off the timer just once, and the timer ISR will be able to grab the new signal level.

Of these two, Polled vs Interrupt, personally I'd go for the polled approach, b/c (1) interrupts are just more complicated, and (2) a pathologically placed pair of spikes could still give you false input.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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