Maker Tim Hanewich has put collectively a quadcopter drone pushed by a {custom} MicroPython flight controller operating on a Raspberry Pi Pico improvement board — and has made the challenge open supply for others to take pleasure in.
“Throughout summer season 2023, I developed a DIY quadcopter drone utilizing the Raspberry Pi Pico because the ‘mind,’ operating a Python-based custom-developed flight controller to realize flight,” Hanewich explains of his challenge, delivered to our consideration by Adafruit. “This was a really computationally difficult job, however by means of a lot trial-and-error, I used to be capable of squeeze sufficient efficiency out of the RP2040 to permit for secure and agile flight.”
This quadcopter is pushed by a Raspberry Pi Pico, standing in for a way more costly business flight controller. ((📷: Tim Hanewich)
The flight controller in query is dubbed Scout, and is designed to place the core capabilities of a business flight controller costing $100 or extra onto the $4 Raspberry Pi Pico and its dual-core RP2040 microcontroller. “Simply as a scout ventures into uncharted territories to assemble data and pave the way in which for future success and innovation,” Hanewich explains of the identify, “this flight controller represents my entry into a brand new area of experience, one in every of which I knew little or no about when starting this challenge.”
It took seventy days — and, Hanewich notes, 1,194 code commits — for Scout to take flight, requiring Hanewich to study concerning the flight dynamics of a quadcopter, find out how to combine the microcontroller with a gyroscope, proportional–integral–by-product (PID) management, driving brushless motors through digital pace controllers (ESCs) utilizing the RP2040’s pulse-width modulation (PWM) capabilities, and reacting to inputs from a handheld radio controller.
“The Scout Flight Controller runs the PID adjustment loop at 250Hz, or 250 occasions per second. I realized that reaching this pace is a problem utilizing MicroPython on the cheap Raspberry Pi Pico’s CPU {hardware},” Hanewich notes of one of many greatest challenges within the challenge.
“To attain these speeds, you will discover that I’m not utilizing the essential rules of programming — modularity, reusability, and so forth. I’m conserving my utilization of lessons, capabilities, and modules to the naked minimal. It’s because utilization of those easy Python ideas truly requires a bit of additional processing time that will gradual the execution of the code down sufficient for the 250Hz adjustment loop to be out of attain.”
To get the MicroPython code operating quick sufficient, the Scout runs the RP2040 microcontroller at 250MHz. (📷: Tim Hanewich)
Even then, the controller was operating too gradual for consolation — which led Hanewich to attempt the brute-force answer. “The Scout Flight Controller overclocks the Raspberry Pi Pico’s RP2040 processor from 125MHz to 250MHz, double its rated pace,” he explains. “From my expertise, this has not prompted any hostile results by any means. The facility consumption, temperature, reliability, and so forth., nonetheless look like regular.”
The creation of the Scout Flight Controller is detailed in a 12-part sequence on Hanewich’s weblog, together with the MicroPython supply code itself.