IoT Node


You'll need to install a library to make Arduino IDE support the sensor. This library includes drivers for the AS312 sensor and sample code for you to jumpstart your project.


For ESP32 based systems, we're currently supporting Arduino core. Please make sure you've installed the following:

  • Arduino IDE.

  • ESP32 Hardware libraries for the Arduino IDE.

  • Python for the compilation of Arduino projects.

  • Drivers for your host device, e.g., USB Virtual Serial Port driver.


Please download the library archive from

Then, copy its contents to your Arduino Libraries folder.

You can find the Arduino Libraries folder inside your Arduino sketch directory. It is generally located inside the My Documents folder.


The library comes with included samples. There is no need to download additional files for the examples.

Source Code

The hardware, its drivers and the sample code are open source. You can use them under the terms of the MIT license. Please feel free to customize and prototype them for your projects.

Arduino Library

Turta_PIRMotionDetect_Module library is responsible for reading the sensor interrupts.

To use the library on Arduino IDE, add the following #include statement to the top of your sketch.

#include <Turta_PIRMotionDetect_Module.h>

Then, create an instance of the Turta_PIRMotionDetect_Module class.

Turta_PIRMotionDetect_Module pir

Now you're ready to access the library by calling the pir instance.


To initialize the sensor, call the begin method.


This method configures the interrupt pin to read sensor state.

Basic Members

Read Motion State

Returns the motion state from the sensor.

bool readMotionState()
  • Parameters

    • None

  • Returns

    • Bool: Motion state.


You can open the example from Arduino IDE > File > Examples > Examples from Custom Libraries > Turta PIR Motion Detect Module. There is one example of this sensor.

pageMotion Detect Sample


If you're experiencing difficulties while working with your device, please try the following steps.

Problem: The sensor generated an interrupt, but there was no movement. Cause: However there is a built-in temperature compensation inside the sensor, quick heat changes may trigger incorrect interrupts. Solution: Try to prevent quick temperature changes in the sensor's surrounding.

Last updated