制造商零件编号 SSD005/4-V2B
BLUETOOTH 5 LOW ENERGY USB DONGL
Smart Sensor Devices
License: General Public License
1. Introduction
In this project we will use a PIR sensor to detect motion. 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.
A PIR (passive infrared) Sensor is an electronic device that detects heats from 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: https://www.digikey.com/short/4v12z2nw). When the BleuIO Dongle is connected to the Nucleo boards 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.
2. Using the example project2.1 What we will need
2. How to setup project 2.1 Downloading the project from GitHub
Get 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.
2.2 Importing as an Existing Project
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’
5. Connecting the sensor
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:
6. Running the example
Baudrate: 115200
Data Bits: 8
Parity: None
Stop Bits: 1
Flow Control: None
7. 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.
The yellow LED on the STM32 board also toggles if there is a movement.
Hope you found this article informative.