View previous topic :: View next topic |
Author |
Message |
davidbue
Joined: 05 Nov 2007 Posts: 28 Location: Denmark
|
Encoder signal noise problem |
Posted: Tue Nov 11, 2008 5:14 pm |
|
|
Good evening.
I'm working on a little project involving an engine and a 2-channel encoder.
I supply the encoder with a 5-volt regulated supply, as well as a common ground with my pic18f2220.
The encoder outputs a 2-channel square signal, one Z-pulse pr. revolution and a pulse-train for each 1/2 degree of rotation.
When I study the encoder signal with a scope, it looks nice and crisp. -My 18f2220 seems to trigger on the signal easily.
When I then use a timing-gun (strobe light gun that is timed from the fuel injector of the engine) I get a lot of false triggers on the Z-pulse signal on my microcontroller.
I can see some added background noise on the scope on the Z-pulse signal when I turn on the timing gun. It's high frequency, below 1 volt, and in very sharp peaks.
Could this voltage (roughly 1 volt) be enough for the microcontroller to see the input pin as being high?
If yes, any idea how to clean/shape the signal before I input it to the microcontroller?
Best regards
David |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
![](templates/subSilver/images/spacer.gif) |
SherpaDoug
Joined: 07 Sep 2003 Posts: 1640 Location: Cape Cod Mass USA
|
|
Posted: Tue Nov 11, 2008 6:30 pm |
|
|
The strobe light has a flyback type high voltage power supply to power the flash tube. This is generating the noise you see.
I would guess the Z signal is pulled to ground when active and left floating the rest of the time. When it is floating it is especially susceptable to the EMI from the flyback strobe supply. Your other signals are probably driver both high and low and never float, so they are less susceptible to EMI.
The EMI signal looks like it has only 1 volt peaks, but being very sharp they may be higher than the scope shows. If it is a 100MHz spike and you look at it with a 60MHz scope with a 25MHz probe you will see a lot less amplitude than is really there.
First try wrapping the strobe with grounded tin foil. Then if the Z line has a pull-up resistor try to use as low value a resistor as allowed, maybe 50 or 100 Ohms. If that doesn't help, add a series resistor close to the PIC (maybe 100 Ohms) and a small cap from the PIC input pin to the PIC ground pin. These components make an RC network. If the RC constant is too long they will slow your Z signal. See how fast you need the Z signal to be and select the cap to make the RC network about 10X as fast.
Filtering is a science, but those techniques should solve most problems. _________________ The search for better is endless. Instead simply find very good and get the job done. |
|
![](templates/subSilver/images/spacer.gif) |
davidbue
Joined: 05 Nov 2007 Posts: 28 Location: Denmark
|
|
Posted: Thu Nov 13, 2008 1:51 pm |
|
|
Thank you very much you guys! Adding a lowpass filter solved my problem! |
|
![](templates/subSilver/images/spacer.gif) |
|