Skip to content

Multi-Drone Communication

Multi-drone coordination is a cutting-edge direction in drone technology. In this project, you will learn how to achieve simple communication between two drones and understand wireless communication principles.

  • Wireless communication principles
  • ESP-NOW protocol
  • Multi-drone coordination strategies
  • Leader-follower mode
ItemQuantityNotes
Two Fully Assembled Drones2Drone A and Drone B
Computer1With VS Code + ESP-IDF environment
USB Cables2For programming

ESP32 supports Wi-Fi and ESP-NOW communication protocols.

ESP-NOW is a low-latency, low-power point-to-point communication protocol suitable for communication between drones.

In the components/drivers/general/wifi directory, understand ESP-NOW configuration and usage methods.

Configure ESP-NOW separately for Drone A and Drone B, setting communication addresses.

void sendPositionToFollower() {
float x, y, z;
estimatorGetPosition(&x, &y, &z);
// Build message
uint8_t message[12];
memcpy(message, &x, 4);
memcpy(message + 4, &y, 4);
memcpy(message + 8, &z, 4);
// Send message
esp_now_send(follower_mac, message, sizeof(message));
}
void onDataRecv(const uint8_t *mac_addr, const uint8_t *data, int data_len) {
if (data_len == 12) {
float leader_x, leader_y, leader_z;
memcpy(&leader_x, data, 4);
memcpy(&leader_y, data + 4, 4);
memcpy(&leader_z, data + 8, 4);
// Follow the leader
float follower_x = leader_x - 1.0; // Keep 1 meter distance
float follower_y = leader_y;
float follower_z = leader_z;
commanderSetPositionSetpoint(follower_x, follower_y, follower_z, 0);
}
}
  1. Compile Drone A and Drone B code separately
  2. Flash to corresponding drones
  3. Power on and test, observe if Drone B can follow Drone A
  • Check if MAC addresses are correct
  • Confirm ESP-NOW is initialized
  • Check position data
  • Adjust following parameters

Congratulations! You have completed all intermediate projects and mastered drone programming and debugging skills!

You are now ready to enter the advanced level and learn more complex algorithms and system integration.