How to use a generic PIR sensor with 3.3v and the microbit.
The PIR sensor module will detect movement and report it to the microbit as a digital signal. There are many PIR sensor modules on the market but the most common one is based on the DYP-ME003 PIR sensor module by Open Impulse. This module runs at 5v so requires some hacking to work with the microbit.
A search on eBay or Amazon for HC-SR501 or DYP-ME003 will return the sensor you need. These are usually around £2.
The sensor differs slightly between manufactures: some boards have two sets of header pins whilst others have only one set. If the sensor has two sets of header pins it requires no soldering to convert to 3.3v. If it has only one set of header pins it must be soldered.
…so try to get a PIR sensor with two sets of header pins!
Confirmed PIR sensor modules with two sets of header pins:
Attach the microbit’s
3v pin to the header pin on the PIR sensor labelled
Attaching it to the H pin bypasses the voltage regulator on the sensor and enables it to run on 3.3v. The jumper attached to these pins can be discarded.
There is more about this process and its discovery on tech gurka
There are two potentiometers labelled TIME (or T) and SENSITIVITY (or S) on the sensor module. Adjusting SENSITIVITY changes the detection range from 3m to up to 7m. As the range increases, the more sensitive to movement it becomes.
TIME represents the duration of the output signal. If it detects movement, the TIME parameter controls how long the sensor will output HIGH. This can be changed from 5s through to 300s.
Hook up the sensor to the microbit as shown:
|PIR Sensor Pin||Microbit Pin|
Published: December 23, 2016 Updated: December 23, 2016