RTOS-Based Interfacing of IR(Infrared) and DHT(Digital Humidity and Temperature) Sensors With STM32F446RE Nucleo-board
by marushikasuri in Circuits > Electronics
392 Views, 2 Favorites, 0 Comments
RTOS-Based Interfacing of IR(Infrared) and DHT(Digital Humidity and Temperature) Sensors With STM32F446RE Nucleo-board
In the realm of embedded systems, the integration of sensors plays a pivotal role in enabling smart and responsive functionalities. The proposed solution embarks on the development of an integrated system harnessing the power of the STM32 Nucleo-F446RE development board. This system seamlessly amalgamates an infrared (IR) sensor and a DHT11 temperature and humidity sensor, forming a comprehensive monitoring platform.
The core objective of this endeavor is to orchestrate a meticulously crafted firmware, designed to orchestrate efficient data acquisition, processing, and interfacing between the sensors and the STM32 microcontroller. A pivotal component facilitating this orchestration is the utilization of a Real-Time Operating System (RTOS), which acts as the backbone for task management, ensuring smooth and concurrent execution of critical operations.
Supplies
- STM32F446RE Nucleo-Board
- IR(Infrared) Sensor
- DHT(Digital Humidity and Temperature)Sensor
- LED
- Connecting Wires
Download STM32CubeIDE
The initial step involves downloading of the desired software-STM32CUBEIDE for the execution.
Download link: https://www.st.com/en/development-tools/stm32cubeide.html
Create STM32 Project
- Open the STM32CubeIDE.
- Launch the IDE(Integrated Development Environment).
- Go to File>New STM32 Project.
- STM32 Target Selection box will appear.
- Under Board selector, select the desired Nucelo-board(STM32F446RE).
- Select Next.
- Give a name to your STM32 Project. Keep the other settings as default. Select Finish.
Setting Up STM32CubIDE Project
A similar prompt will appear.
A .ioc format file will be created with the name of the project and will be displayed on the screen.
Under this, we will configure the entire project.
Pinout & Configuration
Under Pinout & Configuration:
- Go to System Core>SYS. Under MODE>Timebase Source> TIM1.
- Go to Timers> Select TIM6.
- Under Connectivity> USB_OTG_FS. Under Mode>Device Only.
Creating Tasks
- Under Pinout & Configuration> Middleware and Software Packs> FREERTOS.
- Select Mode>CMSIS_V1(CMSIS is the library for free RTOS).
- Under Configuration>Tasks and Queues> Create Tasks and assign priorities to each task.
- Here we have 3 tasks: one is the default task, Task02 and Task 03.
- Add 2 tasks and assign high priority to task02(IR Sensor) and lower priority to Task03(DHT Sensor).
- Go to Clock Configuration>Resolve clock issues.
Go to Pinout View
- Select GPIO_INPUT for Pin PA0(Connected to IR Sensor).
- GPIO_INPUT for Pin PA1(DHT Sensor).
- GPIO_OUTPUT for Pin PB5(Connected to LED).
Code Generation
Go to Device Configuration Tool Code Generation and generate the code. A main.c file will be generated. Keep all parameters as default.
Add commands in the code as per your requirement.
Further steps:
- Build the project(Ctrl+B).
- Check for errors and warnings.
- Setup the hardware.
- Connect it with your IDE using Male to MINI-B Cable.
- Run the project.
- Check the output on Teraterm serial monitor.
You just learnt how to interface IR and DHT Sensor using STM32F446RE Nucleo board on STM32CubeIDE using FREERTOS.
Keep learning! Keep creating! Keep innovating!