This is a project for interfacing PIR sensor module to FRDM-KL43ZFRDM-KL43Z using Kinetis Design Studio 3.0 Kinetis SDK 1.2 Processor-Expert
The module contains 3 pins for connection with system. The two of them are vcc 5v and Gnd. The third one is output from this module. The signal goes high when motion is detected. The output signal is 3.3v compliant. From your system after providing power you check the 3 rd pin for motion detection
Delay time is the time during which the output remains changed after the change caused by a detected motion. Or the delay between two subsequent motion detections.
Below are the features of the sensor module:
- wide operating voltage range: default voltage DC 3.6V ~ 20V
- temperature compensation ( optional, not factory setting ) : In the summer, when the ambient temperature rises to 30 ~ 32 , detection distance is slightly shorter, temperature compensation can be used for certain performance compensation.
- high output signal: the circuit can be easily implemented with various docking.
- Micropower : quiescent current <50 microamps, especially for battery-powered automatic control products.
- with induction blocking time ( default setting : 2.5S block time ) : sensor module output every time after induction (high variableTo the low level), you can set up a blockade followed by time period, during this time period does not accept any inductive sensor signals.This function can be achieved " sensor output time " and " blocking time "interval between the work can be applied to interval detection products; while this feature can effectively inhibit the load switching process for a variety of interference. ( This time can be set to zero seconds- tens of seconds )
Hardware interface to KL43Z Freedom board:
We are connecting the signal pins of the sensor module as shown below:
VCC > J3-10 > P5V-USB
GND > J3-14
OUT > J4-12 > PTC-1 port pin
Components required in our project:
We are using 3 components for this project requirement:
1) fsl_gpio
2) fsl_debug_console
3) wait
Component fsl_gpio:
Connections made to fsl_gpio component are
We have connected PTC-1 port pin as an input signal which is connected to ‘OUT’ pin signal of the sensor
Pin PTE-31 is connected as output which in turn connected to RED LED to indicate the motion sensor.
Component fsl_debug_console:
We have connected debug UART to display the motion sensor output on the terminal
The connection is as shown below:
Component wait
We have added this component to add delay in our software
Software for our project:
Finally our main c program to perform this action is as shown below:
while(1){
while(GPIO_DRV_ReadPinInput(J4_12)){
GPIO_DRV_ClearPinOutput(LED2_RED);
debug_printf("Motion detected\r\n");
WAIT1_Waitms(500);
}
GPIO_DRV_SetPinOutput(LED2_RED);
debug_printf("Motion not present\r\n");
WAIT1_Waitms(500);
} // end of while(1)i.e we are continuously reading the input port pin whether the motion sensor signal is sensed or not?
If sensed positive we are turning the LED on and display the message on the hyper terminal
The output is as shown below after configuring the serial terminal for the baud rate of 19200 and your com port
The video output for the same is shown below
![]()
I have enclosed the project folder and executable for your quick reference and evaluation






