Template: Infrared Proximity Sensor STM32 Guide

From Waveshare Wiki
Revision as of 10:36, 9 October 2021 by Waveshare-eng11 (talk | contribs) (Created page with "The examples provided are based on the STM32F103RBT6 and the STM32H743, the connection provided is based on the STM32F103RB. <br /> If you want to use other STM32 boards, plea...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The examples provided are based on the STM32F103RBT6 and the STM32H743, the connection provided is based on the STM32F103RB.
If you want to use other STM32 boards, please change the connection and you may need to port the codes yourself.

Hardware connection

Hardware connection-STM32
Connect to STM32F103RBT6
Infrared Proximity STM32 Description
VCC 3.3V Power input
GND GND Ground
AOUT PA6 Analog data output
DOUT PA4 Digital data output

Examples

The examples are based on the HAL library. Please download the demo codes, unzip them and find the STM32 examples.

  • Open the project from Infrared_Proximity_Sensor_Demo\STM32\STM32F103RB\MDK-ARM by Keil.
  • Build the project and program it to the STM32 board.
MQ5 STM32 2.jpg
  • connect the UART1 of the STM32 board to the PC and check the serial data by SCCOM software.
Infrared Proximity STM32 3.png

Expected result

  • When a barrier is placed near the sensor, the signal indicator will turn on or else turn off.
  • The serial output will change according to the distance between the module and the barrier.