Blog

After investigating the problem with the MPU6050 from last week we found out that all our prototypes have defect MPU6050 sensors :-(. The bias offset values are way out of spec and several of the accelerometer axis is locked to their min or max value. The manufacturer must have dropped the hole batch in the floor or something because we would have expected at least one out of the six prototypes to have a working sensor. Without working sensors it is hard to make a maiden flight, which we are very eager to do. We will have to order new sensors and hopefully we can replace the new sensors without damaging them.

We also finished to patch all our test copters so that they will now be able to fly when we change the  sensor:

 

After the problem discovered last week we have patched a couple of copter and we are now getting values from the sensors. Our biggest problem for the moment is a huge offset that we get from the MPU-6050 (both from the accelerometer and the gyro). It’s not the self-test mode since we have tried enabling/disabling but we are still investigating…

Except for that the software is going forward both on the copter and for the PC GUI. We are implementing parameters and log systems that will greatly ease future development and debugging on the system: it will basically be possible to log and observe dynamically any internal variable and to set settings, like the regulation settings, in real time from the PC GUI.

We have found a few workarounds for the JTAG reset problem but finally none of them are needed since we unfortunately have to make a new revision anyway and thus we can properly fix the probem. After spending hours debugging the PWM for the motors we finally opened up the errata and found a serious problem with our new version. Like we mentioned before we moved the PWM for two of the motors so we could have one dedicated SPI for the expansion header and not shared with the radio. This was done by moving one of the motors to PB5 (alternative function TIM3_CH2) while also switching to new sensors that use I2C. According to the errata it’s not possible to clock I2C1 (where the MPU6050 is connected) and TIM3 while using TIM3_CH2 remapped and as output (to drive the PWM for the motor).

On a happier note we did some range-testing of the radio since we have now changed to 0402 components in the radio filter on the USB radio dongle and the quadcopter. The measurements shows that we get up to ~65 meters before we start loosing packets and up to ~80 meters before we loose communication completely. The test was done outside and using the 250Kbps mode.

We have noticed some confusion about how we control the Crazyflie after our RC controller post. So just to clarify we are using a Playstation 3 gamepad to control the Crazyflie from the PC, this is the best we have but any gamepad or joystick would do. However there are other options.

The Crazyflie will be controllable from the CrazyRadio USB dongle. The dongle has a number of interfaces that can be used: USB, SPI/UART and PPM. A custom made controller could be connected to the SPI/UART or a RC remote to the PPM interface. If the dongle is connected to the computer using USB it can be interfaced using our Python library. Currently we are using a QT application together with a gamepad controller to interface the Python library but it’s also possible to do other stuff like one of our dreams: using openCV to track the Crazyflie and control it autonomously from a PC and a couple of webcams :)

Also we are still porting the code and testing the new prototypes. So far we haven’t fond any more problems than the JTAG reset.

A large part of this Monday was spent assembling and testing the new prototypes with the digital sensors which arrived today. Eager to try them out we pretty quickly got stuck when we tried to program them with the JTAG. The copter wouldn’t respond to any JTAG commands… After a long time of testing we found our rookie mistake: We have been moving around some of the signals now when we have digital sensors to make the expansion port use a dedicated SPI port and not share it with the radio, which is a great improvement. With this moving around we managed to put one of the motor outputs on the optional JTAG reset pin, NJTRST. The motors are pulled low so they don’t start unintentionally which then makes the JTAG go in constant reset :o This can be walked around by temporarily holding that pin low during the first programming of the boot loader which will then immediately remap the NJTRST pin to be unused by the JTAG. If the bootloader is never removed the problem is gone but if the boot loader is unintentionally overwritten then one have to do the “pull low” trick again. So now we have to decide whether to live with this flaw or do yet another board re-spin… :-( There are still plenty of sensor testing left to do that maybe need another re-spin.

Before we have any maiden flight video the show below is a photo of the new Rev.D PCB. There are more in this album.

Crazyflie Rev.D PCB

 

We don’t have that much new to write about this week. The software clean-up is slowly evolving and we have been working some more on the radio protocol and the ground station.

We hope that the new prototypes will be ready this week so maybe we could make a first flight with them in the beginning of next week :-)

A none return point has been passed as we have put in an order for a shit-load of motors. Now everything has to work out or we will be sitting with a hole bunch of motors and no money to do other fun stuff.

 

While we are waiting for our prototypes to arrive, the ETA is the 18th of may which is a looong wait, we thought we would play around with the Crazyflie outside now when spring has finally reached the south of Sweden. The drawback with a quadcopter this small is that it doesn’t work that well when it is windy outside but the upside is that it is pretty durable which makes great for some crazy testing :-). This Monday it was very calm outside and we got the idea to throw it in the air and try to make a “throwing start”. From the beginning we thought, no way, but it actually worked better then we thought. Here are some of the clips of  the more successful attempts :-)

We also bought one of these very popular key chain spy cameras to try and get some on-board action footage. We removed the electronics from the casing, removed the battery and connected it to our battery instead. We even removed the mini-USB connector to save weight. It all ended up in about 25g including the Crazyflie which is OK. Now it is really starting to look as an insect of some sort…

Frame from onboard video footage

We managed to take a short on-board video but the camera doesn’t handle the battery voltage drop and resets pretty easily as soon as you hit the thrust. Maybe it is possible to power it from our stable 2.8V instead because now it is pretty useless. Also the view-angle is to narrow as well as the framerate being too low to get any good footage. We seem to have gotten the 808 #14 model which isn’t supposed to be the best. At least the Crazyflie is looking pretty mean with it attached :-). Further investigations will be done when we have some time left over.

We are still working hard on the Crazyflie code while we are waiting for the new prototypes. We are also working on finalizing the Crazyradio, the radio dongle we are making to communicate with Crazyflie.

In order for us to test the radio hardware performance we brought a RFExplorer:

The radio chip (nRF24U1) is put in continuous carrier mode, which makes it emit constantly at a single frequency. Below is a screenshot of the measured frequency and power from the radio dongle:

This measurement is not that useful as an absolute value (for one we do not have a RF test chamber) but it will give us the opportunity to compare the next prototype with this one. Our next radio prototype uses smaller SMD component for the RF parts which is supposed to give better performance. We already compared it with another dev board and our radio seems to have similar performance :).

We wish we had something interesting to write about, but recently we have just been cleaning up and reorganizing the Crazyflie firmware. We are doing this so it would be simpler to further develop the software when it is released. We have also been preparing the new drivers for the digital sensors so they will be ready when the next version of prototypes arrives within the next two weeks.

One funny thing we have though is this little teaser video we put together while testing the speed of the Crazyflie. It is not recommended crashing into something hard at this speed 8O

While waiting for our next round of prototypes we are continuing the work on the software. As we feel that the copter is now stable enough for release we are concentrating on making the software easier to use and better organized.

We have also run a little profiling test on the Crazyflie firmware to see how much CPU was used by the current stabilisation algorithm. We use FreeRTOS and added some functionality to log all the task transitions.  The first result was quite worrying as it seems that we where using about 90% of the avaliable CPU. After further investigation is appeared that the problem came from the fact that we where testing Debug buils. When optimizing for size (-Os of GCC) it brings us back to 70% cpu usage and optimisation for speed (-O3) to 65%:

We are currently running two sensor fusion algorithms in parallel and have a lot of room for improvement for the code efficiency but we believe that would be good enough.

There has also been some work done on the PC GUI, there are now more flight settings and it is easier to use. We are currently adding a Joystick configuration window to be able to add support for new joysticks/gamepads more easily:

Crazyflie GUI: Flight data tab