diff --git a/docs/final_project/PXL_20250604_121528011(1).mp4 b/docs/final_project/PXL_20250604_121528011(1).mp4 new file mode 100644 index 0000000..0b83348 Binary files /dev/null and b/docs/final_project/PXL_20250604_121528011(1).mp4 differ diff --git a/docs/final_project/final_project.md b/docs/final_project/final_project.md index f5f7808..5262356 100644 --- a/docs/final_project/final_project.md +++ b/docs/final_project/final_project.md @@ -441,10 +441,46 @@ And when doing heated inserts make sure to do a couple of extra wall layers. So ## TODO * [ ] Matrix panel subsystem * [x] Rewrite PWM esc control system in driver -* [ ] Does it fly? +* [ ] Does it fly? (No it didn't) * [x] Power distribution system (for matrixes and mcu's) * [x] Test physical controller +## Testing the drone(V1) + +The first test of the drone went horribly wrong. + + +### What went wrong +* The drone was not balanced +* The drone was a bit too heavy +* The drone didn't have good footing to the ground +* Motors recalibrating themselves at some startups (Last startup that didn't happen) +* The drone arm was too weak to resist the impact of the motors +* The batteries weren't fastened inside the drone + +### Improvements for next design +* Proper legs so the drone doesn't fall over during takeoff +* Lighter design while being as strong as possible with the least amount of material +* A power switch because everything instantly starts once it gets power and that could be dangerous with extremely fast spinning propellors. +* Fastened batteries + +![alt text](imaged.jpg) + +### The damage +![alt text](imaged-1.jpg) +One matrix board got a few ripped of leds and capacitors but I think I am able to repair that. + +![alt text](imaged-2.jpg) +2 ESC's and motors got completely tangled wires. I expect them to still work since they where still spinning after the impact. +3/4 arms got ripped off due to the crash. + +![alt text](imaged-3.jpg) +![alt text](imaged-4.jpg) +Luckily we placed cardboard under the drone incase something would happen. The propellors completely mauled the cardboard away where it hit. + +Now that the drone is ripped into several pieces I will be abandoning this design and start from scratch on a second design. + + ## BOM (bill of materials) ### Drone diff --git a/docs/final_project/image.jpg b/docs/final_project/image.jpg index b0f38aa..9a5779d 100644 Binary files a/docs/final_project/image.jpg and b/docs/final_project/image.jpg differ diff --git a/docs/final_project/imaged-1.jpg b/docs/final_project/imaged-1.jpg new file mode 100644 index 0000000..0dd8873 Binary files /dev/null and b/docs/final_project/imaged-1.jpg differ diff --git a/docs/final_project/imaged-2.jpg b/docs/final_project/imaged-2.jpg new file mode 100644 index 0000000..cf54c7d Binary files /dev/null and b/docs/final_project/imaged-2.jpg differ diff --git a/docs/final_project/imaged-3.jpg b/docs/final_project/imaged-3.jpg new file mode 100644 index 0000000..978b381 Binary files /dev/null and b/docs/final_project/imaged-3.jpg differ diff --git a/docs/final_project/imaged-4.jpg b/docs/final_project/imaged-4.jpg new file mode 100644 index 0000000..8db72a8 Binary files /dev/null and b/docs/final_project/imaged-4.jpg differ diff --git a/src/Fab Matrixes/src/main.cpp b/src/Fab Matrixes/src/main.cpp index b39f54c..02e9ec3 100644 --- a/src/Fab Matrixes/src/main.cpp +++ b/src/Fab Matrixes/src/main.cpp @@ -68,8 +68,11 @@ int x = matrix.width(); int pass = 0; void loop() { - scrollingText("Hello World!", 50, matrix.Color(255, 0, 255)); - // matrixSerialLoop(); + matrix.fillScreen(0); + matrix.setCursor(0, 0); + matrix.setTextColor(matrix.Color(255, 0, 255)); + matrix.print("Outch"); + matrix.show(); } void scrollingText(String text, int speed, int color) { diff --git a/src/controller/drone controller/src/main.cpp b/src/controller/drone controller/src/main.cpp index 9686b8a..3c2df6e 100644 --- a/src/controller/drone controller/src/main.cpp +++ b/src/controller/drone controller/src/main.cpp @@ -8,8 +8,8 @@ U8G2_SSD1306_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, /* reset=*/U8X8_PIN_NONE); const int MAXPWMVALUE = 2000; const int MINPWMVALUE = 1000; -const uint8_t broadcastAddress[] = {0x8C, 0xBF, 0xEA, 0xCC, 0x8B, 0x18}; -// 8c:bf:ea:cc:8b:18 +const uint8_t broadcastAddress[] = {0xE4, 0xB3, 0x23, 0xB5, 0x8D, 0xD0}; +// e4:b3:23:b5:8d:d0 //=====================================================================================// // Struct declarations typedef struct filteredJoystickData diff --git a/src/drone/src/main.cpp b/src/drone/src/main.cpp index f1a5048..c3f8737 100644 --- a/src/drone/src/main.cpp +++ b/src/drone/src/main.cpp @@ -28,7 +28,6 @@ http://www.bolderflight.com Thank you to: RcGroups 'jihlein' - IMU implementation overhaul + SBUS implementation. Everyone that sends me pictures and videos of your flying creations! -Nick - */ //========================================================================================================================// @@ -237,10 +236,10 @@ const int ch5Pin = 17; // gear (throttle cut) const int ch6Pin = 17; // aux1 (free aux channel) const int PPM_Pin = 17; // OneShot125 ESC pin outputs: -const int m1Pin = D10; -const int m2Pin = D9; -const int m3Pin = D3; -const int m4Pin = D2; +const int m1Pin = D9; // Front Right CW (top right motor) +const int m2Pin = D10; // Front Left CCW (top left motor) +const int m3Pin = D3; // Back Right CCW (bottom right motor) +const int m4Pin = D2; // Back Left CW (bottom left motor) const int m5Pin = D7; //for some readon D9 doesnt work const int m6Pin = D8; @@ -360,6 +359,8 @@ int pulseWidthToDutyCycle(int pulseWidth); void setupMatrixSerial(); void printPitchInfo(); void printAttitudeDebug(); +void testIndividualMotors(); +void armMotors(); //========================================================================================================================// // VOID SETUP // //========================================================================================================================// @@ -411,7 +412,7 @@ void setup() delay(5); - // calibrateESCs(); //PROPS OFF. Uncomment this to calibrate your ESCs by setting throttle stick to max, powering on, and lowering throttle to zero after the beeps + calibrateESCs(); //PROPS OFF. Uncomment this to calibrate your ESCs by setting throttle stick to max, powering on, and lowering throttle to zero after the beeps // Code will not proceed past here if this function is uncommented! // Arm OneShot125 motors @@ -430,6 +431,8 @@ void setup() // If using MPU9250 IMU, uncomment for one-time magnetometer calibration (may need to repeat for new locations) // calibrateMagnetometer(); //Generates magentometer error and scale factors to be pasted in user-specified variables section + // armMotors(); + // testIndividualMotors(); // Test individual motors by commanding them to 1200us pulse length for 1 second each } //========================================================================================================================// @@ -512,10 +515,10 @@ void controlMixer() */ // Quad mixer with pitch bias because the sensor isnt flat on the board - m1_command_scaled = thro_des - pitch_PID + roll_PID - yaw_PID; // Front Left CCW - m2_command_scaled = thro_des - pitch_PID - roll_PID + yaw_PID; // Front Right CW - m3_command_scaled = thro_des + pitch_PID - roll_PID - yaw_PID; // Back Right CCW - m4_command_scaled = thro_des + pitch_PID + roll_PID + yaw_PID; // Back Left CW + m1_command_scaled = thro_des + roll_PID - pitch_PID + yaw_PID; // Front Right CW + m2_command_scaled = thro_des - roll_PID - pitch_PID - yaw_PID; // Back Left CW + m3_command_scaled = thro_des + roll_PID + pitch_PID - yaw_PID; // Back Right CCW + m4_command_scaled = thro_des - roll_PID + pitch_PID + yaw_PID; // Front Left CCW m5_command_scaled = 0; m6_command_scaled = 0; @@ -1460,21 +1463,6 @@ void commandMotors() { ledcWrite(m6Pin, pulseWidthToDutyCycle(m6_duty)); } -void armMotors() -{ - // DESCRIPTION: Sends many command pulses to the motors, to be used to arm motors in the void setup() - /* - * Loops over the commandMotors() function 50 times with a delay in between, simulating how the commandMotors() - * function is used in the main loop. Ensures motors arm within the void setup() where there are some delays - * for other processes that sometimes prevent motors from arming. - */ - for (int i = 0; i <= 50; i++) - { - commandMotors(); - delay(2); - } -} - void calibrateESCs() { // DESCRIPTION: Used in void setup() to allow standard ESC calibration procedure with the radio to take place. @@ -1929,6 +1917,56 @@ void printAttitudeDebug() { } } +void testIndividualMotors() { + Serial.println("=== MOTOR PIN TEST - PROPS OFF! ==="); + + // Test each pin individually for 3 seconds + Serial.println("Testing D3 (m1Pin) for 3 seconds..."); + ledcWrite(D3, pulseWidthToDutyCycle(1300)); + delay(3000); + ledcWrite(D3, pulseWidthToDutyCycle(1000)); + delay(2000); + + Serial.println("Testing D2 (m2Pin) for 3 seconds..."); + ledcWrite(D2, pulseWidthToDutyCycle(1300)); + delay(3000); + ledcWrite(D2, pulseWidthToDutyCycle(1000)); + delay(2000); + + Serial.println("Testing D10 (m3Pin) for 3 seconds..."); + ledcWrite(D10, pulseWidthToDutyCycle(1300)); + delay(3000); + ledcWrite(D10, pulseWidthToDutyCycle(1000)); + delay(2000); + + Serial.println("Testing D9 (m4Pin) for 3 seconds..."); + ledcWrite(D9, pulseWidthToDutyCycle(1300)); + delay(3000); + ledcWrite(D9, pulseWidthToDutyCycle(1000)); + delay(2000); + + Serial.println("Test complete! Note which physical motor each pin controls."); + + while(true) { + ; + } +} + +void armMotors(){ + + + ledcWrite(m1Pin, pulseWidthToDutyCycle(2000)); // maximum pulse width (2000μs) + ledcWrite(m2Pin, pulseWidthToDutyCycle(2000)); + ledcWrite(m3Pin, pulseWidthToDutyCycle(2000)); + ledcWrite(m4Pin, pulseWidthToDutyCycle(2000)); + + delay(9000); + ledcWrite(m1Pin, pulseWidthToDutyCycle(1000)); // Minimum pulse width (1000μs) + ledcWrite(m2Pin, pulseWidthToDutyCycle(1000)); + ledcWrite(m3Pin, pulseWidthToDutyCycle(1000)); + ledcWrite(m4Pin, pulseWidthToDutyCycle(1000)); +} + //=========================================================================================// // HELPER FUNCTIONS