Category: Random stuff

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 :) ).

Last week was a hectic but exiting week for me. First I visited Embedded World in Nürnberg and then made a visit to TUM university in München.

I was actually visiting Embedded World because ST Microelectronics contacted us and wondered if we could do a Crazyflie version with the more powerful STM32F3 and use ST MEMS sensors. So during the winter we did some prototypes where we fitted the pin compatible STM32F303CB and a LSM9DS0 9-axis MEMS module. Porting the code was pretty straight forward and took about a week. It was manly the drivers that needed porting but getting the FPU running also took some time. Our quick bench-marking test showed an ~35% increase of the floating point intense code and by using further speed boosters like the core coupled memory (CCM) it could probably be increased a lot more. Right now these extra CPU cycles aren’t really needed but for the future when more complex sensor fusion algorithms might be used they will be valuable. Therefore the STM32F3 series it very interesting as it packs plenty of processing power in a small package.

Having the ST-prototype on display in the ST booth at embedded world was quite a strange feeling. Something that started out as a fun thing to do on our free time is now sitting on a wall at big cenvenstion as EW, kind of hard to grasp. Unfortunately we where not allowed to fly around and play with it due to restrictions but I had a great time there anyway. I also participated in a short interview which ST arranged, really strange seeing yourself like that. I should probably focus on my engineering career instead… :-)

After the EW I went to visit the Techische Universität München TUM, as one of our most active users Oliver is studying there. Oliver made an awesome HUD and also contributed with most of the altitude hold code, and since München only is an hour away by train it was a great opportunity to go visit him. Oliver arranged so that Jacob from the computer vision group invited me to their department where they demonstrated some of their work, especially their work done with computer vision and quadcopters. Amazing stuff! I really hope we can do something together in the future and make this technology widespread.