Skip to content
Christian Blum edited this page Jun 3, 2013 · 5 revisions

Summary

This code enables the usage of the Walkera Magic Cube with a computer. For this it uses an Arduino to emulate a remote control. Commands can be sent via a serial interface to the Arduino which in turn talks via PPM to the Magic Cube controlling the copter.

PPM Generation

To use the provided code, you need an Arduino with an Ateml with a 16bit timer like the ATmega328. This timer is used to generate the PPM signal emulating a remote control. Interrupts toggle Pin 9 (OC1A) on the Arduino with correct timings using an array of PPM timings which can be set using a wrapper which accepts (roll, pitch, yaw, throttle) tuples. The communication with the Arduinio is done with a serial interface.

Serial Interface

Right now we just send plain text of numbers for the different input channels seperated with blanks. Tuples are seperated by newlines. We will integrate MAVLink in the future.

Physical connection

In order to fool the Magic Cube into believing it is talking to a remote control, the upper two of the channels of the audio connector have to be shortened to mass. Since The cube wants an inverted signal, we have to account for that. Please have a look at operation.jpg in the repository for details.

Operation

  1. Connect the arduino running the firmware
  2. Connect a gamepad to your computer
  3. Start the supplied python code to read the gamepad
  4. Set thrust to zero on the gamepad
  5. Switch on the Magic Cube
  6. Wait for a steady blue light on the Magic Cube
  7. Set thrust to a non-zero value for a short amount of time
  8. Magic Cube should start binding and signal ready
  9. Have fun

Development

There are two ways to use the Magic Cube: you can use it on a normal remote control or you can use the official Android App. We investigated both methods to control it via a computer but the one emulating the remote control succeeded faster. If you want to take a look at our investigations regarding the audio port control, take a look at the early_attempts branch.

Clone this wiki locally