You have spent weeks perfecting your sensor circuit — carefully selecting components, calibrating readings, and writing robust firmware — only to find that turning on a nearby motor, relay, or switching power supply sends your readings haywire. Electromagnetic Interference (EMI) is the silent saboteur of electronics projects, and sensors are among its most vulnerable victims.
Understanding and mitigating electromagnetic interference in sensor circuits separates professional-grade electronics from unreliable prototypes. In this comprehensive guide, we explain the sources of EMI, how it couples into sensor circuits, and every practical technique you can apply — from PCB layout strategies and shielding to software filtering and proper grounding — to achieve noise-free sensor measurements.
1. What Is Electromagnetic Interference?
Electromagnetic Interference (EMI) refers to disturbances in the electromagnetic field that disrupt the operation of electronic equipment. Also called Radio Frequency Interference (RFI) in higher-frequency contexts, EMI is broadly categorised into two types:
Conducted EMI
Noise that travels through physical conductors — power lines, ground connections, and signal cables. When a noisy device (such as a motor controller or switching power supply) shares a power rail or ground with a sensor, conducted EMI can directly corrupt the sensor’s supply voltage or reference, leading to measurement errors.
Radiated EMI
Noise that propagates through space as electromagnetic waves and induces voltages in nearby conductors through capacitive or inductive coupling. Long sensor wires act as antennas, picking up radiated EMI from nearby sources. High-frequency switching circuits, motors, and wireless transmitters are prolific sources of radiated EMI.
2. Common EMI Sources in Maker Projects
Understanding where EMI comes from in typical Arduino, ESP32, and Raspberry Pi projects is the first step to eliminating it.
DC Motors and Brushed Motor Controllers
Brushed DC motors generate significant EMI from the sparking between the brushes and commutator rings. Each spark is essentially a broadband RF pulse. Motor controllers (H-bridges, BTS7960, L298N) that switch high currents at high frequencies generate substantial conducted and radiated EMI. This is one of the most common causes of sensor corruption in robotics projects.
Switching Power Supplies (SMPS)
Switch-mode power supplies chop voltage at frequencies from 50 kHz to several MHz. This high-frequency switching generates conducted noise on both input and output rails, as well as radiated EMI. Cheap SMPS modules (buck converters, boost converters) with poor filtering are especially problematic.
Relays and Solenoids
When a relay or solenoid coil is de-energised, the sudden collapse of its magnetic field generates a large voltage spike (flyback voltage) that can be hundreds of volts for a 12V coil. This spike propagates through ground and power connections to nearby electronics.
High-Frequency Clocks and Microcontrollers
Even the microcontroller itself generates EMI. The 16 MHz clock on an Arduino Uno and its harmonics can interfere with analogue sensors connected nearby. ESP32 and ESP8266 Wi-Fi transceivers operating at 2.4 GHz are particularly impactful on RF-sensitive sensors.
Servo Motors
Servo motors are controlled by PWM signals and contain small DC motors — combining the EMI of both. The rapid current changes during servo movement create magnetic fields that induce noise in nearby analogue sensing circuits.
3. How EMI Couples into Sensor Circuits
Capacitive (Electric) Coupling
Two conductors separated by insulation form a capacitor. High-voltage, high-frequency signals on one conductor (the aggressor) can drive current through this parasitic capacitance into an adjacent conductor (the victim). Long parallel wires running near motor drive cables are particularly vulnerable. The coupled noise voltage increases with frequency and conductor length.
Inductive (Magnetic) Coupling
A changing current in one conductor creates a changing magnetic field. If a sensor wire loop is in this field, a voltage is induced in the loop (Faraday’s law). The induced voltage is proportional to the rate of change of the magnetic field (dB/dt) and the area of the victim loop. This is why twisted pair cables are effective — twisting reduces the net loop area to near zero.
Common-Impedance (Ground) Coupling
Multiple devices sharing a ground connection are coupled through the impedance of the shared ground path. A motor drawing 2A through a 100 mΩ shared ground trace drops 200 mV — enough to corrupt a 3.3V sensor’s reference. This is why star grounding (each device has its own path to the central ground point) is preferred over daisy-chain grounding.
Radiated Coupling
Electromagnetic waves propagating from an antenna or unintentional radiator (long wire, loop) induce voltages in any conductive structure in the field. This is frequency-dependent — higher frequencies couple more easily into smaller structures.
4. Identifying EMI in Your Sensor Data
Before applying fixes, confirm that EMI is actually the problem:
- Noise correlates with other activity: Readings degrade when a motor runs, relay clicks, or Wi-Fi transmits
- Periodic noise at specific frequency: Use Arduino’s ADC to log data at high speed and FFT it — identify the noise frequency
- Noise disappears with spatial separation: Moving the sensor far from the source eliminates the problem
- Noise disappears with powered source off: Turning off the suspected source eliminates noise
- Noise reduces with shielding: Wrapping sensor wires in foil reduces noise — confirms radiated coupling
5. Proper Grounding Strategies
Grounding is the single most impactful factor in EMI management. Poor grounding causes most of the EMI problems in hobbyist and intermediate-level projects.
Star Grounding
In star grounding, each power-consuming subsystem has its own ground return path that connects at a single central point — the star point. The high-current motor grounds are completely separated from the sensitive analogue sensor grounds, meeting only at the star point near the power supply. This prevents motor return currents from flowing through sensor ground paths.
Ground Plane Pours
On a PCB, a solid copper ground plane on the bottom layer dramatically reduces ground impedance and provides a reference plane for controlled signal propagation. Every component should connect to the ground plane via a short, direct via rather than a long trace.
Split Ground Planes
For mixed-signal designs (digital + analogue), a split ground plane separates analogue and digital grounds, connecting them at a single point (the ADC’s AGND/DGND boundary). This prevents high-frequency digital switching currents from corrupting the analogue ground reference.
Practical Grounding for Breadboard Projects
- Use separate power supplies for digital and analogue subsystems where possible
- Return high-current loads (motors, relays) directly to the power supply, not through the breadboard ground rail
- Keep sensor GND and microcontroller GND connections at the same physical point
- Never route high-current traces near analogue sensor traces
6. Decoupling Capacitors: The First Line of Defence
Decoupling capacitors (also called bypass capacitors) filter high-frequency noise on the power supply rails. They are the most cost-effective, simplest EMI mitigation technique available.
How Decoupling Capacitors Work
A capacitor placed between VCC and GND near an IC provides a local charge reservoir. When the IC demands a sudden burst of current (e.g., during ADC conversion or digital output switching), the capacitor supplies it locally rather than drawing it through the power trace (which has inductance causing voltage drop spikes). The capacitor also presents a low impedance path to ground for high-frequency noise, shunting it away from the IC.
Capacitor Selection
- 100 nF ceramic (X5R/X7R): Decouples frequencies from ~100 kHz to ~50 MHz. Place as close as possible to every IC’s VCC pin — within 2-3 mm on a PCB
- 10 µF electrolytic or MLCC: Handles lower frequencies (1 kHz–1 MHz) and bulk charge storage for current surges
- 1 µF ceramic: Bridges the frequency gap between the two
The 3-capacitor approach: Place 100 nF + 1 µF + 10 µF in parallel at the power input of sensitive sensors and ADC ICs. This covers a wide frequency range from audio to RF.
20A Range Current Sensor Module ACS712
The ACS712 uses Hall-effect sensing for galvanically isolated current measurement — inherently immune to conducted EMI from the high-current circuit being measured.
7. PCB Layout Best Practices
When designing a custom PCB, layout decisions have a profound impact on EMI performance.
Keep Analogue and Digital Traces Separated
Route analogue sensor traces far from digital clock lines, PWM signals, and motor drive traces. On a 2-layer board, route analogue signals on one side and digital on the other, with a ground plane in between as a shield.
Minimise Loop Areas
Every closed loop of conductor is an antenna — both receiving and transmitting EMI. Keep signal traces and their return path (ground) as close together as possible to minimise the loop area. This is why microstrip over a ground plane is far better than point-to-point wiring.
90-Degree Corners — Truth and Myth
The old rule of avoiding 90-degree trace corners is largely a myth at frequencies below 1 GHz — the electrical difference is negligible. Rounded corners are fine for aesthetics but provide no meaningful EMI benefit in typical Arduino/ESP32 applications.
Guard Rings for Sensitive Analogue Inputs
A guard ring is a grounded copper ring surrounding a sensitive analogue trace. It intercepts capacitively coupled noise before it reaches the sensitive node. Used in precision ADC designs and high-sensitivity sensor inputs.
Via Stitching
On multilayer PCBs, via stitching (rows of vias connecting ground planes on different layers around the perimeter of the board and around critical signal areas) reduces ground impedance and shields signal traces from radiated EMI.
8. Physical EMI Shielding Techniques
Conductive Enclosures
A grounded metallic enclosure (Faraday cage) blocks both electric field (capacitive) coupling and, to a lesser extent, magnetic field coupling from reaching the enclosed circuit. Aluminium project boxes, tin enclosures, and grounded copper tape lining plastic enclosures all provide effective shielding.
Important: The enclosure is only effective if it is properly grounded. Floating (ungrounded) metal enclosures can actually concentrate and redirect EMI rather than shielding it.
EMI Shielding Tape
Conductive copper or aluminium self-adhesive tape is inexpensive and can be applied inside plastic enclosures, wrapped around sensor cables, and used to shield specific PCB areas. Connect the tape to ground for maximum effectiveness.
Ferrite Beads and Cores
Ferrite beads threaded onto cables or placed as SMD components in series with power and signal lines attenuate high-frequency noise. They present low impedance at DC and low frequencies but high impedance to RF — the EMI noise is absorbed as heat in the ferrite. Snap-on ferrite cores on USB cables, sensor cables, and motor wires are a quick, tool-free solution.
Mu-Metal for Magnetic Shielding
Mu-metal (a nickel-iron alloy) provides exceptional magnetic shielding for extremely sensitive sensors (magnetometers, Hall-effect sensors, some precision current sensors). Standard aluminium/copper shields are ineffective against low-frequency magnetic fields — mu-metal is required.
9. Analogue Signal Filtering
Hardware filters eliminate noise on analogue sensor signals before they reach the ADC.
RC Low-Pass Filter
A simple resistor-capacitor (RC) network placed at the ADC input filters high-frequency noise:
- Series resistor (R): 1 kΩ – 10 kΩ
- Shunt capacitor (C): 10 nF – 100 nF to GND
- Cutoff frequency: f_c = 1 / (2π × R × C)
Example: 10 kΩ + 10 nF = 1.59 kHz cutoff — passes slow-changing sensor signals, blocks motor switching noise above ~1 kHz.
Differential Measurement
Instead of measuring the sensor output relative to ground (single-ended), measure the difference between two signal lines. Common-mode noise (noise picked up equally on both lines) is rejected. This is why current-sensing ICs like the INA219 and professional measurement equipment use differential inputs.
Instrumentation Amplifiers
INA128, AD8221, and similar instrumentation amplifiers provide high common-mode rejection ratio (CMRR >80 dB) and low noise amplification for small sensor signals (thermocouples, Wheatstone bridges, load cells). They amplify the desired differential signal while rejecting common-mode noise.
10Kg Load Cell – Electronic Weighing Scale Sensor
Load cells output tiny millivolt signals from a Wheatstone bridge — extremely sensitive to EMI and requiring instrumentation amplifiers and proper shielding for accurate readings.
10. Software and Digital Filtering
When hardware mitigation is not enough, digital filtering in your Arduino/ESP32 firmware provides an additional layer of noise reduction.
Moving Average Filter
const int WINDOW_SIZE = 10;
float readings[WINDOW_SIZE];
int readIndex = 0;
float total = 0;
float movingAverage(float newReading) {
total -= readings[readIndex];
readings[readIndex] = newReading;
total += newReading;
readIndex = (readIndex + 1) % WINDOW_SIZE;
return total / WINDOW_SIZE;
}
void loop() {
float rawADC = analogRead(A0);
float smoothed = movingAverage(rawADC);
Serial.println(smoothed);
delay(10);
}
Median Filter (Best for Spike Noise)
A median filter is extremely effective against impulse noise (spikes) from relays and motor commutation. It takes N samples and returns the median value, completely rejecting extreme outliers:
float medianFilter(int pin, int samples) {
float values[samples];
for (int i = 0; i < samples; i++) {
values[i] = analogRead(pin);
delay(2);
}
// Simple bubble sort
for (int i = 0; i < samples - 1; i++)
for (int j = 0; j < samples - i - 1; j++)
if (values[j] > values[j+1]) {
float temp = values[j]; values[j] = values[j+1]; values[j+1] = temp;
}
return values[samples / 2];
}
void loop() {
float reading = medianFilter(A0, 7); // Take 7 samples, return median
Serial.println(reading);
delay(100);
}
Exponential Moving Average (EMA)
EMA applies more weight to recent samples while still smoothing noise. The alpha parameter controls the trade-off between responsiveness and smoothing:
float ema = 0;
const float ALPHA = 0.1; // 0.0 = fully smoothed, 1.0 = no smoothing
void loop() {
float raw = analogRead(A0);
ema = ALPHA * raw + (1.0 - ALPHA) * ema;
Serial.println(ema);
delay(10);
}
11. Cable Selection and Management
Twisted Pair Cable
Twisting the signal wire and its ground return wire together reduces inductive (magnetic) coupling by cancelling the magnetic fields from adjacent twist sections. Cat5 Ethernet cable (UTP) is an excellent, inexpensive source of twisted pairs for sensor runs up to 10 metres.
Shielded Cable
A metallic braid or foil surrounding the signal conductor blocks radiated EMI. The shield must be connected to ground at one end only (typically the receiving end, the microcontroller side) to prevent ground loops. Grounding both ends creates a ground loop that can actually introduce 50/60 Hz hum.
Cable Routing
- Route sensor cables and motor/power cables in separate cable runs, ideally at 90 degrees to each other where they must cross
- Keep sensor cables as short as possible
- Avoid running sensor cables parallel to PWM motor drive cables for more than a few centimetres
- Use ferrite snap-on cores at the entry point of any cable into the sensor enclosure
12. Sensor-Specific EMI Considerations
ADC-Based Sensors (Soil Moisture, Potentiometers, LDRs)
Analogue sensors feeding into Arduino ADC pins are most vulnerable to EMI. Apply a 10 kΩ series resistor + 100 nF capacitor RC filter at the ADC pin. Use analogRead() in multiples and average, or use the median filter approach.
I2C Sensors (BMP280, BME280, SCD40, INA219)
I2C is a digital protocol with reasonable EMI immunity, but long I2C lines (>30 cm) in noisy environments can cause communication errors. Add 100 Ω series resistors on SDA and SCL lines close to the master device — this provides damping without affecting functionality. Keep I2C clock at 100 kHz (standard mode) in noisy environments rather than 400 kHz.
Ultrasonic Sensors (HC-SR04, JSN-SR04T)
Ultrasonic sensors use high-voltage pulses on the TRIG line. Keep TRIG line away from sensitive analogue inputs. The ECHO line is particularly susceptible to noise causing false echo detection — add a 100 nF capacitor on VCC and a 1 kΩ + 100 nF filter on the ECHO line.
JSN-SR04T Waterproof Ultrasonic Rangefinder Module
The JSN-SR04T’s separated probe design means sensor electronics can be shielded while only the ultrasonic element is exposed — ideal for EMI-challenging environments.
PIR Motion Sensors
PIR sensors are analogue devices amplifying tiny pyroelectric signals from the sensor element. They are particularly vulnerable to RFI from nearby Wi-Fi and cellular transmitters, which can cause false triggers. Keep PIR sensors away from antennas, use shielded cable for any wiring runs, and add a 10 µF + 100 nF decoupling on the PIR module’s VCC.
B2X2 4 Elements Infrared Motion Analog PIR Sensor for Lighting
A 4-element PIR sensor with improved EMI rejection compared to single-element designs — the dual differential pyroelectric elements cancel common-mode interference.
Current Sensors (ACS712, INA219)
Current sensors measure tiny signals in the presence of large currents. The ACS712 uses Hall-effect sensing with galvanic isolation — the high-current path is completely isolated from the signal output, providing inherent immunity to conducted EMI from the power circuit. The INA219 uses a precision shunt resistor — keep the shunt connections short and use Kelvin (4-wire) sensing where precision is critical.
30A Range Current Sensor Module ACS712
Hall-effect galvanic isolation makes the ACS712 inherently resistant to conducted EMI — perfect for measuring motor current in noisy drive applications.
Frequently Asked Questions
Why does my sensor work fine alone but fail when I connect a relay?
When a relay coil de-energises, the collapsing magnetic field generates a large voltage spike (flyback) that travels through the shared power supply and ground connections to your sensor. The fix is a flyback diode (1N4007) connected in reverse bias across the relay coil — anode to the coil’s negative terminal, cathode to positive. This clamps the flyback spike to approximately 0.7V above supply voltage instead of hundreds of volts. Also add 100 nF decoupling capacitors on the sensor’s VCC pin.
How do I know if my problem is EMI or a software/hardware bug?
EMI is characterised by its correlation with external events (motor running, relay switching, Wi-Fi transmitting) and by its improvement when you physically separate or shield components. A software bug produces consistent, reproducible errors unrelated to the physical environment. Test by running the sensor in complete isolation from power circuits, long cable runs, and radio transmitters. If the sensor reads correctly in isolation, the problem is EMI. If errors persist in isolation, look for software bugs, incorrect calibration, or hardware faults.
Does wrapping sensor wires in aluminium foil help?
Yes, aluminium foil wrapped around sensor wires and connected to ground provides effective shielding against high-frequency electric field (capacitive) coupling. It is less effective against low-frequency magnetic field coupling. Make sure to connect only one end of the foil to ground to avoid creating a ground loop. Aluminium foil is a quick and inexpensive test — if it reduces your noise, invest in proper shielded cable for the permanent installation.
What is the best way to protect an analogue sensor connected to an Arduino near a motor?
Apply the following in order of impact: (1) Add flyback diodes across the motor and any relay coils. (2) Use separate power supplies for the motor and microcontroller/sensor circuit, or at minimum a dedicated LC filter on the sensor’s power rail. (3) Add 100 nF + 10 µF decoupling capacitors on the sensor’s VCC pin. (4) Place an RC low-pass filter (10 kΩ + 100 nF) at the ADC input pin. (5) Route sensor wires separately from motor wires. (6) Implement software median filtering. Applying all six typically reduces motor-induced noise from hundreds of ADC counts to under 5 counts.
Do EMI problems affect digital sensors like I2C and SPI devices?
Yes, but differently from analogue sensors. Digital protocol sensors are not affected by small amounts of noise — a 3.3V digital signal still reads correctly even with 200 mV of noise on it. However, severe EMI can cause communication errors: corrupted I2C packets (causing CRC errors or NACK responses), SPI bit errors, or bus lockup. The sensor’s internal ADC (before digital conversion) is still affected by EMI. Symptoms in digital sensors include intermittent NAN readings, occasional wrong values, and I2C timeout errors — not continuous noise like in analogue sensors.
Build Reliable, Noise-Free Sensor Systems
Find quality sensors, shielded cables, and all the components for professional-grade electronics projects at Zbotic — delivered fast across India.
Add comment