A magnetic sensor fault can look like a big machine problem.
Cylinder not moving. PLC input missing. Machine stuck halfway through a sequence. Operator says, “It was working yesterday.” Maintenance opens the panel and, of course, everything looks normal. The sensor LED may even be blinking at you like it has done nothing wrong.
Classic.
Magnetic sensors and cylinder sensors are usually simple devices, but when they fail — or when the magnet, wiring, PLC input, or mounting position causes trouble — the symptoms can be annoying. The good news is that most faults can be found with basic tools and a logical testing process.
No magic needed. Just don’t guess too much.
What Magnetic and Cylinder Sensors Do
Magnetic sensors detect a magnetic field, usually from a permanent magnet. When the magnet comes close enough, the sensor changes its output signal.
Cylinder sensors work in almost the same way. The piston inside a pneumatic or hydraulic cylinder has a built-in magnet. When the piston reaches the sensor position, the sensor detects the magnetic field and sends a signal to the PLC or controller.
In a machine, this signal is often used to confirm:
- Cylinder extended
- Cylinder retracted
- Piston in middle position
- Tank float position
- Door or cover position
- Object position with magnet detection
So when the sensor signal is wrong, the machine may stop, wait, alarm, or repeat a movement that it really should not repeat.
Common Symptoms of Magnetic Sensor Problems
Magnetic sensor faults usually show up in a few familiar ways.
The sensor may not switch at all. The PLC input stays off even when the magnet is in front of the sensor. Sometimes the opposite happens: the input stays on all the time. Even more irritating is the intermittent fault, where the signal comes and goes depending on vibration, cylinder speed, cable movement, or temperature.
You may also see a sensor LED switching correctly, but the PLC input does not change. That one is sneaky because it makes the sensor look good at first glance, while the real issue may be wiring, input card type, voltage level, or a broken conductor.
Another common case is poor cylinder positioning. The cylinder reaches the end, but the sensor does not detect the piston magnet because it is mounted slightly too far away or in the wrong place. A few millimeters can matter. It sounds silly, but it happens all the time.
Tools Needed for Diagnosis
You do not need a laboratory to diagnose most magnetic and cylinder sensor faults. A small set of basic tools is usually enough.
Useful tools include:
- Digital multimeter
- Wiring diagram or electrical drawing
- Small permanent test magnet
- PLC input monitor or online PLC diagnostics
- Sensor tester, if available
- Screwdriver or Allen key for sensor adjustment
- Spare known-good sensor
- Oscilloscope, optional for fast or unstable signals
- Insulation tester, only for cable checks and only when the sensor/electronics are disconnected
- Contact cleaner and basic hand tools
The most important tool is still the multimeter. Boring, yes. But it tells the truth, most of the time.
Safety First
Before measuring anything, check what voltage the sensor uses. Most industrial magnetic sensors are 10–30 V DC, often connected to 24 V DC systems. But do not assume. Always check the label or machine documentation.
Also, do not test electronic sensors with resistance mode while they are powered. Resistance mode is for unpowered components. For live sensors, use DC voltage measurement.
If you are working near moving cylinders, be careful. A pneumatic cylinder can move quickly if the machine suddenly gets a signal. Keep fingers away from pinch points. Sounds obvious, but obvious things are usually what bite people.
Step 1: Check the Sensor Type
Before you measure, identify what type of sensor you are dealing with.
Common types are:
- PNP normally open
- PNP normally closed
- NPN normally open
- NPN normally closed
- Reed switch sensor
- Two-wire electronic sensor
- Three-wire electronic sensor
This matters because a “good” output reading depends on the sensor type.
For example, a PNP sensor sends positive voltage to the PLC input when active. An NPN sensor pulls the input down to 0 V when active. A reed switch works more like a simple contact.
If you mix these up, you can easily think the sensor is bad when actually your measurement logic is wrong.
Been there. Not fun.
Step 2: Visual Inspection
Start with the simple stuff. It feels too basic, but it saves time.
Check the sensor body. Look for cracks, crushed plastic, oil contamination, water inside the connector, broken mounting clips, loose screws, damaged cables, or a sensor that has slid out of position.
On cylinder sensors, check whether the sensor is still properly seated in the cylinder slot. Vibration can move sensors if they are not tightened properly. Some tiny sensors are held by small screws, and when they loosen, the switching point moves just enough to create random machine stops.
Also check the connector. M8 and M12 connectors can look connected while not fully tightened. A half-loose connector can give you a fault that appears once every 20 cycles, just to ruin your day.
Step 3: Check Supply Voltage
For most three-wire DC sensors, measure between brown and blue wires.
Usually:
- Brown = +24 V DC
- Blue = 0 V DC
- Black = output signal
A good reading is normally close to the machine supply voltage. In a 24 V DC system, you usually want to see around 22–24 V DC between brown and blue.
A bad reading would be:
- 0 V DC
- Very low voltage, for example 5 V or 10 V on a 24 V system
- Voltage that drops when the sensor switches
- Unstable voltage jumping up and down
If there is no supply voltage, do not blame the sensor yet. Check the fuse, terminal block, cable, connector, power supply, safety circuit, or IO module supply.
No power, no signal. Simple as that.
Step 4: Check the Sensor LED
Most cylinder sensors and magnetic proximity sensors have a small LED. This LED usually lights when the sensor detects the magnet.
Move the magnet or cylinder piston into the sensing area and watch the LED.
Good result:
- LED turns on and off clearly
- LED changes state at the expected piston position
- LED does not flicker when the cylinder is stationary
Bad result:
- LED never turns on
- LED stays on all the time
- LED flickers near the switching point
- LED works only when the cable is moved
- LED switches, but not at the correct piston position
If the LED flickers, the sensor may be mounted at the edge of the magnetic field. Move it slightly closer to the correct switching point. On cylinder sensors, loosen the screw, slide the sensor slowly along the cylinder slot, and find the strongest, most stable switching position.
Do it slowly. Not like you are tuning a radio in 1987, but close enough.
Step 5: Test With a Separate Magnet
A small test magnet is very useful. Bring it close to the sensing face of the magnetic sensor.
If the sensor switches with your test magnet, but not with the machine magnet, the sensor may be okay. The problem may be:
- Weak magnet
- Magnet too far away
- Wrong alignment
- Ferromagnetic material blocking or disturbing the field
- Cylinder piston magnet damaged or too weak
- Tank float magnet not reaching the sensing point
If the sensor does not react to a known-good magnet, while supply voltage is correct, then the sensor itself may be faulty.
This is one of the fastest checks. Very simple, very effective.
Step 6: Measure the Output Signal
Now measure the output wire.
For a common three-wire PNP sensor, measure between black and blue.
When the sensor is OFF, you should usually see around 0 V DC.
When the sensor is ON, you should usually see close to supply voltage, for example 22–24 V DC in a 24 V system.
Good PNP readings:
| Sensor State | Expected Output |
|---|---|
| OFF | 0 V DC or very close to 0 V |
| ON | Around 22–24 V DC |
Bad PNP readings:
| Reading | Possible Problem |
| Always 0 V | Sensor not detecting, no supply, broken output, wrong wiring |
| Always 24 V | Sensor stuck on, wrong sensor type, shorted output |
| 5–15 V unstable | Bad connection, overload, damaged output, input mismatch |
| LED on but output 0 V | Sensor output failed or wrong wire measured |
For an NPN sensor, the logic is different. Measure carefully according to the circuit. An NPN sensor usually pulls the output to 0 V when active. Depending on the PLC input wiring, you may see voltage when inactive and near 0 V when active.
Good NPN behavior usually looks like this:
| Sensor State | Expected Output Behavior |
| OFF | Output not pulled low, input may sit high through load/input |
| ON | Output pulled close to 0 V DC |
Bad NPN readings:
| Reading | Possible Problem |
| Never pulls to 0 V | Sensor not detecting, damaged output, wrong wiring |
| Always near 0 V | Output shorted, sensor stuck on, cable short |
| Floating/random voltage | Missing load, wrong input type, broken wire |
For reed switch sensors, the output behaves like a contact. With power off and wires disconnected, you can test continuity.
Good reed switch reading:
| Magnet Position | Expected Resistance |
| Magnet away | Open circuit / OL |
| Magnet present | Very low resistance, often under 1–2 Ω |
Bad reed switch reading:
| Reading | Possible Problem |
| Always open | Reed contact failed, magnet too weak, wrong position |
| Always closed | Reed contact welded/stuck |
| Resistance high or unstable | Worn contact, damaged cable, poor connection |
Do not confuse electronic sensors with reed switches. A reed switch can be tested like a simple contact. An electronic sensor usually cannot be judged properly with only resistance mode.
Step 7: Compare Sensor Output With PLC Input
This is where many people get tricked.
The sensor may be switching correctly, but the PLC input may not see the signal. So check both sides.
First, measure the sensor output at the sensor connector. Then measure the same signal at the PLC input terminal.
Good result:
- Sensor output changes correctly at the sensor
- Same voltage change appears at the PLC input
- PLC input LED or online monitor changes state
Bad result:
- Sensor output changes, but PLC input voltage does not
- Voltage reaches the PLC terminal, but PLC input LED does not turn on
- PLC input changes physically, but program status does not match
- Signal disappears between sensor and panel
If the signal is good at the sensor but missing at the panel, suspect the cable, connector, terminal block, junction box, or broken wire.
If the voltage is present at the PLC input but the PLC does not show the input, check:
- Wrong input common wiring
- Wrong sensor type for the input card
- Damaged PLC input channel
- Input card supply missing
- Wrong PLC address
- Program logic using another input
- Safety PLC or remote IO communication problem
Sometimes the electrical signal is fine, but the program is looking at a different address. That is not a sensor fault. That is a “who changed the program?” moment.
Step 8: Check Mounting Position on Cylinder Sensors
Cylinder sensors are very sensitive to position. If the sensor is mounted too far from the piston magnet, the signal can become weak or intermittent.
To adjust the sensor:
- Move the cylinder to the position you want to detect.
- Loosen the sensor fixing screw.
- Slide the sensor slowly along the cylinder slot.
- Watch the LED.
- Find the point where the LED switches reliably.
- Move slightly into the stable switching area, not right on the edge.
- Tighten the sensor carefully.
- Cycle the cylinder several times and confirm the PLC input.
Good adjustment:
- Sensor switches at the same position every cycle
- LED is stable
- PLC input does not flicker
- Cylinder end position is confirmed reliably
Bad adjustment:
- Sensor only switches sometimes
- LED flickers when cylinder is stopped
- Sensor switches too early or too late
- Signal disappears when machine vibrates
- Sensor moves after tightening
Do not mount the sensor exactly at the weakest switching edge. That is asking for intermittent faults later.
Step 9: Check the Magnet and Material Around It
Magnetic sensors depend on the magnetic field. If something interferes with that field, the sensor may not work correctly.
Possible problems include:
- Magnet missing
- Magnet installed too far away
- Magnet installed in the wrong position
- Weak or damaged magnet
- Thick tank wall
- Ferromagnetic metal between sensor and magnet
- Strong nearby magnetic fields
- Sensor mounted near steel brackets that distort the field
Magnetic fields can pass through many non-ferromagnetic materials such as plastic, aluminum, glass, and some stainless steels. But normal steel can disturb the field badly.
Good installation:
- Magnet passes close to the sensor
- Barrier material is non-ferromagnetic
- Distance is within sensor range
- Sensor switches clearly and repeatedly
Bad installation:
- Magnet is too far away
- Sensor is mounted behind thick steel
- Magnet only triggers sensor at one tiny position
- Signal changes when metal parts are moved nearby
For tank applications, always check wall material and wall thickness. A sensor that works on a plastic tank may not work the same way on a steel tank. Obvious after you know it. Expensive before you know it.
Step 10: Wiggle Test the Cable
Cable faults are common, especially on moving machine parts.
With the machine in a safe state, activate the sensor and gently move the cable near the connector, cable gland, and bend points. Watch the sensor LED, multimeter, and PLC input.
Good result:
- Signal stays stable while cable is moved
Bad result:
- Signal drops out
- LED flickers
- PLC input turns on and off
- Voltage jumps around
If the signal changes when the cable moves, suspect a broken conductor, damaged connector, loose pin, crushed cable, or oil/water inside the connector.
Do not ignore this. A cable fault can imitate a sensor fault perfectly.
Step 11: Check for Output Overload or Short Circuit
Electronic sensor outputs can be damaged by overloads, wrong wiring, or short circuits.
If the sensor supply is correct and the LED works, but the output voltage is weak or strange, disconnect the output from the PLC input and test again if it is safe to do so. Sometimes a faulty PLC input or shorted cable pulls the sensor output down.
Possible signs of overload:
- Output voltage lower than expected
- Sensor gets warm
- Power supply voltage drops
- Sensor works when disconnected from load
- Sensor fails again when connected to PLC input
Good output should switch cleanly between its OFF and ON states.
Bad output may sit somewhere in the middle, like 8 V, 12 V, or random jumping voltage. That is not a healthy digital signal.
Good and Bad Readings Summary
Here is a practical quick-reference table.
| Test Point | Good Reading | Bad Reading |
| Sensor supply, brown to blue | Around 22–24 V DC on a 24 V system | 0 V, low voltage, unstable voltage |
| PNP output OFF | Around 0 V DC | High voltage when it should be off |
| PNP output ON | Around 22–24 V DC | 0 V, weak voltage, unstable voltage |
| NPN output ON | Close to 0 V DC | Does not pull low |
| Reed sensor OFF | Open circuit / OL | Closed circuit when magnet is away |
| Reed sensor ON | Very low resistance | Open circuit with magnet present |
| Sensor LED | Clear ON/OFF switching | Flickering, always on, always off |
| PLC input voltage | Matches sensor output | Signal lost before PLC |
| PLC input status | Changes with sensor | No change despite correct voltage |
| Cable movement test | Signal stable | Signal flickers or drops |
These readings can vary depending on sensor model and wiring, but the basic idea stays the same: a digital sensor output should switch clearly. Not half-way. Not sometimes. Clearly.
Common Faults and Likely Causes
| Symptom | Likely Cause |
| Sensor LED off all the time | No supply, wrong position, weak magnet, faulty sensor |
| Sensor LED on all the time | Sensor stuck, magnet always nearby, wrong mounting position |
| LED switches but PLC input does not | Wiring fault, wrong input type, damaged PLC input |
| PLC input flickers | Sensor on edge of magnetic field, vibration, cable damage |
| Sensor works with test magnet but not in machine | Machine magnet too weak, too far, blocked by material |
| Sensor works only when cable is moved | Broken cable or bad connector |
| Cylinder end signal missing | Sensor position wrong, piston magnet weak, sensor too far from slot |
| Signal appears too early or too late | Sensor needs mechanical adjustment |
| New sensor does not work | Wrong PNP/NPN type, wrong NO/NC type, wiring mismatch |
When the Sensor Is Actually Good
Not every sensor fault is a sensor fault.
A magnetic sensor may be perfectly fine, but the real issue may be elsewhere. Maybe the cylinder is not reaching the end position because of low air pressure. Maybe a mechanical stopper moved. Maybe the piston seal is leaking. Maybe the PLC logic requires two signals at once. Maybe the input common wire is missing.
So do not replace three sensors in a row and then discover the cylinder never reached the magnet position. That one hurts the ego a bit.
Before replacing the sensor, confirm:
- Supply voltage is correct
- Sensor detects a test magnet
- Output signal changes properly
- Signal reaches the PLC input
- PLC input status changes
- Cylinder or magnet physically reaches the detection point
If all of that is true, the sensor is probably not the main problem.
Final Checklist for Diagnosing Magnetic and Cylinder Sensors
Use this checklist when troubleshooting:
- Identify the sensor type: PNP, NPN, reed, NO, NC, two-wire, or three-wire.
- Inspect the sensor, connector, cable, and mounting.
- Measure supply voltage.
- Check the sensor LED.
- Test with a known magnet.
- Measure output voltage or continuity.
- Compare the signal at the sensor and at the PLC input.
- Check PLC input status online.
- Adjust cylinder sensor position.
- Check for cable faults with a gentle movement test.
- Verify magnet position, distance, and surrounding material.
- Replace the sensor only after confirming the basics.
Final Thoughts
Magnetic and cylinder sensors are small parts, but they can stop a whole machine when the signal is missing. The trick is not to jump straight to replacing the sensor. Start with voltage. Check the LED. Use a test magnet. Measure the output. Then follow the signal all the way to the PLC.
Most faults are not mysterious. They are usually one of these: no power, bad cable, wrong sensor type, poor adjustment, weak magnet, or a PLC input/wiring mismatch.
Simple, but not always obvious in the moment.
And that is the real job of troubleshooting — slowing down enough to catch the boring problem before it turns into a long, expensive circus.
