This video is a detailed tutorial on establishing wireless, two-way communication between two CH9141 Bluetooth modules using CH32 microcontrollers. The setup consists of a sender (host) built on a CH32V006 and a receiver (slave) using a CH32V003. The tutorial provides a comprehensive walkthrough of the code for both devices, explaining the hardware configuration, USART setup, and the logic for data transmission and reception.
A key focus is the use of the CH9141's AT command set to configure the modules, including setting the target MAC address to establish a connection. The sender's code utilizes interrupts and two separate USART ports to manage communication between a PC terminal and the Bluetooth module. The receiver's code implements a simple command parser to act on received messages, such as toggling an LED or returning simulated sensor data. A live demonstration confirms the successful implementation, showcasing command execution, data echoing, and the critical process of resetting the module to apply certain configuration changes.
Establishing Two-Way Wireless Communication with CH9141 Bluetooth Modules
0:00:02 Project Goal: This tutorial demonstrates how to create a basic wireless communication link between two CH9141 Bluetooth modules, intended as a foundation for a low-power remote controller project.
1:06 Hardware Setup: The demonstration uses two microcontrollers: a CH32V006 as the sender (master) and a CH32V003 as the receiver (slave). Each is connected to a CH9141 module. The sender board utilizes two USART ports—one for PC communication and one for the Bluetooth module.
2:45 Using AT Commands: The video emphasizes the importance of the CH9141 datasheet, particularly the AT instruction set, which is essential for configuring the modules before data transmission.
5:23 Receiver Code Logic: The receiver's code is explained, which continuously polls the USART for incoming data. It buffers characters until a complete line is received and then processes it based on a simple custom protocol where commands are prefixed with an exclamation mark (!).
11:40 Two-Way Communication Protocol: The receiver is programmed to respond to specific commands. For example, sending !A toggles an LED, while sending !T or !H prompts the receiver to send back simulated temperature or humidity data, confirming a functional two-way link.
16:01 Sender Code Logic: The sender's code is more complex, using interrupts to receive data from the Bluetooth module and acting as a bridge to pass data between the PC serial terminal and the remote receiver module.
29:39 Connecting the Modules: A critical step for the sender is to enter AT command mode to set the MAC address of the receiver it needs to connect to (AT+CSET=[MAC_ADDR]). The connection status can then be queried (AT+STAT?), with a response of 3 indicating a successful link.
31:13 Live Demonstration: A successful live demo shows the creator sending commands from a PC terminal to the sender, which relays them to the receiver. The receiver acts on the commands (e.g., toggling an LED) and sends a response back to the PC.
35:01 Applying Configuration Changes: A key takeaway is demonstrated: some AT commands, like changing the device name or Bluetooth mode, require an AT+RESET command to be sent afterward for the new settings to take effect.
38:36 Future Applications & Resources: The established communication method is suitable for various projects like remote sensors or remote controls, leveraging the CH9141's 100-meter range. The complete source code for both the sender and receiver is available on the creator's GitHub.