Crazyflie 2.0: Bluetooth low energy connectivity

One of the nice new functionality of Crazyflie 2.0 is the Bluetooth 4.0 low energy (BLE) connectivity. In Crazyflie 2.0 we are using a radio microcontroller chip from Nordic semiconductor, the nRF51822. This radio chip allows us to keep compatibility with the existing Crayradio (and future Crazyradio PA), and to support BLE connectivity as well. The radio chip is a bit bigger that the one we used so far, and with the Power amplifier, we end up having the radio taking more space on the PCB:

The extra footprint is offset by the fact that we are now using smaller sensors and that the nRF51 is also handling the power management thus freeing pins on the main CPU.

The main usage of BLE will be to fly Crazyflie from a compatible mobile device like an Android phone or an Iphone. This could be used both to ‘just fly’ or to develop crazyflie control apps using the mobile phones capabilities. For example the phone camera could be used to detect and control Crazyflie autonomously. We have prototyped the BLE communication both on the existing Android client and for IPhone. The plan is to provide basic apps for the Crazyflie 2.0 release so that the copter can be flown from a mobile device out of the box. So far we have got the copter to fly from both Android and IOS:

We are not planning on implementing any BLE support for the PC client, so Crazyradio is still the main way to communicate with Crazyfle. It is possible to have BLE on PC but it would require a major effort to get it to work for Linux, Windows and Mac (there is no cross-platorm Python BLE lib as far as I know. If there is some please tell me in the comments!). Also Crazyradio is lower latency and has an higher datarate which makes it better for flying and communicating with one or many Crazyflie 2.0 from a PC.

We are also implementing BLE in the bootloader. This means that it will be possible update the Crazyflie 2.0 firmware from both a PC or a mobile device.

Technically we are using the Nordic Semiconductor soft device BLE stack. The stack runs a little bit like an operating system, behind and independently of the firmware: the firmware is not linked to the stack. This will make things a little bit easier to have an open-source firmware even though the nordic bluetooth stack is closed. Another nice thing about the nordic chip is that the radio peripheral is well documented so implementing open source stacks in the future is potentially possible.

Practically we where originally planning to have two modes for the firmware: one Crazyradio and one bluetooth mode. However the new release of the Nordic BLE stack allow to mix BLE and Crazyradio at the same time. So we are working on having a seamless connection procedure between Crazyradio and BLE: when starting Crazyflie 2.0 it will be accessible both via BLE and with the Crazyradio. When connected the unused mode will be disabled until disconnection. Also the name of the copter will be communicated both in BLE and Crazyradio mode and can be changed by the user. This will help a lot people having more than one Crazyflie (us first!) to differentiate them.

12 comments on “Crazyflie 2.0: Bluetooth low energy connectivity

  • In Crazyflie 2.0, you’re using a radio microcontroller chip from Nordic semiconductor, the nRF51822. While nRF51822 has its own chip based on Cortex-M0,and it has enought pins and peripheral resources to use,does that mean we could use it to replace the STM32f103cbt6 to control the copter? And how did the Crazyflie 2.0 deal with it?

    • The nRF51822 is handling only power management and radio communication in the Crazyflie 2.0, we have an STM32F405 that handle the rest (flight control&co). Currently the Nordic bluetooth stack takes too much resources (hardware and real-time CPU) to allow to fly only from the nRF51 and also we wanted a bit more power that the 32MHz CM-0 in Crazyflie 2.0 :).

  • I see this article has been posted in 2014. But can the crazyflie client be controlled with laptop’s bluetooth now?

    • Unfortunately not, BLE support for computer OS is still very fragmented and I do not know of any python lib that would allow support for Linux/Windows/Mac.

      A bit of details about the current state:
      The closest we have is the Windows uap client (https://github.com/bitcraze/crazyflie2-windows-uap-client) that was originally made for Windows phone but compiles and runs on a Windows computer as well. Last time I checked only UAP apps had access to BLE, not normal application (like python).
      Mac has good BLE support for native app as far as I know, but I am not aware of anyone that has done one for the Crazyflie (in theory the iOS client could be ported to mac, the BLE api are similar). In theory there could be a python binding for this API.
      Linux is still in pretty bad shape as far as I know, I do not know of any easy way to use BLE directly in linux (ie. without poking into gatttool or re-implementing GATT…).

      BLE support on computer is still not a priority since Crazyradio works well in that case, though I am still looking every now and then to see if things evolve and if it would be possible to add BLE support to the current python client. If anyone has a multi-platform solution for BLE I am interested :-)

  • I am trying to flash the crazyflie 2.0 from scratch using just the hex files.
    I first flashed the STM32f4 ‘cloader.hex ‘ followed by the ‘cf2.hex’ both using the stlink and the STM32 Cube Programmer. Then I flashed the nrf using the Jlink in nrfgo app. first i flashed the soft device ‘s110_nrf51822_7.3.0_softdevice.hex’ followed by the ‘cf2_nrf.hex’.
    My board however does not respond. Please help me know if am using the correct format. I want just to use the hex files.

Leave a Reply

Your email address will not be published.