MQTT protocol realizes remote data collection and control of Android mobile phones

The design uses STM32F405 as the main control chip, and publishes it to the MQTT server in the MQTT protocol through the W5500 module, and finally realizes data collection and control on the mobile phone client.
components
Hardware Components
W5500 module
X 1
STM32F405RGT6 development board
X 1
details

Fmwmu_cMwL3jjZASuD8Rb_9_w1ve.png

The design uses STM32F405 as the main control chip, and publishes it to the MQTT server in the MQTT protocol through the W5500 module, and finally realizes data collection and control on the mobile phone client.

The main function:

1. STM32F405 is the main control chip, which collects environmental data through sensors, such as temperature, humidity, illuminance, atmospheric pressure, etc.;

2. The main control chip publishes the measured data to the MQTT server through the MQTT protocol through the W5500 module (see the firmware program for the server domain name and IP);

3. The master subscribes to the message controlled by the LED light, and turns on or off the corresponding LED light after receiving the corresponding control instruction;

4. The Android mobile phone subscribes to the sensor data message, and displays the sensor data on the interface after receiving the message;

5. Android phones can send instructions to turn on or off the LED lights to the server, and then the server will forward the instructions to the STM32 main control, and then the STM32 main control parses the instructions and executes the instructions.

Specific design introduction:

1. MQTT protocol:

MQTT is an instant messaging protocol developed by IBM. MQTT is a connection protocol for M2M and the Internet of Things, using a lightweight publish and subscribe message transmission mechanism. Mosquitto is an open source message broker software that implements the MQTT v3.1 protocol. It provides a lightweight message push mode that supports publish/subscribe, making device-to-device short message communication simple and easy to use.

2. Single-chip implementation

The hardware connection is shown in the figure below:

3. Implementation of the code on the mobile phone

Just add the jar file to the project, the program interface is as follows:

4. Measured results

1. The sensor data is updated regularly on the MCU side, and the mobile phone side will also be updated synchronously;

2. Click on the 4 LED control buttons on the mobile phone, and the corresponding LED will be turned on or off on the board.

Module list:

1. W5500 module

2.STM32F405RGT6 development board (Micro Python circuit board)

3. Android phones

COMMENTS

Please Login to comment
  Subscribe  
Notify of
POSTED BY
TAGS
Reusable S/W