PIR Motion Sensor
Last updated
Last updated
This sensor allows you to detect the movement of animals, usually the movement of humans within its detection range. Just connect it to the NyBoard and program it, and when anyone moves within its detection range, the sensor will output a high potential on its SIG pin.
NyBoard
Connecting to the NyBoard with wire as shown in the following picture:
BiBoard
For specific use, the end connected to the sensor can be fixed on the robot's head (included in Bittle's mouth or attached to the top of Nybble's head), of course, you can also use your creativity according to your needs.
The code using this sensor has been integrated into the OpenCat (NyBoard)/ OpenCatEsp32 (BiBoard) project. Uncomment the line #define PIR
in the OpenCat.ino / OpenCatEsp32.ino, as shown in the figure below, and then use the Arduino IDE to upload the sketch to the robot main board, which can reproduce the example function of integrating the robot action.
With NyBoard V1_*, you can simply choose Arduino Uno.
If you want to test the function of a PIR motion sensor alone or want to learn more about its principles. You can use the Arduino IDE to upload the demo sketch(test_Touch_Reflection_PIR.ino), as shown below:
This demo sketch implements real-time printing of sensor detection results in the serial monitor - when anyone moves within its detection range, print 1; otherwise, print 0.
The demo code is in the OpenCat code repository on GitHub (specific path: OpenCat/ModuleTests/test_Touch_Reflection_PIR). You can visit our GitHub code repository https://github.com/PetoiCamp/OpenCat to download the complete code, as shown in the following picture: