Source: https://mokxi.com/pir-sensor-simulator

Simulator

# A PIR sensor simulator: the HC-SR501 on an Arduino

Mokxi is a free online PIR motion sensor simulator that runs in your browser, with nothing to install and no account needed. An HC-SR501 motion sensor on an Arduino Uno’s pin 7, with an LED on pin 13 that copies its output. Click the sensor’s white dome to start something moving in front of it, and click again to stop.

Start building free or read how a PIR works

- 455 parts on the bench
- 43 boards running now
- 1.00x real time, on every board

Click to open it in the editor

Click the dome to wave at the sensor, or click anything else to open it in the editor.

## What you can do here

In the circuit above, or in the editor it opens.

- Start and stop movement with a click and watch the output
- Set the hold time, the trimmer on the real board, in the properties panel
- Switch the jumper between repeat and single trigger
- See the block time that makes a fresh PIR look broken
- Switch a lamp, a relay or a buzzer from the output
- Edit the Arduino code and press Run again

## What the running circuit shows

High while it moves, and a while after.

The HC-SR501 does the sensing on its own board and gives a plain digital output: high while it sees movement, low when it does not. Its OUT pin is 3.3 V whatever it is powered from, which an Uno reads as HIGH. The sketch copies it onto the LED and prints each change.

In the engine a click on the dome puts OUT at 3.3 V, the LED lights and the serial monitor prints “motion detected”. Click again and the output stays high for the 2 second hold time, then drops and the monitor prints “all still”. Click right away and nothing happens for 2.5 seconds: that is the block time, when the module ignores everything after a pulse.

## How the sensor is modeled

Hold, block and retrigger, as on the board.

Hold, block and retrigger are properties. Set the hold to 5 and the output stays high 5 seconds after the movement stops. With the jumper in repeat, the default, movement that goes on keeps the output high for as long as it lasts; set it to single and one movement gives one 2 second pulse, however long it goes on.

What it leaves out: the lens and its zones, range and angle. A click stands for something warm moving in view, so the sensor cannot be fooled by a heater or miss someone walking straight at it, as a real one can. A real module also needs up to a minute to settle after power-up; this one is ready at once.

The PIR motion sensor, in detail The relay simulator The ultrasonic sensor simulator The buzzer simulator

## Questions

Is it free?

Yes. The circuit on this page, every part in it and the editor it opens in are on the free plan, with no card.

Do I need an account?

No. The circuit runs the moment the page does, and the editor opens without one. A free account is only for saving a project to the cloud and sharing it by link.

Why does my PIR sensor stay on?

Its hold time keeps the output high for a while after the movement stops, 2 seconds here and adjustable by a trimmer on the real board. With the jumper in repeat, ongoing movement keeps it on.

Why does my PIR sensor not react right after it turns off?

After each pulse it ignores everything for its block time, 2.5 seconds on the HC-SR501. Wait it out and it detects again.

Do I need a resistor on the PIR output?

Not to read it. OUT drives a clean 3.3 V signal straight into a digital pin. To switch a lamp or a relay, put a transistor between them.

## More simulators

Each one opens on a circuit that is already running.

Online circuit simulator Breadboard simulator ESP32 simulator Op-amp simulator Logic gate simulator LED circuit simulator Servo simulator LCD simulator OLED simulator NeoPixel simulator 7 segment display simulator LED matrix simulator Stepper motor simulator Motor driver simulator Ultrasonic sensor simulator Rectifier simulator Digital circuit simulator Potentiometer simulator PWM simulator Relay simulator Shift register simulator DHT11 simulator RFID simulator Accelerometer simulator RGB LED simulator Buzzer simulator MOSFET simulator Circuit simulator for kids Flip-flop simulator Multiplexer simulator Full adder simulator I2C simulator UART simulator Thermistor simulator Oscilloscope simulator Multimeter simulator DC motor simulator Traffic light simulator Diode simulator Capacitor simulator Series and parallel circuit simulator Wheatstone bridge simulator Voltage regulator simulator Soil moisture sensor simulator Zener diode simulator Solar panel simulator AC circuit simulator Thevenin simulator Decoder simulator Encoder simulator PID simulator Robot arm simulator Load cell simulator IR sensor simulator LM35 simulator HC-05 Bluetooth simulator nRF24L01 simulator

## Wave at a sensor

Open the circuit, click the dome and press Run. Nothing to install, and no account needed.

Start building free Open the editor
