How to Test Bluetooth Module Data with Arduino Board

To carry out the data transmission test between the Bluetooth module and Arduino, you can follow the steps below:

  • Make sure you have connected the Bluetooth module and Arduino. Usually, the VCC and GND pins of the Bluetooth module are connected to the 5V and GND pins of the Arduino, and the TX and RX pins of the Bluetooth module are connected to two digital pins of the Arduino (for example, TX is connected to the RX of the Arduino pin, RX to the Arduino’s TX pin).
  • Open a new blank project in the Arduino IDE.
  • Import the SoftwareSerial library to emulate serial communication on the digital pins. You can import this library by clicking on the “Sketch” menu, then selecting “Include Library” -> “SoftwareSerial”.
  • Define the connection pins of the Bluetooth module in the code. For example, use the following code to connect the TX pin of the Bluetooth module to the Arduino’s digital pin 2 and the RX pin to the Arduino’s digital pin 3:
Arduino Board Bluetooth Module1
  • In the setup() function, initialize the serial port communication and set the baud rate. Usually, the default baud rate of the MuYu Bluetooth module is 115200, so you can use the following code to initialize the serial port:
Arduino Board Bluetooth Module2
  • In the loop() function, you can use the Serial object to receive data from the serial port and send it out through the Bluetooth module, and you can also receive data through the Bluetooth module and print it out through the Serial object. For example, the following code sends the data received from the serial port to the Bluetooth module, and prints the data received from the Bluetooth module to the serial port:
Arduino Board Bluetooth Module3
  • Upload the code to Arduino, and open the serial monitor.
  • Open a serial terminal program (such as the serial monitor of Arduino IDE, CoolTerm, etc.), input and send data through the serial port, you should be able to see the data sent by the Bluetooth module in the terminal program, and the data you input in the terminal program is also Should be able to send to Arduino via Bluetooth module and show up in serial monitor.

Share:

More News

Bluetooth Module in Smart Sports Bracelet

Working Principle and Advantages of Bluetooth Module in Smart Sports Bracelet

In recent years, smart wearable devices have become more and more popular. As the simplest and most convenient device, wristbands have become a must-have in our daily lives. In particular, health issues have received great attention. For sports enthusiasts, sports wristbands can not only calculate the daily amount of exercise and calories consumed every day, but it is also a trend.

Small appliance Bluetooth data module

Multi-function Bluetooth Data Module Solution for Small Household Appliances LED Display

The rapid advancement of technology has ushered in an era where convenience and connectivity are paramount. Small household appliances, which once served singular purposes, are now becoming increasingly sophisticated, incorporating smart features that enhance user experience. One such innovation is the integration of multi-function Bluetooth data modules with LED displays in small household appliances.

Scroll to Top