Close Menu
  • Articles
    • Learn Electronics
    • Product Review
    • Tech Articles
  • Electronics Circuits
    • 555 Timer Projects
    • Op-Amp Circuits
    • Power Electronics
  • Microcontrollers
    • Arduino Projects
    • STM32 Projects
    • AMB82-Mini IoT AI Camera
    • BLE Projects
  • IoT Projects
    • ESP8266 Projects
    • ESP32 Projects
    • ESP32 MicroPython
    • ESP32-CAM Projects
    • LoRa/LoRaWAN Projects
  • Raspberry Pi
    • Raspberry Pi Projects
    • Raspberry Pi Pico Projects
    • Raspberry Pi Pico W Projects
  • Electronics Calculator
Facebook X (Twitter) Instagram
  • About Us
  • Disclaimer
  • Privacy Policy
  • Contact Us
  • Advertise With Us
Facebook X (Twitter) Instagram Pinterest YouTube LinkedIn
How To Electronics
  • Articles
    • Learn Electronics
    • Product Review
    • Tech Articles
  • Electronics Circuits
    • 555 Timer Projects
    • Op-Amp Circuits
    • Power Electronics
  • Microcontrollers
    • Arduino Projects
    • STM32 Projects
    • AMB82-Mini IoT AI Camera
    • BLE Projects
  • IoT Projects
    • ESP8266 Projects
    • ESP32 Projects
    • ESP32 MicroPython
    • ESP32-CAM Projects
    • LoRa/LoRaWAN Projects
  • Raspberry Pi
    • Raspberry Pi Projects
    • Raspberry Pi Pico Projects
    • Raspberry Pi Pico W Projects
  • Electronics Calculator
How To Electronics
Home » PIR Motion Detection using Bluetooth & STM32 Board
BLE Projects Microcontrollers STM32 Projects

PIR Motion Detection using Bluetooth & STM32 Board

Mamtaz AlamBy Mamtaz AlamUpdated:December 23, 20234 Mins Read
Share Facebook Twitter LinkedIn Telegram Reddit WhatsApp
PIR Motion Detection using Bluetooth & STM32 Board
Share
Facebook Twitter LinkedIn Pinterest Email Reddit Telegram WhatsApp

Overview

In this project, we will use a PIR sensor for motion detection with STM32 Board and Bluetooth Low Energy. Once motion is detected, it will trigger an interrupt and the BleuIO dongle connected to the board will advertise for 25 seconds. You can expand the project based on your needs further. To learn more about the PIR Sensor you can refer to HC-SR501 Arduino interfacing guide and tutorial.

A PIR (passive infrared) Sensor is an electronic device that detects heat from the human or animal body, giving a detection signal when movement happens in a given area or range of the sensor.

For this project, we will need one dongle and a PIR sensor (for example: EKMB1301111K). When the BleuIO Dongle is connected to the Nucleo board USB port the STM32 will recognize it and set up a new device name for the dongle: BleuIO PIR Detected. This will show up when the dongle is advertising.


Requirements

  • A BleuIO dongle (https://www.bleuio.com/)
  • A PIR sensor (for example: EKMB1301111K)
  • A board with an STM32 Microcontroller with a USB port. (A Nucleo-144 development board: NUCLEO-H743ZI2, was used to develop this example. (https://www.st.com/en/evaluation-tools/nucleo-h743zi.html)
  • To connect the dongle to the Nucleo board we used a “USB A to Micro USB B”-cable with a USB A female-to-female adapter.)
  • STM32CubeIDE (https://www.st.com/en/development-tools/stm32cubeide.html)



How to Setup Project?

Downloading the project from GitHub

Get the project here: https://github.com/smart-sensor-devices-ab/stm32_bleuio_pir_example

Either clone the project or download it as a zip file and unzip it, into your STM32CubeIDE workspace.


Importing as an Existing Project

  • From STM32CubeIDE choose File>Import…

  • Then choose General>Existing Projects into Workspace then click ‘Next >’

  • Make sure you’ve chosen your workspace in ‘Select root directory:’
  • You should see the project “stm32_bleuio_pir_example”, check it, and click ‘Finish’.

If you download the project as a zip file you will need to rename the project folder from ‘stm32_bleuio_pir_example-master’ to ‘stm32_bleuio_pir_example’.



Hardware Setup

Connect the PIR Sensor Gnd to ground and Vdd to power and Output to a pin of your choice on the Nucleo board (In the example we use PA0)

If you want a different PIN you will need to go into the STM32Cube ioc file and make some edits:

  • Click on PA0 and select Reset_State in the STM32Cube ioc file.
  • Click on your desired Pin and select EXTIO

The hardware connection for PIR Motion Detection with STM32 looks something like this.

PIR Motion Detection STM32 Blueio

  • Then go to GPIO under System Core and make sure you setup the pin as follows:
    GPIO mode: External Interrupt Mode with Rising edge trigger detection
    GPIO Pull-up/Pull-down: Pull-down

  • Then go to NVIC under System Core and make sure EXTI line0 interrupt is enabled


Running the Example

  • In STMCubeIDE click the hammer icon to build the project.
  • Open up the ‘STMicroelectronics STLink Virtual COM Port’ with a serial terminal emulation program like TeraTerm, Putty, or CoolTerm.

Baudrate: 115200

Data Bits: 8

Parity: None

Stop Bits: 1

Flow Control: None

  • In STMCubeIDE click the green play button to flash and run it on your board. The first time you click it the ‘Run Configuration’ window will appear. You can just leave it as is and click run.
  • Connect the BleuIO Dongle.




Testing & Output

When the PIR sensor detects movement it will trigger an interrupt that in turn will tell the BleuIO Dongle to advertise for 25 seconds. Just so the PIR Sensor will not trigger constantly we have put a 20-second timeout before it will trigger again. If no new interrupts have been detected after the 25-second advertising timer has run out the BleuIO Dongle will stop advertising and wait for a new interrupt to happen.

In this way the PIR Motion Detection with STM32 & PIR Motion Sensor can be implemented in the project.

The yellow LED on the STM32 board also toggles if there is a movement.

Hope you found this article informative.

Share. Facebook Twitter Pinterest LinkedIn Tumblr Email Reddit Telegram WhatsApp
Previous ArticleGSM Based Water Level Monitoring System with Arduino
Next Article Getting Started with Nuvoton NuMaker UNO NUC131 Microcontroller

Related Posts

Building a Smart Sensor Node with a BLE Microcontroller

Building a Smart Sensor Node with a BLE Microcontroller

AMB82-Mini Embedded AI Vision - Capture Image & Analyze

AMB82-Mini Embedded AI Vision – Capture Images, Send Prompts, Show Results

Updated:May 7, 20252K
1080p MP4 Video Recorder with AMB82-Mini IoT AI Camera

1080p MP4 Video Recorder with AMB82-Mini IoT AI Camera

Updated:June 28, 202543K
Object Detection & Identification with AMB82-Mini AI Camera

Object Detection & Identification with AMB82-Mini IoT AI Camera

Updated:June 28, 202538K
Getting Started with Realtek AMB82-Mini IoT AI Camera Arduino Dev. Board

Getting Started with Realtek AMB82-Mini IoT AI Camera Arduino Dev. Board

Updated:June 28, 202512K
Getting Started with Nuvoton NuMaker UNO NUC131 Microcontroller

Getting Started with Nuvoton NuMaker UNO NUC131 Microcontroller

Updated:July 9, 2023
Add A Comment

CommentsCancel reply

Latest Posts
ESP32 Fingerprint Attendance System with Live Web Dashboard

ESP32 Fingerprint Attendance System with Live Web Dashboard

June 21, 2026
IoT Based PM & Air Quality Monitoring System using ESP32

IoT Based PM & Air Quality Monitoring System using ESP32

June 14, 2026
DIY ESP32 MLX90640 IR Thermal Camera with Live Web Display

DIY ESP32 MLX90640 IR Thermal Camera with Live Web Display

May 10, 2026
IoT Activity Tracker with ESP32 & Accelerometer Gyroscope

IoT Activity Tracker with ESP32 & Accelerometer/Gyroscope

May 2, 2026
A Guide to Sourcing Obsolete ICs for Vintage Projects

Beyond AliExpress: A Guide to Sourcing Obsolete ICs for Vintage Projects

April 21, 2026

ESP32 IoT Vehicle Motion Analyzer with MPU6050 & LIS3MDL

April 27, 2026
Building a Smart Sensor Node with a BLE Microcontroller

Building a Smart Sensor Node with a BLE Microcontroller

February 26, 2026
High-Accuracy Pitch, Roll, Yaw with ESP32 & BNO08x IMU

High-Accuracy Pitch, Roll, Yaw with ESP32 & BNO08x IMU

April 27, 2026
Top Posts & Pages
  • ESP32 Fingerprint Attendance System with Live Web Dashboard
    ESP32 Fingerprint Attendance System with Live Web Dashboard
  • IoT AC Energy Meter with PZEM-004T & ESP32 WebServer
    IoT AC Energy Meter with PZEM-004T & ESP32 WebServer
  • 12V DC to 220V AC Inverter Circuit & PCB
    12V DC to 220V AC Inverter Circuit & PCB
  • ESP32 CAN Bus Tutorial | Interfacing MCP2515 CAN Module with ESP32
    ESP32 CAN Bus Tutorial | Interfacing MCP2515 CAN Module with ESP32
  • How to use Modbus RTU with ESP32 to read Sensor Data
    How to use Modbus RTU with ESP32 to read Sensor Data
  • MAX30102 & Arduino: Heart Rate + Blood Oxygen Monitoring
    MAX30102 & Arduino: Heart Rate + Blood Oxygen Monitoring
  • Buck Converter: Basics, Working, Design & Application
    Buck Converter: Basics, Working, Design & Application
  • IoT Based ECG Monitoring with AD8232 ECG Sensor & ESP32
    IoT Based ECG Monitoring with AD8232 ECG Sensor & ESP32
Categories
  • Arduino Projects (197)
  • Articles (60)
    • Learn Electronics (19)
    • Product Review (15)
    • Tech Articles (28)
  • Electronics Circuits (46)
    • 555 Timer Projects (21)
    • Op-Amp Circuits (7)
    • Power Electronics (13)
  • IoT Projects (205)
    • ESP32 MicroPython (7)
    • ESP32 Projects (82)
    • ESP32-CAM Projects (15)
    • ESP8266 Projects (76)
    • LoRa/LoRaWAN Projects (22)
  • Microcontrollers (38)
    • AMB82-Mini IoT AI Camera (4)
    • BLE Projects (18)
    • STM32 Projects (19)
  • Raspberry Pi (93)
    • Raspberry Pi Pico Projects (57)
    • Raspberry Pi Pico W Projects (12)
    • Raspberry Pi Projects (24)
Follow Us
  • Facebook
  • Twitter
  • Pinterest
  • Instagram
  • YouTube
About Us

“‘How to Electronics’ is a vibrant community for electronics enthusiasts and professionals. We deliver latest insights in areas such as Embedded Systems, Power Electronics, AI, IoT, and Robotics. Our goal is to stimulate innovation and provide practical solutions for students, organizations, and industries. Join us to transform learning into a joyful journey of discovery and innovation.

Copyright © How To Electronics. All rights reserved.
  • About Us
  • Disclaimer
  • Privacy Policy
  • Contact Us
  • Advertise With Us

Type above and press Enter to search. Press Esc to cancel.

Ad Blocker Enabled!
Ad Blocker Enabled!
Looks like you're using an ad blocker. Please allow ads on our site. We rely on advertising to help fund our site.