Category: Random stuff

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.

Early on in the Crazyflie 2.0 design we decided on using a double-MCU architecture. The main reason for this was to add Bluetooth low energy (BLE) to the platform to permit new use-cases like controlling the Crazyflie 2.0 directly from a mobile device. It just so happens that Nordic semiconductor some time ago released a chip that perfectly matched our requirement: the nRF51822 can run a BLE stack and is still compatible with the nRF24Lx1 that we are using in the current Crazyflie and Crazyradio. This nRF51 chip contains an ARM Cortex-M0 microcontroller, powerful enough to implement the radio functionality and power management, but not powerful enough to run a fully featured Crazyflie. The resulting system architecture can be seen here:

Crazyflie 2.0 system architecture


The nRF51822

The two main tasks for the nRF51 is to handle the radio communication and the power management. We use the radio for both CRTP and BLE, but the hardware also supports other protocols like ANT. The CRTP mode is compatible with the Crazyradio USB dongle and it provides a 2Mbit/seconds data link with low latency. Our initial tests of the Crazyflie 2.0 implementation shows that the latency of the radio link is between 360us and 1.26ms, at 2Mbps without retry and a packet size of respectively 1 and 32 bytes. The main benefit of the CRTP link with the Crazyradio is that it’s easily implemented on any system that supports USB host which, makes it the first choice to hack and experiment with the Crazyflie. To that we have added BLE, mostly with the use case of controlling the Crazyflie 2.0 from a mobile device. The idea is of course to be able to fly easily and on the go with BLE, but we also see lots of opportunities for fun hacks and experimentation with mobile devices. One idea we came up with is to be able to place the mobile device up-side-down on a table and to autonomously hover the Crazyflie above it using the camera on the back.

One of the other particularities of the nRF51 chip is that it was designed to run from a coin battery, which means that it is pretty well suited for low energy operation. So we decided to give the nRF51 the responsibility for power management as well. In the current version of the Crazyflie we have a small chip handling the ON/OFF button and cutting power to the complete board. On Crazyflie 2.0 the button is connected to one GPIO pin on the nRF51 and power to it will never be cut, it just goes in “power down” mode. This permits to reproduce the current ON/OFF functionality and the button can be used for more function like long press and double click. We have also added the possibility to wake up the system from one of the pins in the expansion connector, which allows wake-up by an external source. It also adds more possibilities like waking up the system at regular time-intervals to perform some function.

The STM32F405

We also updated the main MCU to a fast Cortex-M4 with a lot of memory. The CPU power is not a big limitation in the current Crazyflie, but the memory could become a limitation if users would like to implement new functionality that needs a lot more memory. We ran into this problem when we were trying to implement SD-card support for logging, as this required too big buffers. The new MCU has 196kB of RAM which should be enough for anyone (famous last words…). The MCU power will also allow for more computationally intensive algorithms, the first that comes in mind is sensor fusion between inertial sensors and the GPS data.

This amount of memory and computational power also open the doors for new things: the STM32F4 has a Memory Protection Unit, which allow to run tasks in a protected environment and intercept bugs before they can crash the full Crazyflie control firmware (like what  happens on PC operating system). One use of this could be to to allow for “user code” that runs in a protected environment to allow easier development of advanced behavior. As always this kind of functionality spawns lots of crazy ideas :-) The leading one is to run a Lua interpreter in such a protected task. If there was a good API that could be used from Lua you could imagine lots of fun stuff to do. Like adding a new board with sensors, reading them and then controlling the Crazyflie from that, without having to go into the actual control algorithms or risking to crash the firmware. This is of course still a dream but at some point in the future we will definitely give it a try (when we have the time for it that is :-) ).

Inter-MCU communication

Working with a system with multiple MPU is hard. As embedded system developer we know that, so we designed the Crazyflie 2.0 with at least some idea of how to limit the problems related to debugging two inter-dependent MCUs. We have defined as precisely as possible the responsibility of each MCU, which permits to develop and test things independently:

  • The nRF51 is responsible for
    • ON/OFF logic
    • Enabling power to the rest of the system (STM32, sensors and expansion board)
    • Battery charging management and voltage measurement
    • Master radio bootloader
    • Radio and BLE communication
    • Detect and check installed expansion boards
  • The STM32 is responsible for all the rest, among other things:
    • Sensor reading and motor control
    • Flight control
    • Telemetry (including the battery voltage)
    • Additional user development

The nRF51 will act as slave and the STM32 as master. Using a radio bootloader it will be possible to wirelessly update the firmware for both MCUs.

We will write more details and post photos in the following weeks. Do not hesitate to tell us what you think about it, we appreciate all the feedback we get and we already have a couple of verification that we made after previous feedback (ie. radio latency and magnetometer usability).

Like we mentioned a couple of weeks ago we went to Devoxx UK last week exhibiting the Crazyflie. We got a chance to do lots of fun things, like flying the FPV quad in the keynote and also over the exhibition floor. The image is a bit faded, but we had the luck of having a projector next to us that we hooked up the FPV receiver to so the video feed was projected on the wall behind our booth. Our booth was next to the NFC ring exhibition which had a nerf gun that was unlocked when wearing their NFC ring. We quickly came to the conclusion that trying to shoot the Crazyflie down with the nerf-gun was the way to go :-) It can actually take a couple of direct hits before going down!

On Thursday night we jointed the IoT hackathon hosted by IBM. We got an Arduino with lots of sensors that we were supposed to interface from Java. Unfortunately we didn’t do too well on the Java front, but we managed better with the Arduino. We decided to use on the thumb-joysticks for controlling roll/pitch and a light sensor for controlling the thrust. Our first plan was to use a microphone for controlling the trust with the sound-level, but we realized that might be a bit too tight with time. The joystick and light values are sent via the UART to the PC and picked up in the Crazyflie Python Client using a modified version of the joystick drivers. Instead of reading events from PyGame we read data from the serial port. This makes it alot easier to debug since we get feedback from the input-device directly in the UI. In the end we got it working (kind of..) so we could fly and actually won the hackaton! So now we have a box of sensors that we can  play around with. Below is an image of the sensors connected to the Arduino.

arduino_devoxx_uk

We are glad to announce that we got a reinforcement to our team. His name is Miguel Piteira Gomes and just got out of school where he studied mechanics. Now we can finally do other stuff then electronics and software! Miguel comes from Portugal and will help us out during the summer. We wish him a big welcome!

Miguel

We are always looking for fun things to hack together using the Crazyflie. The last couple of weeks we contributed to two exciting open hardware campaigns on Indiegogo that we are hoping to get our hands on soon.

The VoCore

First up is the VoCore, a coin-sized SoC breakout with WiFi running Linux. Based on the RT5350, it could be used for WiFi control (with AP support) or to add extra power for doing calculations.

The second one is the 3Dpad, an open source gesture controller. We have been using the Leap Motion for flying before, and we are really eager to try the concept but with an open source project. Even tough the 3Dpad doesn’t support the same hand/finger tracking as the Leap Motion, we are hoping that we can hack together a usable controller for the Crazyflie. It uses capacitive technology that makes it possible to place it behind materials that are not transparent. Imagine placing it under the desk and flying with your hand above the desk!

Best of luck to the projects with financing and development!

This week we were planning on recording some FPV videos around the office with a new transmitter that gives us better range. But after battling with our USB capture device for a while we finally gave up. We will have to try to find a better one (that hopefully works in Linux!). But until then here’s two videos. First one from BBC is about the exciting future for flying robots (thanks to phenoptix for tipping us off to this one) and the second one is the recording from our presentation at Devoxx France a couple of months ago. The presentation is in French and you can pretty quickly guess who is the native French speaker and who is not :-)

Last year we presented the Crazyflie at Devoxx Belgium and last month we got a chance to do it again at Devoxx France (but in french). To complete our Devoxx tour we also accepted an invitation to Devoxx UK. But this time we won’t be presenting, we will only be flying :-). Normally when we speak conferences we hang out at the conference before and after the presentation. It’s a really great way to meet other geeks, discuss and have a lot of fun. So this time around we will only be hanging out in the exhibition hall. If you are going make sure to come by our table and do some flying!

It’s been a while since we summed up things happening in the community so here’s some of the things that are happening. There’s lots of more things, so if you think we are missing something, then post it in the comments below.

Ralph has been doing some work on an semi-automatic flip feature in the client. There’s more info on the forum and video below.

Last week we tested some modifications made by otto for a headfree mode (i.e yaw only rotates the platform, not the referance direction). It’s a really nice feeling just rotating without taking care of the direction you are going in :-) There’s more information and links to code on the forum.

The SHERPA project have been working on swarm algorithms using a vision system and the Crazyflie.

Geof from Centeye have been working on optical flow stabilization using the Crazyflie. He has a prototype board working and there’s lots of information in the forum about this build. To see the results have a look at the video below.

Thanks to Victor the Deviation firmware for Devo-7e (custom firmware for Devo RC-controllers) now has support for the Crazyflie (needs hardware hack). If you would like to give it a try have a look at the code or grab one of the nightlies.

Researchers at the University of Tokyo have been testing a new concept for a HoverBall using the Crazyflie. Imagine throwing a ball into the air that doesn’t come down (well not right away at least..). Here’s some more info and a picture.

We have also seen some nice stand alone controllers for the Crazyflie, one by  MidLifeCrisis (more info here) and one by ivandevel (video below) . There’s also more info in the forum.

There also some updates on the work done by Oliver on the Kinect tracking of the Crazyflie. A demo video is shown below (it looks great!) and there’s more information on the forum.

And finally here’s a nice video we found on Youtube showing position control of the Crazyflie using a VICON system.

This week we are heading off to Paris in France to present our project at Devoxx France. So if you are there and want to listen, then drop by the Ella Fitzgerald room at 10:40. The presentation will be in french and it will of course end with some demos :-) We will also hang around after the presentation just in case someone wants to test their flying skills. We are currently working on some nice light-effects using the Adafruit Neo Pixel ring that we will show off.

Also the Crazyflie is finally back in stock at Seeedstudio!

A couple of weeks ago we moved into the Malmö based business incubator Minc. It’s a great chance to get some extra help developing Bitcraze and also to get a chance to meet people from other start-ups. Below is a picture of a bunch of Crazyflies in our lab (i.e the table designated lab).

Bitcraze Lab

On a more technical note, here’s a video of a blimp that was hacked together with some left over party-balloons and a broken Crazyflie that we had lying around. It’s the day after the party, so there wasn’t that much lift left in the balloons (that’s why we have a bunch of them). After a few hacks to the firmware it actually works pretty well! The motors power has been redistributed and only the Yaw regulation is active, which explains that the yaw is still pretty stable, we are thinking about pushing the ‘blimp-mode’ at some point (first we will need more balloons and Helium though :) ).