Which sensor to use to detect when someone walks past the sensor?

I am working on a electronic project. The goal is to detect motion when someone starts walking up the stairs. When this happens data is send to microcontroller and lights are turned on.The problem is that I cannot figure out which sensor to use for the task of detecting motion. I first tried using PIR and microwave radar sensors but they were too sensitive(they keep detecting motion from the hall and living room). Then i found diffused photoelectric sensors but they are quite expensive so i haven't yet bought them and tested them. My next thought was to use distance sensor(ultrasonic sensor) to first measure distance between one side of the wall(on which sensor is mounted) and the other side of the wall. When somebody walks up the stairs, he walks past the sensor and the distance changes. But that solution seems complicated(the implementation would be easy, but when i read it, it sounds that i am just complicating and i think there is easier way). What do you think, which sensor would you use?

• You did not try lidar. Narrow bean should be used, some photoelectric obstacle sensor may fit. Jan 24, 2022 at 11:47
• Won't they also detect when they walk down the stairs too? Jan 24, 2022 at 11:52
• What about some mechanical thing under the carpet (if any)? Jan 24, 2022 at 11:56
• The signal from a bare PIR sensor is proportional to how fast the infrared light that it "sees" is changing. If it's too sensitive, then change the trigger threshold. The "motion sensor lights" that you can buy at your favorite big-box DIY store often have a knob you can adjust for exactly that purpose. Jan 24, 2022 at 14:43
• Why not use 2 'simple' beam-break sensors - one on the lowest level at the 1st step, and the other 1 or 2 steps up. If the sensors trigger in order 1->2 then someone is going in the 'up-the-stairs' direction. Jan 24, 2022 at 15:13

Sensor Use combination of 2 distance sensors (ultrasonic or IR).

Mount Place two sensor pointing towards the wall from stairs at some distance (say one to the right of point 2 and other to the left of point 2) pointing towards the wall.

Working In case the person walks up sensor detection will be in order sensor 1 and sensor 2, if the persons is walking down sensor detection will be in order sensor 2 and sensor 1.

Calibration Calibrate the sensor to the width of the stairs.

• Some sensors (US) are Tx/Rx ... (occasionally Waterproof, sometimes needed) Jan 24, 2022 at 16:36

A beam break detector on the wall next to the stairs. This could consist of an infrared LED and photodiode mounted next to each other, but with a barrier between them. Mount a retro-reflector on a stair rail opposite. You can buy these detectors ready made.

The LED emits a coded signal, and you have a detection when the photodiode receives that signal.

I would use a VL53L1X laser time of flight sensor, I'm working on something similar myself, going to use 4 sensors though, 2 at the top and 2 at the bottom, with the intention of maintaining a count of how many people are on the stairs. That way it should avoid lights going off if say someone is on the stairs and someone else triggers it, or the lights going off before everyone has left the stairs.