Differences

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

Link to this comparison view

pm:prj2026:jan.vaduva:sconstantin2203 [2026/05/24 01:39]
sconstantin2203 [Software Design]
pm:prj2026:jan.vaduva:sconstantin2203 [2026/05/24 02:43] (current)
sconstantin2203 [Rezultate Obţinute]
Line 41: Line 41:
 ===== Software Design ===== ===== Software Design =====
  
-    ​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 +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.
-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 lated subtracted from each reading+
-    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 is 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. +
-    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. +
-    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 contol 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:​ +UAVs should handle unpredictable disruptions, ​the most unpredictable of which can be the pilot so wrote a function ​to interpolate ​the current throttle ​to the desired throttle to soften quick changes made by the pilotControlling ​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.
-    -Arduino.h - 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 - used to host the web remote interfaceMotor mixing ​is done after all the PID calculations are done resulting ​in the motor output ​which is based on the frequency at which  +
-the contol 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:​ +The attitude measurement is used to compute the input for the PID controllerThe 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 pilotThe 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 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.
-    -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 ​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: +Motor mixing is done after all the PID calculations are doneresulting in the motor output which is based on the frequency at which the control loop operatesThe motor output is delivered via PWM with the ESP32 LED Control functionality.
-        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.+
-    ​+
  
-===== Rezultate Obţinute =====+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\\ ​
  
-<note tip> +The structure of the project: \\  
-Care au fost rezultatele obţinute în urma realizării proiectului vostru+-main.cpp - web server functionalities,​ control loop \\  
-</​note>​+-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.1779575946.txt.gz · Last modified: 2026/05/24 01:39 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