{"id":40338040,"url":"https://github.com/lobodol/drone-flight-controller","last_synced_at":"2026-01-20T08:36:44.196Z","repository":{"id":36011995,"uuid":"40306082","full_name":"lobodol/drone-flight-controller","owner":"lobodol","description":"A quadcopter flight controller based on Arduino Uno","archived":false,"fork":false,"pushed_at":"2023-12-05T15:37:08.000Z","size":133,"stargazers_count":258,"open_issues_count":9,"forks_count":79,"subscribers_count":26,"default_branch":"main","last_synced_at":"2023-12-05T16:49:21.841Z","etag":null,"topics":["arduino","flight-controller","quadcopter"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lobodol.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-08-06T13:24:00.000Z","updated_at":"2023-12-01T13:23:39.000Z","dependencies_parsed_at":"2022-08-29T10:51:10.744Z","dependency_job_id":null,"html_url":"https://github.com/lobodol/drone-flight-controller","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"purl":"pkg:github/lobodol/drone-flight-controller","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lobodol%2Fdrone-flight-controller","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lobodol%2Fdrone-flight-controller/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lobodol%2Fdrone-flight-controller/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lobodol%2Fdrone-flight-controller/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lobodol","download_url":"https://codeload.github.com/lobodol/drone-flight-controller/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lobodol%2Fdrone-flight-controller/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28599159,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-20T02:08:49.799Z","status":"ssl_error","status_checked_at":"2026-01-20T02:08:44.148Z","response_time":117,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["arduino","flight-controller","quadcopter"],"created_at":"2026-01-20T08:36:44.116Z","updated_at":"2026-01-20T08:36:44.187Z","avatar_url":"https://github.com/lobodol.png","language":"C++","readme":"# Quadcopter PID implementation\n[![Build Status](https://travis-ci.org/lobodol/drone-flight-controller.svg?branch=master)](https://travis-ci.org/lobodol/drone-flight-controller)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\n[![flight](https://www.firediy.fr/images/articles/pid-drone/flight1.jpg)](https://www.firediy.fr/article/asservissement-pid-drone-ch-8)\n \n## 1. Introduction\n\nThis Arduino sketch provides a flight controller for an X quadcopter based on an Arduino Uno board and the [MPU6050 sensor](https://www.invensense.com/wp-content/uploads/2015/02/MPU-6000-Datasheet1.pdf).\n\nBasically, this automation routine is an implementation of a digital PID with a refresh rate of 250Hz.\nThe method used to calculate PID coefficients is [Ziegler Nichols method](https://en.wikipedia.org/wiki/PID_controller#Ziegler%E2%80%93Nichols_method).\nThe frame of the quadcopter is based on the [F450](https://www.qwant.com/?q=f450%20frame\u0026t=images).\n\nYou can use [this](https://github.com/lobodol/ESC-calibration) to calibrate your ESCs.\n\nA detailed article is available [here](https://www.firediy.fr/article/asservissement-pid-drone-ch-8) (in french).\n\n(i) Currently under active development.\n\n## 2. Requirements\nArduino libraries:\n* [Wire](https://www.arduino.cc/en/Reference/Wire)\n\n## 3. Pin connection:\n```\n       +-------------------------+\n       |        MPU-6050         |\n       |                         |\n       | 3V3  SDA  SCL  GND  INT |\n       +--+----+----+----+----+--+\n          |    |    |    |\n          |    |    |    |\n+---------+----+----+----+----------------+\n|        3.3V  A4   A5  GND               |\n|                                         |\n|                                         |\n|                 Arduino Uno             |\n|                                         |\n| #4   #5   #6   #7   #8   #9  #10   #11  |\n+--+----+----+----+----+----+----+----+---+\n   |    |    |    |    |    |    |    |\n  (M1) (M2) (M3) (M4)  |    |    |    |\n                       |    |    |    |  \n                       |    |    |    |\n                    +--+----+----+----+---+\n                    | C1   C2   C3   C4   |\n                    |                     |\n                    |     RF Receiver     |\n                    +---------------------+\n  \nLegend:\nMx: Motor X\nCx: Receiver channel x\n```\n\n## 4. Configuration\n### 4.1 Remote configuration\nBy default, this sketch uses the mode 2 for RF remote, according to the following picture:\n\n![remote modes](https://www.firediy.fr/images/articles/drone6/remote_modes.jpg)\n\nThe channel mapping is then:\n\n| Channel | Command    |\n| :-----: | :--------: |\n| 1       | ROLL       |\n| 2       | PITCH      |\n| 3       | THROTTLE   |\n| 4       | YAW        |\n\nTo change the channel mapping, update the function `configureChannelMapping` according to your needs:\n\n```c\nvoid configureChannelMapping() {\n    mode_mapping[YAW]      = CHANNEL4;\n    mode_mapping[PITCH]    = CHANNEL2;\n    mode_mapping[ROLL]     = CHANNEL1;\n    mode_mapping[THROTTLE] = CHANNEL3;\n}\n```\n\n### 4.2 PID tuning\nThe default PID coeffcient values might work for an F450-like quadcopter.\nHowever, you can tune them in the global variable declaration section:\n\n```c\n// PID coefficients\nfloat Kp[3] = {4.0, 1.3, 1.3};    // P coefficients in that order : Yaw, Pitch, Roll\nfloat Ki[3] = {0.02, 0.04, 0.04}; // I coefficients in that order : Yaw, Pitch, Roll\nfloat Kd[3] = {0, 18, 18};        // D coefficients in that order : Yaw, Pitch, Roll\n````\n\n## 5. Quadcopter orientation\n\n```\n Front\n(1) (2)     x\n  \\ /     z ↑\n   X       \\|\n  / \\       +----→ y\n(3) (4)\n```\n\n* Motor 1: front left  - clockwise\n* Motor 2: front right - counter-clockwise\n* Motor 3: rear left   - clockwise\n* Motor 4: rear left   - counter-clockwise\n\n![Paper plane](https://www.firediy.fr/images/articles/drone-1/ypr.jpg)\n* Left wing **up** implies a positive roll\n* Nose **up** implies a positive pitch\n* Nose **right** implies a positive yaw\n\nThe MPU6050 must be oriented as following:\n\n* X axis: roll\n* Y axis: pitch\n* Z axis: yaw\n\n## 6. Start/stop\nThis sketch comes with a safety process: to start the quadcopter, move the left stick of the remote in the bottom left corner. Then move it back in center position.\n\nTo stop the quadcopter, move the left stick in the bottom right corner.\n\n![State machine](https://www.firediy.fr/images/articles/pid-drone/state_machine.jpg)\n\n\n## 7. Debug\nIf you need to print debug messages, make sure to init Serial at **57600 bauds**:\n\n```c\nvoid setup() {\n  Serial.begin(57600);\n  // ...\n}\n\nvoid loop() {\n  Serial.println(measures[ROLL]);\n  // ...\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flobodol%2Fdrone-flight-controller","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flobodol%2Fdrone-flight-controller","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flobodol%2Fdrone-flight-controller/lists"}