Crazyflie 2.0 Explained from Hardware to Software

Author

Posted Nov 8, 2024

Reads 5.4K

Photo of a Black Quadcopter Drone
Credit: pexels.com, Photo of a Black Quadcopter Drone

The Crazyflie 2.0 is a tiny drone that's packed with impressive technology. It's designed to be a research platform, but it's also a lot of fun to fly.

The Crazyflie 2.0 has a small, lightweight body that's made of carbon fiber. This makes it incredibly durable and resistant to crashes.

Its flight controller is based on the open-source PX4 autopilot system, which is widely used in the drone industry. This means that the Crazyflie 2.0 can be programmed and customized with a wide range of software tools.

The drone has a range of sensors that help it navigate and avoid obstacles. These include a barometer, magnetometer, and accelerometer, which work together to give the drone a sense of its position and orientation in space.

Getting Started

The Bitcraze website has some very useful pages and tutorials when you're starting out with the crazyflie 2.0. They can be found here: https://www.bitcraze.io/start

If you're working in Ubuntu, you'll need to set up a udev rule giving read/write permissions to the Crazyradio USB dongle. This is a crucial step to allow communications between the crazyflie 2.0 and your PC.

Credit: youtube.com, Crazyflie 2.0 assembly video

To set up these permissions, you can find useful links here.

To get started with Crazyflie 2.0, you'll need to ensure you have the necessary hardware and software. The prerequisites are:

  • A Crazyflie 2.0 unit, with the Crazyradio PA long-range communications dongle
  • The Crazyflie flow deck, an expansion board containing an optical flow sensor and laser rangefinder (optional, but encouraged)
  • A game controller with a USB connexion
  • A working installation of the Python 3 programming language, and a basic working knowledge of Python
  • Administrative (sudo) permissions on the computer you are using

If you've satisfied all of the above prerequisites, you're ready to begin setting up your hardware.

Hardware Overview

The Crazyflie 2.0 is a tiny quadcopter that weighs just 27 grams.

Its dimensions are 17 x 17 x 6.5 cm, making it a compact and portable device.

The Crazyflie 2.0 is powered by a 350mAh LiPo battery that provides up to 7 minutes of flight time.

Installing Libusb Drivers

Installing libusb drivers is a crucial step if you're running a Windows operating system. This is because Windows needs a USB communication API that's compatible with the standard Unix feature set.

You'll need to plug your Crazyradio into an available USB port and rotate the antenna so that it points upward. This is a simple step that's easy to overlook, but it's essential for the installation process.

Credit: youtube.com, How to install Libusb driver properly

Zadig is a tool that helps install libusb drivers and associate them with a particular USB device. You can download and run Zadig, and upon opening the application, you'll likely see an empty window.

To override Zadig's default behavior, make sure to check the menu option Options▸List All Devices. This will allow you to select the Crazyradio PA USB Dongle from the dropdown selection near the top.

Select the Crazyradio PA USB Dongle from the dropdown selection and switch through the available driver options until libusb-win32 is displayed. Double-check that you have selected the correct options before proceeding.

Click the large "Install Driver" (or "Replace Driver") button at the bottom of the window, and after a brief processing delay, a dialog box should appear reporting that the driver installation was successful.

Expansion Connectors

Expansion connectors on this device are quite versatile, offering a range of interfaces for connecting peripherals.

The VCC pin is rated for 3.0V and can supply up to 100mA of current.

Credit: youtube.com, Motherboard Connectors

You'll also find a GND pin for grounding purposes.

The VCOM pin can be connected to either the unregulated VBAT or VUSB, with a maximum current draw of 1A.

There's also a VUSB pin that can be used for both input and output connections.

For communication, you have I2C at 400kHz, SPI, and two UART interfaces.

Additionally, there are four GPIO/CS pins available for SPI connections.

A 1-wire bus is also present for expansion identification.

Two GPIO pins are connected to the nRF51 chip.

Firmware and Software

Updating the firmware on your Crazyflie 2.0 is a straightforward process that requires some basic steps. Download the latest firmware release from Bitcraze's GitHub and make note of its location.

To initiate the bootloader, turn off your Crazyflie via the power button on Leg 1, then restart it by holding the power button for 3 seconds, or until the blue LED M2 begins flashing slowly.

Once you're in the bootloader, you'll need to connect to it using the Crazyflie client. Ensure that the address is set correctly for your quad, then click the menu option Connect▸Bootloader. The bootloader service dialog should appear, allowing you to proceed with the update.

Possible Firmware Mods

Credit: youtube.com, What Makes ALL Your Electronics Work - Firmware Explained

Possible Firmware Mods can significantly enhance the performance and capabilities of your drone. Individual motor control is a mod that allows for more precise control over each motor, enabling smoother and more stable flight.

This mod can be particularly useful for pilots who want to customize their drone's behavior. For example, you can adjust the motor speeds to compensate for changes in air density or to improve maneuverability.

Accelerometer reading for EKF (Extended Kalman Filter) is another important mod that can improve the accuracy of your drone's navigation system. By incorporating accelerometer data, the EKF can better estimate the drone's position and orientation.

Changing attitude controller gains is a simple yet effective mod that can help stabilize the drone's flight. By adjusting the gains, you can fine-tune the controller's response to the drone's movements and prevent oscillations.

Here are some possible firmware mods to consider:

  • Individual motor control
  • Accelerometer reading for EKF
  • Changing attitude controller gains

Update Firmware

Updating your device's firmware is a straightforward process. First, download the latest firmware release from Bitcraze's GitHub and make note of its location.

Credit: youtube.com, What Makes ALL Your Electronics Work - Firmware Explained

To begin the update, turn off your device via the power button, then restart it into the bootloader by holding the power button for 3 seconds, or until the blue LED M2 begins flashing slowly.

Release the power button and set your device aside for now. Ensure that the address is set correctly for your device in the Crazyflie client, then click the menu option Connect▸Bootloader.

The bootloader service dialog should appear, allowing you to initiate the cold boot by clicking the leftmost button “Initiate bootloader cold boot”. Once LED M4 on your device begins flashing green, the cold boot has completed.

Click the “Browse” button under Crazyflie firmware update and select the .zip file you downloaded from GitHub. Click the “Program” button, then wait for programming to complete.

Once the bootloader service dialog reports that programming was successful, click “Restart in firmware mode”. Your device should boot normally, performing the regular rotor self-check.

The Nrf51822

Credit: youtube.com, nRF51822 #16: secure DFU OTA via BLE (english)

The nRF51822 is a powerful chip that handles both radio communication and power management. It's used for CRTP and BLE, and even supports other protocols like ANT.

The nRF51 chip is designed to run from a coin battery, making it well-suited for low energy operation. This is particularly useful for devices that need to conserve power.

The radio link on the Crazyradio USB dongle provides a 2Mbit/second data link with low latency. In tests, the latency of the radio link was found to be between 360us and 1.26ms, at 2Mbps without retry and a packet size of respectively 1 and 32 bytes.

The nRF51 chip takes care of power management, allowing the Crazyflie 2.0 to go into "power down" mode instead of completely cutting power. This still reproduces the current ON/OFF functionality and leaves room for more features like long press and double click.

The button on the Crazyflie 2.0 is connected to one GPIO pin on the nRF51, and power to the system will never be cut.

Frequently Asked Questions

How to charge crazyflie battery?

Plug in a micro USB cable to charge the Crazyflie's battery. This simple step gets your drone ready for flight.

Samuel Forte

Senior Writer

Samuel Forte is a seasoned writer with a passion for sharing his experiences and knowledge. He has been writing for over 20 years and has covered various topics ranging from technology to personal development. Samuel's work has been featured in several publications, including Forbes and The Huffington Post.

Love What You Read? Stay Updated!

Join our community for insights, tips, and more.