Noise - Typical Problems and Resolutions
From Dynomotion
Contents
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.
Ground Loops
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.
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 Cables
To reduce USB noise problems high quality USB cables should be used.
The cable should be as short as possible and routed away from other noisy cables and devices.
The cable should contain a shield that has a resistance of < 1ohm from shell end to shell end
The cable should have ferrite chokes on each end as shown below.
USB Isolators
USB Isolators can be used to eliminate GND connections between the PC and KFLOP. KFLOP Uses USB Full Speed mode (12 MBits/sec)
Olimex makes a low cost (~$40 USD) usb isolator that works well.
https://www.olimex.com/Products/USB-Modules/USB-ISO/
It is also reported that this works well using Windows 10 or Windows 8.1
(USB Isolator ADUM4160)
SMAKN USB Isolator (commonly available on Amazon)Uses Chip ADUM4160BRWZ
This was reported to work well 1500V ADUM4160 Digital Signal Audio Isolator USB to USB Audio Signal Isolator 12Mbps 1.5Mbps Adum3160
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.
Differential Encoder Input Noise
You might try moving manually with all motor supplies off to see if the encoder position still accumulates counts. That would provide clues whether it is noise or something about the way the Drive outputs signals.
You might try lots of short direction reversals to try to determine if it could be a lost count on each or most reversals.
You might check the A+ A- B+ B- voltage levels at Kanalog. They should all toggle between about 0.5V and 3V. Sometimes they operate marginally correct with a broken wire and floating signal.
Use shielded, twisted pair, cables. The + and - complementary signals should be on a twisted pair of wires. Connect the shield to Kanalog GND in order to keep the signals quiet with respect to the Inputs on Kanalog. Make sure only the Kanalog end of the shield is connected in order to avoid any possibility of ground currents flowing through the shield. Do not connect other noisy shields such as Motor Wiring Shields to Kanalog GND. Instead connect those to Earth GND away from Kanalog.
It is not usually recommended to connect Kanalog GND to Earth GND. Note the GND Lug holes in Kanalog are connected to Kanalog GND. The other mounting holes are isolated.
Kanalog has only moderate termination on the encoder inputs of 470 ohms. Ideally the Termination for twisted pair wiring should be ~120 ohms. Resistive termination can attenuate noise and reduce signal edge reflections and ringing. So you might consider paralleling 160~200 ohms across each + to - input. SnapAmp has no built in resistive termination.
KFLOP has digital filtering to reject noise glitches. KFLOP samples the A B signals at 16.67 MHz and requires them to be stable for 7 samples (by default) before considering the signal to have a valid new changed state. 7 samples = 0.42us. You might try increasing the filter value. Numbers higher than 14 will start reducing the max count rate below 1Mhz. The setting is global to all Encoders and can be changed by executing the statement below with the number 7 changed to a larger value (255 max):
FPGAW(ENC_NOISE_FILTER_ADD)=7;
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.