This project is for a quadcopter using a WiFi controlled flight controller that you can control from your phone. The flight controller also interfaces with Robotic Operating System (ROS) to support live debugging and data logging with open-sourced industry tools.
Control from Phone/Web, Send Commands to Drone, View data live using ROS
This repo provides the design files for the custom flight controller hardware and software as well as a parts list for building a working quadcopter with the custom flight controller.
The flight controller is a single-board design with accelerometers, microcontroller, wifi, battery monitoring, ESC connector, and status LEDs.
Top | Bottom |
---|---|
Gerber files used to order this PCB are included in the latest release, here
Parts list to assembly final board can be found in the BOM, here
- 2-Layer design with top and bottom ground plane.
- Antenna clearance complies with ESP32 specification to help prevent interference to WiFi Signal.
- IMU orientation aligned with drone frame. Design supports both ISO-20600 and MPU2060 IMU components.
- Standard 30.5mm by 30.5mm flight controller mounting pattern
- Eectrical interface using JST-SH 8 Pin connector (compatible with SpeedyBee BL32 50A V3 ESC for stacked ESC/Flight Controller layout).
- Single Supply (3S LiPo) powering both ESC as well as flight controller (Powered through JST-SH Connector).
- Status LEDs to quickly see if Wifi is connected, if software is recieving commands from remote controller, etc.
- Built-in ESC Firmware debug interface with BLHeli Suite (Coming Soon).
- Arduino-based C++.
- Wifi controlled using a phone with browser, provides battery life status as well as controls for Up, Down, Left, Right, etc.
- Robotic Operating System (ROS) interface provides live feed of IMU data, flight controller status, user commands, and ESC throttle to each motor. (must have variable USE_ROS = True).
- PID-based flight stability controller (Coming Soon).
- "Testing Mode" allows user to test throttle of each motor, calibrate PID controller without reflashing flight controller (Coming Soon).
Run script to compute IMU calibration:
Reading sensors for first time...
Results of measurements a/g: 0.23 0.53 12.09 -0.03 -0.02 0.01
Calculating offsets...
Results of measurements a/g: -0.00 -0.00 9.81 0.00 0.00 0.00
...
Calibration successful!
Results of measurements a/g: -0.01 0.00 9.81 0.00 0.00 -0.00
FINISHED!
Sensor readings with offsets: -0.01 0.00 9.81 0.00 0.00 -0.00
Your offsets: -0.23 -0.53 -2.29 0.03 0.02 -0.01
Create a ROS interface where you can view and log data from your quadcopter live.
From a PC with ROS installed, run:
roscore
In another terminal from PC run:
roslaunch rosserial_server socket.launch
This will create a rosserial server to interface with the nodeMCU controller.
In another terminal launch:
rosrun imu_complementary_filter complementary_filter_node
In another terminal launch:
rqt
to see the following visualization of your drone's data!
The UI for remote control is deployed over WiFi to a static IP address accessible to a phone logged on to the Flight Controller's hosted WiFi network.
Commands available:
Up, Down, Left, Right, Forward, Backward, Rotate Left, Rotate Right
If not command is given, the drone will hold in place.
This flight controller was tested with a 5 inch FPV Frame, although other frames could be used with tuning of the flight controller.
Physical Size: ~450 grams, 5 inch FPV
Frame:
Battery Size: 3S Lipo
Motors: brushless DC
ESC: Speedybee 4-in-1 ESC
For full BOM, click here
Using Arduino Nano as an interface (4wArduino_Nano__16_MULTIv20005.hex) with ESC plugged into pin D4. The opposite corner motors were set to clockwise and counter-clockwise, respectively. NOTE: this can be done in BLHeli software to correct the direction of the motor if the motor was wired incorrectly to the ESC. Brushless DC motors have 3 wires A, B, and C and the order determines the direction.
PID Controller: https://github.com/0xekez/arduino-drone-pid/blob/master/pid_v2_in_arduino/pid_v2_in_arduino.ino https://www.youtube.com/watch?v=hGcGPUqB67Q https://www.youtube.com/watch?v=wkfEZmsQqiA https://github.com/bolandrm/rmb_multicopter