Cirkit Designer Logo
Cirkit Designer
Your all-in-one circuit design IDE
Home / 
Component Documentation

How to Use XY-MD02: Examples, Pinouts, and Specs

Image of XY-MD02
Cirkit Designer LogoDesign with XY-MD02 in Cirkit Designer

Introduction

The XY-MD02 is a wireless Bluetooth module designed for seamless communication between devices. It supports serial communication (UART) and operates using the Bluetooth 4.0 protocol, making it ideal for low-power and high-speed data transmission. This module is widely used in IoT applications, enabling microcontrollers to connect to smartphones, tablets, or other Bluetooth-enabled devices. Its compact size and ease of integration make it a popular choice for hobbyists and professionals alike.

Explore Projects Built with XY-MD02

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Battery-Powered Health Monitoring System with Nucleo WB55RG and OLED Display
Image of Pulsefex: A project utilizing XY-MD02 in a practical application
This circuit is a multi-sensor data acquisition system that uses a Nucleo WB55RG microcontroller to interface with a digital temperature sensor (TMP102), a pulse oximeter and heart-rate sensor (MAX30102), and a 0.96" OLED display via I2C. Additionally, it includes a Sim800l module for GSM communication, powered by a 3.7V LiPo battery.
Cirkit Designer LogoOpen Project in Cirkit Designer
Arduino Mega 2560 Controlled Motor System with I2C Communication and Hall Effect Sensing
Image of Uni1: A project utilizing XY-MD02 in a practical application
This is a motor control system with feedback and sensor integration. It uses an Arduino Mega 2560 to control MD03 motor drivers for DC motors, receives position and speed feedback from HEDS encoders and Hall sensors, and measures distance with SR02 ultrasonic sensors. Logic level converters ensure compatibility between different voltage levels of the components.
Cirkit Designer LogoOpen Project in Cirkit Designer
Arduino Nano-Based Wireless Joystick and Motion Controller
Image of hand gesture: A project utilizing XY-MD02 in a practical application
This circuit features an Arduino Nano microcontroller interfaced with an HC-05 Bluetooth module, an MPU-6050 accelerometer/gyroscope, and a KY-023 Dual Axis Joystick Module. The Arduino Nano is powered by a 9V battery through a rocker switch and communicates with the HC-05 for Bluetooth connectivity, reads joystick positions from the KY-023 module via analog inputs, and communicates with the MPU-6050 over I2C to capture motion data. The circuit is likely designed for wireless control and motion sensing applications, such as a remote-controlled robot or a game controller.
Cirkit Designer LogoOpen Project in Cirkit Designer
Wireless Joystick-Controlled Interface with Arduino Nano and NRF24L01
Image of Transmitter 11: A project utilizing XY-MD02 in a practical application
This circuit features an Arduino Nano interfaced with a KY-023 Dual Axis Joystick Module for analog input, and an NRF24L01 module for wireless communication. The joystick provides x and y-axis control signals to the Arduino's analog inputs and a switch signal to a digital input, while the NRF24L01 enables the Arduino to communicate with other devices wirelessly. The 2x 18650 batteries supply power to the Arduino, which in turn powers the joystick and the NRF24L01 module.
Cirkit Designer LogoOpen Project in Cirkit Designer

Explore Projects Built with XY-MD02

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Image of Pulsefex: A project utilizing XY-MD02 in a practical application
Battery-Powered Health Monitoring System with Nucleo WB55RG and OLED Display
This circuit is a multi-sensor data acquisition system that uses a Nucleo WB55RG microcontroller to interface with a digital temperature sensor (TMP102), a pulse oximeter and heart-rate sensor (MAX30102), and a 0.96" OLED display via I2C. Additionally, it includes a Sim800l module for GSM communication, powered by a 3.7V LiPo battery.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of Uni1: A project utilizing XY-MD02 in a practical application
Arduino Mega 2560 Controlled Motor System with I2C Communication and Hall Effect Sensing
This is a motor control system with feedback and sensor integration. It uses an Arduino Mega 2560 to control MD03 motor drivers for DC motors, receives position and speed feedback from HEDS encoders and Hall sensors, and measures distance with SR02 ultrasonic sensors. Logic level converters ensure compatibility between different voltage levels of the components.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of hand gesture: A project utilizing XY-MD02 in a practical application
Arduino Nano-Based Wireless Joystick and Motion Controller
This circuit features an Arduino Nano microcontroller interfaced with an HC-05 Bluetooth module, an MPU-6050 accelerometer/gyroscope, and a KY-023 Dual Axis Joystick Module. The Arduino Nano is powered by a 9V battery through a rocker switch and communicates with the HC-05 for Bluetooth connectivity, reads joystick positions from the KY-023 module via analog inputs, and communicates with the MPU-6050 over I2C to capture motion data. The circuit is likely designed for wireless control and motion sensing applications, such as a remote-controlled robot or a game controller.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of Transmitter 11: A project utilizing XY-MD02 in a practical application
Wireless Joystick-Controlled Interface with Arduino Nano and NRF24L01
This circuit features an Arduino Nano interfaced with a KY-023 Dual Axis Joystick Module for analog input, and an NRF24L01 module for wireless communication. The joystick provides x and y-axis control signals to the Arduino's analog inputs and a switch signal to a digital input, while the NRF24L01 enables the Arduino to communicate with other devices wirelessly. The 2x 18650 batteries supply power to the Arduino, which in turn powers the joystick and the NRF24L01 module.
Cirkit Designer LogoOpen Project in Cirkit Designer

Common Applications and Use Cases

  • Wireless data transmission between microcontrollers and smartphones
  • IoT devices and smart home automation
  • Remote control systems
  • Wireless sensor networks
  • Robotics and industrial automation

Technical Specifications

The XY-MD02 module is designed to provide reliable and efficient Bluetooth communication. Below are its key technical specifications:

Parameter Value
Bluetooth Version 4.0 (Low Energy)
Communication Protocol UART (Serial Communication)
Operating Voltage 3.3V to 6V
Operating Current 8mA (typical)
Baud Rate 9600 bps (default, configurable)
Transmission Range Up to 10 meters (line of sight)
Dimensions 37mm x 15mm x 7mm
Operating Temperature -20°C to 70°C

Pin Configuration and Descriptions

The XY-MD02 module has 6 pins, as described in the table below:

Pin Name Description
1 VCC Power supply input (3.3V to 6V). Connect to the power source.
2 GND Ground. Connect to the ground of the circuit.
3 TXD Transmit data pin. Sends serial data to the connected microcontroller.
4 RXD Receive data pin. Receives serial data from the connected microcontroller.
5 EN (Key) Enable pin. Used to switch between command and data modes.
6 STATE Status indicator pin. High when connected to a device, low when disconnected.

Usage Instructions

The XY-MD02 module is straightforward to use and can be easily integrated into a circuit. Below are the steps and best practices for using the module:

Connecting the XY-MD02 to a Microcontroller

  1. Power Supply: Connect the VCC pin to a 3.3V or 5V power source and the GND pin to the ground.
  2. Serial Communication:
    • Connect the TXD pin of the module to the RX pin of the microcontroller.
    • Connect the RXD pin of the module to the TX pin of the microcontroller.
  3. Enable Pin: Leave the EN pin unconnected for normal operation. Pull it high to enter AT command mode.
  4. Status Pin: Optionally, connect the STATE pin to an LED or microcontroller input to monitor the connection status.

Example: Using XY-MD02 with Arduino UNO

Below is an example of how to use the XY-MD02 module with an Arduino UNO to send and receive data via Bluetooth.

Circuit Diagram

  • Connect VCC to the 5V pin on the Arduino.
  • Connect GND to the GND pin on the Arduino.
  • Connect TXD to pin 10 on the Arduino (software serial RX).
  • Connect RXD to pin 11 on the Arduino (software serial TX).

Arduino Code

#include <SoftwareSerial.h>

// Define software serial pins for the XY-MD02 module
SoftwareSerial bluetooth(10, 11); // RX, TX

void setup() {
  // Initialize serial communication for debugging
  Serial.begin(9600);
  // Initialize Bluetooth module communication
  bluetooth.begin(9600); // Default baud rate for XY-MD02
  Serial.println("Bluetooth module ready. Waiting for connection...");
}

void loop() {
  // Check if data is available from the Bluetooth module
  if (bluetooth.available()) {
    char received = bluetooth.read(); // Read the incoming data
    Serial.print("Received: ");
    Serial.println(received); // Print the received data to the serial monitor
  }

  // Check if data is available from the serial monitor
  if (Serial.available()) {
    char toSend = Serial.read(); // Read the data from the serial monitor
    bluetooth.write(toSend); // Send the data to the Bluetooth module
    Serial.print("Sent: ");
    Serial.println(toSend); // Print the sent data to the serial monitor
  }
}

Important Considerations and Best Practices

  • Voltage Levels: Ensure the module operates within its voltage range (3.3V to 6V). If using a 3.3V microcontroller, use a level shifter for the TXD and RXD pins.
  • Baud Rate: The default baud rate is 9600 bps. Use AT commands to change it if needed.
  • Command Mode: Pull the EN pin high to enter AT command mode for configuration. Use a serial terminal to send AT commands.
  • Antenna Placement: Avoid placing the module near metal objects or other RF sources to ensure optimal signal strength.

Troubleshooting and FAQs

Common Issues and Solutions

  1. Module Not Responding

    • Cause: Incorrect wiring or power supply.
    • Solution: Double-check the connections and ensure the module is powered correctly.
  2. No Data Transmission

    • Cause: Baud rate mismatch between the module and microcontroller.
    • Solution: Verify the baud rate settings and adjust if necessary using AT commands.
  3. Unstable Connection

    • Cause: Interference or poor signal strength.
    • Solution: Ensure the module is within the specified range and away from interference sources.
  4. Cannot Enter AT Command Mode

    • Cause: EN pin not pulled high.
    • Solution: Pull the EN pin high and reset the module to enter command mode.

FAQs

Q1: Can the XY-MD02 module be used with a 3.3V microcontroller?
A1: Yes, the module supports 3.3V operation. However, ensure proper voltage level shifting for the TXD and RXD pins if needed.

Q2: How do I reset the module to factory settings?
A2: Enter AT command mode and send the AT+RESET command to reset the module.

Q3: What is the maximum data rate supported by the module?
A3: The module supports a maximum baud rate of 115200 bps, configurable via AT commands.

Q4: Can I use the module for audio transmission?
A4: No, the XY-MD02 is designed for data transmission only and does not support audio profiles.

By following this documentation, you can effectively integrate and use the XY-MD02 Bluetooth module in your projects.