STM32F103 microcontroller temperature and humidity monitoring Android mobile phone Bluetooth APP display control design

      This time I will introduce to you a monitoring design for temperature, humidity, light and smoke, including switching lights. Based on STM32F103 single-chip microcomputer (Zhengdian Atom mini board), Bluetooth module, and Android APP. The software is Android studio version 2021.1. First, let’s show the designed object first. 

Next, it will be explained from the two parts of hardware and software.

1. Hardware part

       The hardware part is composed of STM32F103RCT6 single-chip microcomputer, various sensors ( replaced by variables in the program, which is convenient for transplantation ), Bluetooth serial port module HC05 and Android mobile phone. The sensor transmits the collected temperature and humidity data to the single-chip microcomputer, and then the single-chip microcomputer sends the data to the mobile APP through the Bluetooth serial port module, thereby displaying the sensor data on the APP. Alarm thresholds can be set on the APP. Let's take a look at the overall architecture diagram:

       The RXD and TXD of the Bluetooth serial port module are respectively connected to the TXD and RXD of the serial port 2 of the microcontroller, and the VCC and GND are respectively connected to the 5V and GND of the microcontroller . Two pins, the reason is: the bluetooth module is in slave mode by default. It can be directly paired with the APP , eliminating the complicated AT command process, so this MCU program is suitable for all Bluetooth modules. The APP program is only suitable for classic Bluetooth, HC05 and the like, and the APP for low-power Bluetooth such as HC08 and BT05 will be written later.

      The function of the serial port module is the mutual conversion between the serial port protocol and the Bluetooth protocol. It is very complicated to write a set of Bluetooth driver codes on the microcontroller. With this module, we only need to write the code for serial port sending and receiving when writing the microcontroller code. The module will convert the serial port data into Bluetooth data. For the APP, it receives Bluetooth data. When developing an APP, you only need to write Bluetooth-related codes. Android encapsulates Bluetooth-related APIs, so it is easy to develop.

2. Software part

STM32 variable data reporting: 

 Android data reception shows:

 Android threshold command issued:

Android switch command issued:

STM32 receives commands and parses:

 

Since then, all functions have been realized, and the debugging has passed. The program is simple and easy to learn and transplant.

video display

Resource directory:

Note: Because json parsing is used, the fourth jansson file in the directory can be installed by clicking on the computer.

*** Resource download

Guess you like

Origin blog.csdn.net/th971212/article/details/125053053