This video tutorial demonstrates establishing two-way wireless communication between two CH32 microcontrollers (a host/sender and a slave/receiver) using inexpensive CH9141 Bluetooth modules. The core focus is on configuring the modules and implementing the firmware logic necessary for reliable serial communication.
The sender utilizes a dual-USART setup, one port communicating with a PC terminal and the other with the Bluetooth module, while managing the module's AT/transfer mode via a GPIO pin. The tutorial details the use of AT commands (specifically MAC address inquiry) required to link the devices. The receiver is programmed to process commands via a simple protocol, demonstrating functionality through LED toggling and returning mock sensor data. This setup provides a foundation for low-power, long-range (100m) wireless applications, such as remote controllers and distributed sensor networks.
CH32 Microcontroller Wireless Communication with CH9141 Bluetooth Modules
0:05 Basic Communication Setup: The tutorial, part 15 of the CH32 series, focuses on setting up fundamental two-way communication between two CH32 microcontrollers using affordable, external CH9141 Bluetooth modules.
1:03 Hardware Configuration: The demonstration uses a CH32 V006K8U6 board as the sender (host/master) and a CH32 V003F4P6 board as the receiver (slave). The receiver includes an indicator LED.
1:48 Sender (Host) Connectivity: The host board is chosen for its two USART ports: one for PC terminal communication (logging/sending commands) and the second for Bluetooth communication. An additional GPIO pin is used to switch the Bluetooth module between AT command mode and data transfer mode.
4:12 AT Command Instruction Set: The CH9141 modules are configured using AT commands. The most critical step is acquiring the receiver's MAC address (AT+ADR?) so the sender can target the connection.
5:21 Receiver Code Logic: The receiver buffer (64 bytes) is explained, alongside the logic for handling incoming serial data, specifically detecting the end of a message using the Line Feed (\n) character.
12:17 Command Processing: The receiver is programmed with a simple command structure where messages starting with ! trigger specific actions: !A toggles the receiver's indicator LED (PD3), and !T, !H, and !P return dummy temperature, humidity, and pressure values, respectively, demonstrating two-way communication.
16:03 Sender Code Implementation: The sender code utilizes interrupts for receiving data from the Bluetooth module (USART2) and polling for commands from the PC (USART1), enabling continuous, smooth data transfer.
26:14 Initialization Sequence: The process for initializing the Bluetooth module is detailed, which involves switching to AT mode, sending initialization strings (like "hello"), and configuring parameters such as the device name and target MAC address.
33:36 Live Demo: The live test confirms successful bi-directional communication, showing the PC commands being echoed back, sensor inquiries returning values, and successful remote toggling of the LED on the receiver board.
34:56 Configuration Management: It is noted that certain configuration changes, such as modifying the Bluetooth mode, require the module to be reset (AT+RST) to apply.
38:29 Key Takeaway & Range: This setup provides a reliable link for building remote control or remote monitoring systems, offering an operating range of up to 100 meters.