Skip to content

Wireless Plotter

Data visualization is an important tool for drone debugging. In this project, you will learn how to transmit the drone’s flight data back to the computer via Wi-Fi and plot curves in real-time.

  • Wi-Fi communication
  • UDP protocol
  • Data visualization
  • Python scripts
ItemQuantityNotes
ESP32 Drone1-
Computer1With Python + Matplotlib installed
plotter.py1Data visualization script

Extract wifi_telemetry.zip and open with VS Code.

Open wifilink.c and find the wifilink_send_data function:

void wifilink_send_data(float altitude, float roll, float pitch, float yaw) {
// 1. Package data in JSON format
char buffer[256];
sprintf(buffer, "{\"alt\":%.2f,\"roll\":%.2f,\"pitch\":%.2f,\"yaw\":%.2f}",
altitude, roll, pitch, yaw);
// 2. Send to computer via UDP
struct sockaddr_in dest_addr;
dest_addr.sin_family = AF_INET;
dest_addr.sin_port = htons(8888);
dest_addr.sin_addr.s_addr = inet_addr("192.168.4.2"); // Computer IP
sendto(sock, buffer, strlen(buffer), 0,
(struct sockaddr*)&dest_addr, sizeof(dest_addr));
}

Compile and flash the code, power on the drone (it will create Wi-Fi hotspot: ESP-Drone).

Run plotter.py:

Terminal window
python plotter.py

Observe the altitude and attitude curves plotted in real-time on the computer.

Modify plotter.py to add “altitude anomaly alert”, displaying red warning in terminal when altitude change exceeds 0.5m/s.

  • Check if password is correct
  • Confirm drone is powered on
  • Check if IP address is correct
  • Confirm firewall settings

Congratulations! You have implemented the drone’s data visualization function, which is an important tool for debugging!

In the next project, you will learn how to achieve simple communication between two drones.