"I come home at night with my hands full and fumble forever for the stairway switch." "The corridor light stays on all night." The neatest solution is a motion sensor switch: when someone walks past, the light switches on by itself, and a while after they leave, it switches off by itself.
But lights that won't switch off, lights that come on by themselves in the middle of the night or LED lamps that flicker are common problems, and the cause is almost always the wrong type, the wrong wiring arrangement, the wrong location or the wrong knob settings.
This lesson belongs to the "Installing lighting circuits, switches & sockets" step. By the end of this lesson, you will be able to choose the right sensor type, wire both 2-wire and 3-wire sensors, choose the mounting location, adjust TIME, LUX and SENS, test the installation and fix common faults.
Safety first: All wiring work must be done after switching off the circuit breaker (MCB), hanging a warning tag and measuring to confirm the circuit is dead. A light that is off because of the sensor does not mean the light's wiring is de-energised. Review the 5 mandatory safety rules before touching any electrical wire before you start.
How does a motion sensor work?
Passive infrared (PIR) sensors
A PIR (passive infrared) sensor does not emit any beam; it "sees" heat radiation through a multi-segment lens that divides the space into many "zones". When a human body moves from one zone to another, the signal changes and the circuit switches the light on. It follows that:
A PIR sensor detects people walking across its field of view better than people walking straight towards it (walking straight cuts across fewer zones, so the light may come on late).
If someone sits still for a long time, the PIR treats the space as empty and the light switches off when the time runs out; PIR suits places people pass through, not places where they sit for long.
Changing heat sources cause false triggers: air-conditioning draughts, direct sunlight, incandescent lamps, water heaters. A PIR also cannot see through glass or obstacles.
Microwave (radar) sensors and combined types
A microwave sensor emits its own waves and measures the reflections: it is sensitive to small movements and can be fitted inside a light fitting, but the waves can pass through thin wooden doors, glass and plasterboard partitions, so it easily "sees" people in the next room, billowing curtains or rotating fans. Combined PIR + microwave sensors give fewer false triggers but cost more. For corridors, stairways, yards and gates in homes, PIR is usually the first choice because its detection area is easy to limit.
Choosing the sensor type
By mounting type
Switch-replacement type (flush-mounted): fits into the existing switch box, usually has an OFF/AUTO/ON slide switch, looks forward and has a short range.
Ceiling-mounted type (surface or recessed): looks downwards in a circular area.
Wall-mounted type on a swivel bracket: usually has a longer range, and many models have waterproof housings for outdoor use (check the IP rating).
Lights or lamp holders with a built-in sensor: quick, no extra wiring, but with few adjustments.

Figure 1. A sensor switch that replaces an ordinary switch: the PIR lens at the top, the indicator light and the OFF/AUTO/ON slide switch below. (Photo: Z22, Wikimedia Commons, CC BY-SA 4.0)

Figure 2. A round ceiling-mounted PIR sensor; the multi-segment lens in the centre lets it see the surrounding area. (Photo: Kent Madsen, Wikimedia Commons, CC BY-SA 4.0)
By wiring type: 3-wire or 2-wire
3-wire type (with neutral N): the terminals are usually marked L (incoming live), N (neutral) and L', L-out, LOAD or an arrow (switched live to the light). The sensor circuit takes its supply between L and N and doesn't "borrow" current through the lamp, so it is the preferred choice for LED lights.
2-wire type (no N needed): drops straight into the old switch position, with only the incoming live and the live to the light. To power itself, the sensor lets a very small current flow through the lamp even when it is off; incandescent lamps don't mind, but low-wattage LEDs may glow dimly or flash intermittently. Many manufacturers specify a minimum load or sell a load compensator to be connected in parallel with the light.
Old switch boxes often have no N. Before buying, open the box and look (after switching off the power); if there's no N and the light is LED, consider a 3-wire ceiling-mounted sensor at the light junction box, where N is usually available.
Read the specifications before buying
Check the operating voltage (suitable for the 220–230 V supply in Vietnam), the maximum load rating stated separately for incandescent lamps and for LEDs (the LED rating is usually much lower because LED drivers draw a large inrush current at switch-on), the detection angle, the range, the recommended mounting height (the real range is usually shorter than the figure on the box), the TIME and LUX adjustment ranges, and the IP rating for outdoor installations. If no LED rating is given, ask the seller or leave a generous margin.
Reference table: comparing sensor types
The figures are typical ranges, for reference only. Actual specifications vary by model; always follow the manufacturer's instructions.
Type | Typical mounting height (reference) | Detection area (reference) | Suitable for | Notes |
|---|---|---|---|---|
Switch-replacement PIR | Normal switch height | Fan-shaped area in front, a few metres | Ends of corridors, foot of stairs | Old boxes often lack N; easily blocked by doors or cabinets |
Ceiling-mounted PIR | About 2.5–3.5 m | Circular area below the sensor, a few metres in diameter | Halls, stair landings, garages | The lower it is mounted, the narrower the area |
Wall-mounted swivel PIR | About 1.8–2.5 m | Fan-shaped, some models over ten metres | Gates, yards, long corridors | Outdoors, choose a suitable IP rating; don't point it at the street |
Microwave (radar) | Per manufacturer, usually ceiling or inside the light | Wide, sensitive, can pass through thin partitions | Integrated lights, places needing high sensitivity | Reduce the range so it doesn't detect people in the next room |

Figure 3. Example diagram of the detection area of a sensor mounted at 2.5 m: side view and the "zones" seen from above. (Image: Flingeflung, Wikimedia Commons, CC BY-SA 3.0)
Choosing the mounting location
Before drilling, stand where you plan to mount it and look in the direction the sensor will face.
Make people walk across the field of view. In a long corridor, a ceiling sensor in the middle or a wall sensor looking diagonally across the walkway detects better than a sensor at the end of the corridor looking along it.
Use the manufacturer's recommended height: too low and the area is narrow; too high and it struggles to detect people further away.
Avoid heat sources and draughts (air-conditioning vents, fans, water heaters, incandescent lamps) and direct sunlight on the sensor lens.
Avoid moving objects (curtains, trees, washing hung out to dry); outdoors, avoid pointing at the road or the neighbours' door.
Don't let it be blocked by doors, cabinets or coat hooks.
Stairways in multi-storey townhouses
On a stairway with turns, a sensor on the lower floor cannot see people on the floor above. The usual approach is one sensor per floor for that floor's light, placed on the landing ceiling or the wall at the top of the stairs so that someone stepping onto the first stair is already in the detection area.
If you want several sensors to switch one group of lights, only do it when the manufacturer's instructions allow parallel connection, following their diagram exactly; 2-wire types usually cannot be connected in parallel.
Real example 1: second-floor corridor in a townhouse
A corridor of about 6 m, 2 surface-mounted LED ceiling lights, and a switch box without N. Solution: one 3-wire PIR sensor mounted on the ceiling in the middle of the corridor, taking L and N from the nearby light junction box; whether people come up the stairs or out of a room, they walk across the detection area. The old switch is kept, connected in series on the live feed to the sensor, so the client can switch it off completely when needed.
Tools and materials
Testing: a voltage tester pen and a multimeter (see how to use a multimeter to measure voltage, check continuity and find the live wire).
Tools: insulated screwdrivers, wire strippers, crimping pliers, a drill, a sturdy A-frame ladder, safety glasses, and a "Work in progress – do not switch on" sign.
Materials: the correct sensor type with its instructions; cable of the same cross-section as the existing lighting circuit (see how to choose cable size and circuit breakers for each circuit in the home); covered terminal blocks and junction boxes; a relay or contactor if the load exceeds the rating.
Wiring a motion sensor: 6 steps
Step 1. Survey and isolate
Ask the client where they want the light, for how long, and whether they have pets; add up the lamp wattage and compare it with the rating stated for that exact lamp type.
Switch off the lighting circuit breaker, hang a tag, measure to confirm the circuit is dead (test the pen on a live source before and after to be sure it still works), then open the switch box and the light box to see where N is available.
Step 2. Identify the incoming live, the wire to the light and the neutral
In a lighting circuit, the switch is on the live wire; the same applies to the sensor: the sensor switches the live feed to the light, never the neutral.
If the old wiring doesn't follow colour codes: insulate and separate each wire end before temporarily switching the power on, without touching any wire; use a tester pen or multimeter to find the supply live, switch the power off again, mark it and re-measure to confirm it's dead before continuing.
Step 3. Wiring the 3-wire type (L, N, L-out)
The supply live goes to terminal L.
The neutral goes to terminal N.
Terminal L-out (L', LOAD, arrow) goes to one terminal of the light.
The other terminal of the light goes back to neutral.
For metal-bodied lights, connect the earth wire to the light's earth screw.
Sensor lead colours vary by manufacturer (some models use brown for L, blue for N and red for the light output; others are completely different), so always read the label next to the terminals or the wiring diagram. Connecting the light output to N by mistake can cause a short circuit when the sensor closes. Swapping L and N means the sensor may switch the neutral: the light goes off but the lamp holder is still live, which is dangerous when changing a bulb.

Figure 4. The wiring compartment of a wall-mounted sensor with the cover removed: the wires go into a screw terminal block. The terminal order must be read from each manufacturer's label. (Photo: Gruenschuh, Wikimedia Commons, CC BY-SA 4.0)
Step 4. Wiring the 2-wire type (switch replacement)
The supply live goes to terminal L (per the manufacturer's label).
The wire going up to the light goes to the other terminal (L-out, LOAD).
If the manufacturer requires a minimum load or a load compensator, fit the compensator in parallel with the light, usually at the light box, exactly as per the manufacturer's diagram.
When using a 2-wire type with LEDs, warn the client in advance that the light may glow dimly when off. This is similar to what happens with illuminated switches; see also the lesson LED lights still glowing dimly or flickering after being switched off.
Step 5. Large loads and manual override
Total load exceeds the rating: let the sensor drive the coil of a relay or contactor (with the correct coil voltage), and the contacts rated for the load will switch the lights.
The client wants the light permanently on when needed: connect an ordinary switch in parallel across the L and L-out terminals of a 3-wire sensor, if that model's instructions allow it; many models already have an ON mode.
The client wants to switch the sensor off completely: an ordinary switch in series on the live wire to terminal L.
Step 6. Secure and close up
Tighten the screws, crimp ferrules on stranded wires and tug each wire gently to check. Outdoors, feed cables through gasketed entries and mount the unit the way the manufacturer shows so water doesn't collect. Turn the sensor head towards the intended direction, but don't lock the swivel joint yet.
Adjusting the TIME, LUX and SENS knobs
Symbols vary by manufacturer: TIME is usually a clock symbol, LUX a sun and moon, and SENS is marked SENS. Adjust gently with a small screwdriver.

Figure 5. Two adjustment knobs on a sensor head: the sun symbol is the LUX light threshold and the clock symbol is the TIME setting. (Photo: Олег Граченко, Wikimedia Commons, CC BY-SA 4.0, cropped)
TIME – how long the light stays on after the last movement. Any further movement restarts the count. The range is usually from a few seconds to a few minutes, depending on the model. Too short, and the light goes off while the client is still standing there unlocking the door.
LUX – only switch on when it is dark enough. Towards the sun: switches on even in daytime; towards the moon: only switches on when dark. When testing in daytime, turn it towards the sun, otherwise you'll think the sensor is faulty.
SENS – sensitivity and range. Increasing SENS extends the range but makes it easier to pick up pets, vehicles in the street and warm air. Start at the middle setting and increase it gradually until it detects a person at the edge of the area to be lit, then stop. If there is no SENS knob, tilt the sensor head downwards or use the lens masking strips supplied.
Location | TIME (reference) | LUX (reference) | SENS (reference) | Notes |
|---|---|---|---|---|
During installation and testing | Shortest | Fully towards the sun | Middle | Readjust after testing |
Indoor stairway | Short, enough to climb one flight | Dark or dusk | Enough to cover the first steps and the landing | Stairs with turns: one sensor per floor |
Corridor without windows | Short to medium | Close to the sun (dark even in daytime) | Middle | Avoid doors of air-conditioned rooms |
Outdoor gate or yard | Medium to long | Dusk | Low to middle | Avoid pointing at the street or swaying trees |
The table gives no seconds or minutes because the scale markings differ between manufacturers; time it in practice.
Testing and measuring before handover
Before switching on: check the wiring diagram again and test continuity (with the power off) to make sure there is no short between live and neutral. If you do an insulation test with a megger, disconnect the sensor and the LED lamps from the circuit first.
After switching on:
Wait for the sensor to stabilise: many models switch the light on for a while after power-up before switching it off. Stand still outside the detection area.
Walk test with TIME at the shortest and LUX towards the sun: walk across, walk along the edge of the area, walk straight towards the sensor; note where it switches on late.
Switch-off test: stand outside the area, stand still and time how long it takes the light to go off. The light must go fully off, with no dim glow.
Measure the voltage at the light while it is on; press the TEST button on the RCD or RCBO if the circuit has one.
Adjust TIME, LUX and SENS to the client's needs; lock the swivel joint. If possible, come back and test once more after dark.
Real example 2: a mini-apartment corridor light that won't switch off
The third-floor corridor light stayed on almost all night. The ceiling PIR sensor was right in front of the door of an air-conditioned room, so every time the door opened, the warm and cold air flow changed, and TIME was turned almost to maximum. Moving the sensor to the middle of the corridor, reducing TIME and slightly reducing SENS solved it. A light that won't switch off is usually down to location and settings, not a faulty sensor.
Troubleshooting common faults
The light won't switch off, or takes a very long time:
TIME too long; heat sources, draughts, curtains or swaying trees in the detection area; a microwave sensor "seeing" people through a partition.
The light wire connected directly to the supply live; a parallel manual switch left on; the slide switch set to ON.
Still won't switch off: suspect the relay inside the sensor has welded shut due to overload or LED inrush current; replace the sensor and review the load.
The light switches on when nobody is there:
Sunlight, car headlights, warm air, pets, swaying trees: reduce SENS, tilt the sensor head down, mask part of the lens.
Switching on and off repeatedly when the light is too close to the sensor: the heat or light from the lamp itself affects the sensor lens; increase the distance.
The light doesn't switch on, or switches on late:
LUX set towards the moon while testing in daytime; people walking straight towards the sensor; wrong mounting height, blocked view, mounted behind glass; dirty lens (switch off the power, then wipe with a soft dry cloth).
No power to the sensor: measure the voltage between L and N at the terminals (3-wire type).
The LED lamp glows dimly or flashes when off:
2-wire type (for example, one the client bought themselves for a small LED bulb on the stairs): fit a load compensator in parallel with the light as per the manufacturer, use a lamp that meets the minimum load, or run N to the box and switch to a 3-wire type (the most durable solution). This is a characteristic of 2-wire types, not an installation fault.
A 3-wire type still glows dimly: check the N terminal, and whether the wire to the light runs in parallel with other live wires over a long distance.
Safety checklist
Switched off the correct circuit breaker, hung a tag and informed the household; tested and measured to confirm there is no voltage at the switch box and the light box.
Remember that a light switched off by the sensor is not isolated; to change a bulb or repair the light, switch off the circuit breaker.
The sensor switches the live wire; on 3-wire types, N is on the correct terminal.
The total load does not exceed the rating; connections are tight, inside covered boxes, with no exposed copper.
Outdoors and in damp places: equipment with a suitable IP rating, and the circuit has residual current protection.
A sturdy ladder, with someone holding it when working on a stairway ceiling.
Working with the client at handover
Many "warranty" calls happen because the client doesn't understand the device. Before you leave, explain briefly: the light switches on when someone moves, it may switch off if someone sits still for a long time, and it doesn't come on in daytime because of the LUX setting. Show them the OFF/AUTO/ON slide switch or the manual switch and let them walk through it themselves. Send a photo showing the TIME, LUX and SENS settings and leave the manufacturer's instructions with the client.
See also quoting, taking on jobs and working with clients for residential electricians.
Stop and call an experienced electrician when: you can't tell live from neutral; the old wiring is brittle or scorched; or you're unsure at any step.
Frequently asked questions
Can a sensor switch be used with LED lights?
Yes. Choose a 3-wire type with N and check the power rating stated specifically for LEDs.
How many lights can one sensor control?
Add up the total wattage of the lights and compare it with the rating for that exact lamp type, leaving a margin. If it exceeds the rating, use a relay or contactor.
Why does the light stay on for a while right after power-up before switching off?
Many models need a warm-up period for the circuit to stabilise. This is normal; check the manufacturer's instructions for the exact time.
Can a PIR sensor be fitted in a toilet?
Yes, but if someone sits still for a long time the light may go off. Set a longer TIME and make sure the sensor can see the seating position; in damp areas choose equipment with a suitable IP rating.
Practical exercise
Draw a floor plan of the corridor or stairway in your home, marking the direction people walk and any heat sources; choose the location and sensor type.
Open a light switch box (with the power off and measured dead): note the number of wires, whether N is present, and whether a 2-wire or 3-wire type should be used.
On a practice board with a circuit breaker and RCD, supervised by an instructor: wire a 3-wire sensor controlling an LED light, add a parallel manual switch; test walking across and straight towards the sensor, and time the switch-off at 2 TIME settings.
Self-assessment criteria — you pass when:
You touch no wire before switching off the power and measuring to confirm it's dead.
The sensor is on the live wire; on the 3-wire type N is on the correct terminal; the load does not exceed the rating.
The light switches on when walking across the detection area and goes fully off after the set time, with no dim glow.
You can explain why 2-wire types tend to make LEDs glow dimly.
Related lessons to study next: installing two-way switches and earthed sockets correctly and installing recessed LED downlights: calculating the number of lights, layout and switch grouping.






