Differences

This shows you the differences between two versions of the page.

Link to this comparison view

pm:prj2026:jan.vaduva:sconstantin2203 [2026/05/18 18:18]
sconstantin2203 [Circuit Diagram]
pm:prj2026:jan.vaduva:sconstantin2203 [2026/05/24 02:43] (current)
sconstantin2203 [Rezultate Obţinute]
Line 6: Line 6:
 ===== Descriere generală ===== ===== Descriere generală =====
  
-The drone'​s flight controller functions are executed by a ESP32 C6 super-mini paired with an MPU6050 ​Inertial Measuring Unit, which provides the raw data necessary for stabilization. To determine the drone’s precise orientation,​ a complementary filter is used and it blends high-frequency gyroscope data with stable accelerometer readings to achieve a balance between short-term accuracy and long-term stability. This orientation data feeds into a continuous control loop where a Proportional-Integral-Derivative (PID) controller calculates the required throttle adjustments based on the error between the desired and actual state, with these commands then being transmitted to the motors as Pulse Width Modulation (PWM) signals. ​ Instead of a traditional radio transmitter,​ the drone is managed via a dedicated web interface stored in the microcontroller'​s flash memory and accessed through a local area network, providing a streamlined,​ browser-based control platform for the operator. The physical frame is made of 4 3d printed arms attached to a 3mm+The drone'​s flight controller functions are executed by a ESP32 C6 super-mini paired with an MPU6500 ​Inertial Measuring Unit, which provides the raw data necessary for stabilization. To determine the drone’s precise orientation,​ a complementary filter is used and it blends high-frequency gyroscope data with stable accelerometer readings to achieve a balance between short-term accuracy and long-term stability. This orientation data feeds into a continuous control loop where a Proportional-Integral-Derivative (PID) controller calculates the required throttle adjustments based on the error between the desired and actual state, with these commands then being transmitted to the motors as Pulse Width Modulation (PWM) signals. ​ Instead of a traditional radio transmitter,​ the drone is managed via a dedicated web interface stored in the microcontroller'​s flash memory and accessed through a local area network, providing a streamlined,​ browser-based control platform for the operator. The physical frame is made of 4 3d printed arms attached to a 3mm
 polycarbonate sheet. polycarbonate sheet.
  
Line 16: Line 16:
 ^ Component ^ Quantity ^ ^ Component ^ Quantity ^
 | ESP32-C6-Super-Mini | 1 | | ESP32-C6-Super-Mini | 1 |
-MPU6050 ​(IMU) | 1 |+MPU6500 ​(IMU) | 1 |
 | A2208 1400KV 14T BLDC Motor | 4 | | A2208 1400KV 14T BLDC Motor | 4 |
 | 30A ESC | 4 | | 30A ESC | 4 |
Line 23: Line 23:
 | Samsung 35E 18650 3500mAh 8A | 12 | | Samsung 35E 18650 3500mAh 8A | 12 |
  
-===== Circuit Diagram =====+ESP32-c6-super-mini:​ This is the microcontroller and it will receive the input from the remote interface and use it for the calculations that will result in the output needed by the motors. Almost all the pins on the microcontroller can do the same things (PWM, SPI), so I chose them in the most convenient way possible for the circuit layout on the breadboard. I chose pins 4, 5, 6, 7 for SPI, leaving them to be defined in the software as SCLK, MOSI, MISO, and CS. The pins chosen for the motors must be capable of PWM, and since all pins on the microcontroller are capable of producing a PWM signal, I chose pins 20, 19, 18, 15 for the 4 motors.
  
-{{:pm:​prj2026:​jan.vaduva:const_sebastian_schema_electrica.png?800|}}+MPU6500This is the most important component of the drone, as it provides the information regarding the attitude of the UAV. This IMU is compatible with both I2C and SPI, but I chose SPI due to its higher speedFor SPI, the following pins are usedSCLK, SDI, SDO, NCS.
  
-ESP32-c6-super-miniAproape toti pinii de pe microcontroller ​pot face aceleasi lucruri (PWM, SPI), asa ca i-am ales intr-un mod cat mai convenabil pentru asezarea circuitului pe breadboardAm ales pinii 4, 5, 6, 7 pentru SPI, ramanand sa fie definiti in software ca SCLK, MOSI, MISO si CS. Pinii alesi pentru motoare trebuie sa fie capabili de PWM, iar toti pinii de pe microcontroller sunt capabili de a produce semnal PWM, asadar, am ales pinii 20, 19, 18, 15 pentru cele 4 motoare.+Power Distribution BoardThis module is connected to the drone'​s battery and distributes power to the ESCs and the microcontroller. ​I connected the 5V terminals to the power pins of the ESP and the motor power terminals to the ESCs.
  
-MPU6500Acest IMU este compatibil si cu I2C si cu SPI, insa am ales SPI datorita vitezei mai mari acestuiaPentru SPI sunt folositi pinii: SCLK, SDI, SDONCS.+ESCThey are used to keep constant motor speed by taking power from the PDB and providing it to the motors and the power is proportional to the input received from the microcontrollerI connected their signal to the PWM pins of the microcontrollerand they are powered by the power distribution board.
  
-Power Distribution BoardAcest modul este legat de bateria dronei si distribuie curent catre ESC-uri si microcontroller. Am conectat bornele de 5V la pinii de alimentare ai ESP-ului si bornele de alimentare ale motoarelor la ESC.+BMSThe battery management system is needed to have a safe battery pack so they charge uniformly and don't overdeplete.
  
-ESCLe-am conectat semnalul la pinii PWM ai microcontrollerului si sunt alimentati de power distribution board.+{{:pm:​prj2026:​jan.vaduva:​drone_top.jpeg?​350|}}{{:​pm:​prj2026:​jan.vaduva:​drone_side.jpeg?​350|}} 
 +{{:​pm:​prj2026:​jan.vaduva:​drone_proof.jpeg?700|}}
  
 +===== Circuit Diagram =====
 +
 +{{:​pm:​prj2026:​jan.vaduva:​const_sebastian_schema_electrica.png?​800|}}
 ===== Software Design ===== ===== Software Design =====
  
-<note tip> +Up until now I've implemented a driver for the SPI data transfer of the accelerometer and gyroscope data from the MPU6500. That data would be further processed by multiplying it by the scalar for the chosen resolution. The scaled data would further be polled at a bigger frequency than the control loop, counting how many readings would happen between each loop and then dividing the summed data by that number, achieving an oversampling effect to remove noise from the data. A lowpass filter would be applied over both accelerometer and gyroscope data to remove the low frequency noise create by mechanical movements. What remains is clean data that is fused into a single attitude measurement with a complementary filter. At startup, the sensor goes through a calibration process in which the average of multiple stationary readings is taken and saved as a stationary error which is later subtracted from each reading.
-</​note>​+
  
-===== Rezultate Obţinute =====+UAVs should handle unpredictable disruptions,​ the most unpredictable of which can be the pilot so I wrote a function to interpolate the current throttle to the desired throttle to soften quick changes made by the pilot. Controlling the drone is easy; the remote is made of a direction knob which tilts the drone in the desired direction and a throttle knob which tells the motors how fast they should spin. The remote is a web interface served by the microcontroller if the browser is connected to the microcontroller'​s local network. Websockets transmit the data from the remote to the microcontroller.
  
-<note tip> +The attitude measurement is used to compute the input for the PID controller. The input for the controller is the error given by the difference in the attitude of the UAV and the desired attitude which is set by the pilot. The flow of the program is based on a 30ms period flow of inputs from the remote, a 250Hz control loop, and the program loop in which they are processed and used. As a safety measure, a neutral attitude and a low throttle is set if there have been more than 35ms from the last input, being activated by a watchdog timer. Absence of input data isn't the only feature using a timer; the control loop, being as important as it is, is entered via a flag set by an interrupt triggered when 4000 microseconds pass. 
-Care au fost rezultatele obţinute în urma realizării proiectului vostru+ 
-</​note>​+Motor mixing is done after all the PID calculations are done, resulting in the motor output which is based on the frequency at which the control loop operates. The motor output is delivered via PWM with the ESP32 LED Control functionality
 + 
 +The libraries I used for this project are the following:​\\  
 +-Arduino.h - I used it for generic functions and to keep the code simple as I wanted to avoid the RTOS of the ESP32\\  
 +-SPI.h - the sensor readings are done using this library, I used it for simplicity and ease of use\\  
 +-WiFi.h - used for the WiFi stack necessary for the web remote\\  
 +-ESPAsyncWebServer.h - used to host the web remote interface\\  
 +-ESPmDNS.h - used to define a text address for the web remote so I wouldn'​t have to type the ip of the ESP32 each time\\  
 + 
 +The structure of the project: \\  
 +-main.cpp - web server functionalities,​ control loop \\  
 +-PID.cpp - separate PID class and functionalities \\  
 +--PID.h \\  
 +-MPU6500.cpp - separate sensor SPI readings from the main code\\  
 +--MPU6500.h 
 +===== Rezultate Obţinute =====
  
 +Video demonstrativ:​ https://​www.youtube.com/​watch?​v=J08_xca9AOc
 ===== Concluzii ===== ===== Concluzii =====
  
pm/prj2026/jan.vaduva/sconstantin2203.1779117490.txt.gz · Last modified: 2026/05/18 18:18 by sconstantin2203
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0