Noise - Typical Problems and Resolutions
What is Noise?
Noise, as it pertains to electronics, is an undesired random fluctuation in an electrical signal. It can be related to random input readings, grounding issues, communication problems, and even motor disturbances. As an example, limit switch signals can experience random fluctuations due to noise thus causing the control algorithm to think the machine has reached a limit and stop the machine at random times.
What are Common Causes of Noise?
Noise can be caused by environmental electromagnetic disturbances emanating from other machines and equipment. It can also be caused by improperly grounded wires and equipment.
A Ground Loop refers to a topological situation with grounds where there are multiple possible paths for ground currents to flow. A "Star" topology avoids ground loops by providing only one possible path for current to flow (to the center of the "Star"). When ground loops are present currents can take undesirable and sometime unexpected paths. Because of parasitic resistance or inductance between ground points, the currents can cause undesirable voltages to appear between nodes that were expected to be the same or at zero volts. Voltage shifts on ground reference nodes can cause signals to appear to be at false levels or if extreme may even damage circuits.
Here is an example of creating a ground loop by adding an earth ground
KFLOP internally connects the USB shield to its DC Gnd as shown above.
Many PC Power Supplies connect DC Gnd to Earth Gnd internally as shown above.
USB Isolators can be used to eliminate GND connections between the PC and KFLOP
Olimex makes a low cost (~$40 USD) usb isolator that works well.
Using KFLOP Input Filters to Deal with Noise
KFLOP inputs are very fast and therefore susceptible to narrow noise glitches. KFLOP doesn't have selectable digital filtering. It is usually best to fix the source of the noise problem in hardware. Otherwise you might reduce the frequency of the problem but not eliminate it entirely. You might add a Filter Capacitor (such as a 0.1uf ceramic capacitor) from the KFLOP input pin to the KFLOP GND (in very close proximity to KFLOP).
To filter the inputs in software you can do so with a User Program that samples the input, performs some filtering algorithm, and sets/clears a KFLOP Virtual I/O Bit (ie bits 48-63) based on the result. Then configure the KFLOP Axis to monitor the Virtual Inputs rather than the real inputs. The ExternalButtons.c example shows how multiple inputs can be monitored and debounced using a single non-blocking loop using a state driven approach. See the Debounce() function, how it's used, and the 3 global variables needed for every input to keep track of the states of the input.
Other Common Methods of Dealing with Noise
- Ensure cables are properly shielded and that the electronics are properly grounded
- You will want understand whether the I/O in question is isolated or not as this could affect how you diagnose and solve noise issues. Isolated I/O are less susceptible to systemic grounding and noise problems, whereas non-isolated I/O could be affected by grounding issues elsewhere in the system. Therefore, isolated I/O should be easier to diagnose and protect from noise.