Embedded

Crazyflie Drone Projects

Cover photo credit: Bitcraze AB


Drones are what led me into robotics in the first place. When I was 14, a family friend who taught engineering at UC Berkeley showed me a TED Talk by Raffaello D’Andrea. I was instantly mesmerized by the drones in the video catching balls, balancing a cup of water, and flipping in mid-air. That was the day I learned of the existence of control theory and felt motivated to study robotics.

Among all the drones I have built and worked with, “Crazyflie” drones are absolutely my favorite. Crazyflies are small pocket-sized drones developed by Bitcraze. They are small, maintainable, feature-packed and expandable. The software and hardware behind Crazyflie drones are all open source, making them ideal for both research and fun.

Here is a series of small projects I did using the Crazyflie drones.

Revamping the Drone Class at WashU

One of the most intense yet fun class I took during my undergrad at WashU was called “Autonomous Vehicle Laboratory.” We learned about dynamic models, numerical methods, control theory and Kalman filtering over the course of the semester. By the end, we had to program a complete estimation-control system for a small Parrot drone using MATLAB and Simulink. The professor, Dr. Bhan, was very knowledgeable and passionate about the topic, so I learned a lot from the class. A bunch of Boeing GNC engineers took the class as part of their master’s degree too, and they made the class extra fun.

Over the summer of my junior-senior year, I was recruited to help Dr. Bhan and revamp the class. The Parrot drones were aging poorly. Ever since they were discontinued in 2018, their accessory and MATLAB support dropped. Drones, especially propellers, break easily as teaching tools, so I felt a refresh was necessary. Crazyflie drones became the natural choice. Obviously there were trade-offs: the MATLAB support was really nice, and students would have a much lower tech barrier to make the drone fly by the end of the class.

The ease of learning was the only thing that kept the class from switching, and I was the one that pulled the trigger. Crazyflie drones have much better support (detailed documentation and beginner’s guides); the company behind it is doing great, and they offer a lot of customization for their drones supported by the open-source software and hardware. I spent the next two month revamping all the assignments, the mid-term, and the final project with two other TAs. It was a lot of work, but we also learned a lot.

To spice up the class even more, we designed and added two system identification labs for students thanks to the customizability of the Crazyflies.

The Bifilar Pendulum Experiment

In the drone class, students would spend the first month learning about the dynamics of a quadcopter drone. One of the most important parameters in the mathematical model of their drone is the moment of inertia. Moment of inertia, in layman’s terms, dictates how much and how fast a drone rotate given a “nudge” in the air. If we were to think about this in terms of a traditional passenger jet, it is important to know how much the plane will pitch down/up by giving 1 degree of flaps.

When I went through the class, I was given the numbers right away, so I always wondered how we would experimentally measure the moments of inertia. Well, here was my chance, and lucky for me (and future students), there indeed is a way: by using a bifilar torsion pendulum.

A bifilar torsion pendulum is a simple torsion pendulum that oscillates periodically when force is applied to the weight. What’s nice about bifilar pendulums is that the system acceleration depends not only on the length of the string, but also the moment of inertia of the weight (assuming the mass of the strings are negligible). Therefore, a bifilar torsion pendulum is an excellent tool for us to empirically measure the moments of inertia of our drone. If we were to get down to the math:

T=16π2lImd2gT = \sqrt{\frac{16\pi^2lI}{md^2g}}

where T is the period of the oscillation, and I is the moment of inertia we want to measure.

It’s all smooth sailing from here. By lining up the drone’s rotational axis with the pendulum, we can time the oscillations and measure calculate the moments of inertia.

We also gave students a Python script to collect the accelerometer data while their drones are in oscillation. By plotting the IMU data against time, we get another timing source by reading the “distance” between peaks of acceleration.

Student working on the experimentA student working on the experiment

The Thrust Measurement Experiment

Inspired by this post from the official Crazyflie website, we wanted to create our own version of thrust measurement lab. One of the topics from the class introduces the least-square method, so this experiment would be a great place for students to use least-square estimation.

Drone Projects at Brown

I joined the Automatic Coordination of Teams Lab as I started my master’s at Brown. The lab uses Crazyflies as its main research platforms for drone swarms (the cover photo of this blog post is a direct product of the lab’s research). I was really excited to keep using these awesome little drones and learning about their capabilities.

Servo “Deck”

A small but very influential project I worked on was the “Servo Deck”, a virtual expansion deck driver that allows an extra servo to be connected to the drone. This feature eventually made into the official Crazyflie firmware.

This project was a small but really fun puzzle to solve. At the time I came onboard, Eric from the lab was developing a new “Robot as an Art Medium” class at Brown. We were hoping to attach a servo that acts as a gate for a small paint funnel to a medium-sized drone. The idea for the drone was to fly over a large sheet of canvas and open the paint funnel gate at the right place in order to paint a nice picture.