Netduino Crazyflie Wii Nunchuk Remote Control V1.0

After flying the Crazyflie for a couple of days with the Joystick shield based remote control I figured an alternate user interface based on a Wii Nunchuk could be interesting. (It might also make the Crazyflie easier to operate for novice pilots). After a couple of hours coding I have a proof of concept Netduino based Crazyflie Nanocopter Wii Nunchck remote control unit.

Initially the nanocopter was difficult to fly, bouncing up and down (thrust control issues) and swaying side to side (roll & pitch control issues). After some digging I found that every so often the Wii nunchuk (my cheap clone) would return a buffer full of 0xFF or 0x00 bytes.  The 0xFF case had been handled but not the 0x00 one. I added a second test into the GetData  method (around line 335) to catch the 0x00 scenario and this appeared to fix the problem.

cnt = 0;
for (int i = 0; i < inputBuffer.Length; i++)
   if (inputBuffer[i] == 0x0) cnt++;
if (cnt == inputBuffer.Length)
{
   return false;
}
CrazyFlie Netduino Wiichuck based Remote

CrazyFlie Netduino Wiichuck based Remote

Bill on Materials (Prices as at Jan 2014)

This software was built using tooling created and shared by others.

Big thanks to

Jakub Bartkowiak – Gralin.NETMF.Nordic.NRF24L01Plus

Szymon Kobalczyk – Wiichuck I2C driver

Antao Almada – HydraMF.BitConverter

The nunchuck accelerometer provides roll and pitch, the joystick is for thrust and yaw. The first version of the CrazyFlieWiiChuckV1.0 is pretty basic and I have intentionally reduced the maximum roll, pitch, thrust and yaw values to make it easier to fly. (Need to set the Grove Base Shield to 3V3 for my code to work)

Currently I only calculate offset values for thrust & yaw. After a couple of test flights some visual indication of the pitch and roll values from the nunchuk would be helpfull.

Netduino Crazyflie Joystick Shield Remote Control V1.0

Sometimes you start with a goal in mind then a couple of days later you have built something interesting but totally unrelated to what you originally intended to do….

I have several devices (both Netduino & Arduino) which I want to use to collect and upload data to the cloud so I can monitor the resource usage of my house.

I had read Clemens Vaster post on Service Assisted Communication and I was planning to use a Windows Server Essentials 2012 box I have running 24/7 in the hallway to forward updates to the cloud.

I wanted to connect the remote data acquisition nodes directly to the server using their baked in nRF24L01+ support. On the server end the Crazyradio 2.4 Hhz nRF24LU1 USB dongle looked ideal. After some initial positive results I found that the CrazyRadio firmware had been implemented in a way that made it not suitable for my application. (I even considered downloading the BitCraze development VM and building my own custom firmware)

After spending a few hours trying to get the CrazyRadio dongle working I looked at my Crazyflie Nano QuadCopter sitting on the bookshelf.

Then I realised what I really needed is a more portable Crazyflie remote control unit so I didn’t have to unpack my laptop. So two nights later I have a proof of concept Netduino based Crazyflie Nanocopter remote control unit.

CrazyFlie nano copter and Netduino Based Remote

CrazyFlie Netduino based Remote

Bill on Materials (Prices as at Jan 2014)

This software was built using tooling created and shared by others.

Big thanks to

Jakub Bartkowiak – Gralin.NETMF.Nordic.NRF24L01Plus

Antao Almada – HydraMF.BitConverter

Mike McCauley – NRF24 library for Arduino.

I used the NRF24 CrazyFlie emulator to debug my project. No doubt stopping me crashing my Crazyflie many times while debugging.

The Joystick shield has to be modified to work with the common Netduino nRF24L01 libraries which use interrupts rather than polling.

The joystick on the shield is for roll and pitch, the external joystick is for thrust and yaw. The first version of the JoystickShieldnRF24l01V1.0 is pretty basic but I’ll try and enhance it over the next couple of posts.