Project in progress

Flying Drone Mjolnir With Hacked RC Transmitter © LGPL

Files for laser cutting a foam Mjolnir that fits around a micro racing drone, and how to hack an RC transmitter for Arduino control!

  • 13,309 views
  • 1 comment
  • 54 respects

Components and supplies

About this project

Introduction

Warning: Mjolnir is very hard to steer

Mjolnir is Thor's trusty hammer, and will always return to his hand when thrown (as depicted in the Marvel Cinematic Universe, anyhow). So how do we build our own legendary flying hammer? With Arduinos, of course!

The heart of this hammer is not a dying star, but rather a micro racing drone. The hammer itself is a foam and balsa wood frame built around the quadcopter with plenty of open areas for air flow.

The true test of worthiness, however, is throwing Mjolnir and summoning it back to your hand. That trick is done with an Arduino Uno controlling the quadcopter transmitter via digital potentiometers. Push buttons mounted to a wrist brace control pitch and throttle, and an accelerometer maps hand movements to the quadcopter's roll. With some patience, this makes Mjolnir controllable with one hand, leaving your other hand free to catch Thor's hammer!

This is not a beginner project, and a lot of the hammer's design was modified on the fly (pun intended), so the final product doesn't map perfectly to the provided CAD files. There's also a ton of variability in receivers and transmitters, so you will need strong troubleshooting and trial-and-error skills, and even then Mjolnir handles like a fat cow in the air. You have been warned!

Hammer Materials:

The hammer body is mostly made of foam sheet is from Dollar Tree; you'll have to peel off the paper lamination before you begin constructing the hammer! A rectangular frame made of balsa wood holds the quadcopter in place, it's made by laminating two 1/8" thick parts with Titebond III for strength. The adhesives used are 3M 78 for gluing foam to foam, hot glue for everything else, and foam safe CA glue to fix boo-boos after crashes.

The svg used for laser cutting the parts are all on this page. For the foam, all the angled edges were beveled to 22.5 degrees with a utility knife before being glued together. The faces of the hammer are hot glued to the head because the edges didn't line up, and a fillet of glue was needed for structure. The handle of the hammer was not laser cut, because it's just a 4"x10" rectangle of foam rolled up and hot glued shut along the seam.

The frame is the tricky bit, the included files are an older design where the quadcopter was higher up in the hammer. It turns out that the props need to be very close to the bottom of the hammer head to work properly. So in the final design, just the outer rectangular shape of the frame is kept and the prop guards of the quadcopter are incorporated into the structure. The quadcopter used here is an Emax Babyhawk running on a 3S 260mAh Lipo battery, which is tucked into a box above the handle (which was ultimately made to fit the dimensions of the battery by hand, rather than the laser cut part). The handle and battery box are hot glued to the bottom of the quadcopter.

Setting up the Babymax is a whole other tutorial on it's own which is covered extensively elsewhere. I used a Spektrum DSMX racing receiver, which is hot glued to the Babymax camera mount, with the camera gutted since we don't need FPV of the inside of a hammer and it saves a few grams of weight. You'll notice the hammer is two separate parts, with a "base" hot glued directly to the prop guards of the quadcopter, and a top "case" that rests on top. Two rectangular strips of foam were glued to the base to help guide the case on top of the base, and a small set of neodymium magnets secures the case to the base.

Don't forget the paint! Normal spray paints will eat away your beautiful foam creation, so you'll need to use an acrylic paint. If you're fancy, use an airbrush, if you're just a little less fancy like me, use an acrylic based spray paint like Liquitex.

Opening the Transmitter

This technique should work on any RC transmitter with potentiometer joysticks. We're going to be adding 3 wire connectors so the joysticks can be bypassed and the transmitter directly controlled by an Arduino via AD5206 10K digital potentiometer.

Splice in to the Potentiometers

I used servo extension cables, that way the transmitter can easily be used as normal or connected to an Arduino. Make sure you label your wires! Drill some holes into the transmitter back for the wires to come out from, and close the transmitter back up.

Connect to Arduino via AD5206

Check out the code included with this tutorial! Refer to your datasheet, the code, and your transmitter to work out wiring the potentiometer to the transmitter. Match the transmitter pot's ground, wiper, and v+ to b, w, and a of the digital pot. This Arduino tutorial is a good resource. Find a couple push buttons and an LIS3DH accelerometer (same one used for firebending!) and connect them as shown in the schematic attached to this tutorial. You'll notice a toggle switch in parallel to a pushbutton switch as input to pin 6; that represents whatever you've chosen as the arm switch on your transmitter. The push button becomes your new arm switch, and the Arduino simply reads the state of the switch so it knows when to throttle up or down.

Load up the included code, plug your Babyhawk into your computer and connect to Betaflight Configurator, and do a system test! You should be able to see the receiver values change by pressing the buttons and tilting the accelerometer.

Mount the Electronics

I used a wrist brace to mount the throttle button, pitch button, and accelerometer. They connect to the Arduino Uno through about 3 feet of wire. The transmitter, Arduino Uno, and digital pot are all just taped to a board of wood with foam mounting tape. Everything fits into a fashionable red sling backpack!

Are You Worthy?!

Mjolnir flies about as well as you'd expect a brick shaped object to fly. Any slight gusts of wind knock the poor thing around like crazy, and there isn't really a good way to launch or land. Almost every time the hammer "lands", the handle will probably break off. But that's what glue's for! After a solid day of filming I managed the successfully "throw" and catch Mjolnir about twice, but both times the shock of catching the hammer ended up breaking it. What I'm saying is there is lots of room for improvement here! (Especially since I used the stock PID settings XD)

Code

Flying MjolnirC/C++
Used on Arduino Uno with AD5206 potentiometer and LIS3DH accelerometer to control a DX6i Spektrum transmitter
// include the SPI library:
#include <SPI.h>
#include <Adafruit_LIS3DH.h>
#include <Adafruit_Sensor.h>
#include <Wire.h>
// set pin 10 as the slave select for the AD5206 digital pot:
const int slaveSelectPin = 10;
int accelValue = 0;
int rollValue = 0;
int rollValuePrev = 0;
int throttleValue = 0;
int pitchValue = 0;
// two buttons for pitch and throttle
const int pitchPin = 7;
const int throtPin = 6;

int throttle = 0;
int roll = 1;
int pitch = 2;

int flag = 0;
int pitchFlag = 0;
//value must be determined empirically:
int maxThrottle = 120;

// I2C
Adafruit_LIS3DH lis = Adafruit_LIS3DH();

void setup() {
  // set the slaveSelectPin as an output:
  pinMode(slaveSelectPin, OUTPUT);
  pinMode(pitchPin, INPUT_PULLUP);
  pinMode(throtPin, INPUT);
  // initialize SPI:
  SPI.begin();
  Serial.begin(9600);
  Serial.println("LIS3DH test!");  
  if (! lis.begin(0x18)) {   // change this to 0x19 for alternative i2c address
    Serial.println("Couldnt start");
    while (1);
  }
  Serial.println("LIS3DH found!"); 
  lis.setRange(LIS3DH_RANGE_2_G);   // 2, 4, 8 or 16 G!  
  Serial.print("Range = "); Serial.print(2 << lis.getRange());  
  Serial.println("G");
  //initialize the pots at reasonable values
  digitalPotWrite(pitch, 60);
  digitalPotWrite(throttle, 51);
}

void loop() {
  lis.read();
  accelValue = lis.z;
  //values must be determined empirically:
  accelValue = constrain(accelValue, -16383, 16383);
  rollValue = map(accelValue, -16383, 16383, 51, 204);
  //hand tilt controls roll
  digitalPotWrite(roll, rollValue);  
  
  pitchValue = digitalRead(pitchPin);
  throttleValue = digitalRead(throtPin);

  //"throttle" button is connected to the "arm" switch of transmitter and state
  //is read by Arduino. Pressing the button arms the drone and the Arduino can
  //then gradually raise the throttle
  if (!throttleValue) {
    if (flag == 0) {
      flag = 1;//throttle button is pressed
      for (int level = 51;level<maxThrottle;level++) {
        digitalPotWrite(throttle, level);
        delay(2);
      }
    } else {
      digitalPotWrite(throttle,maxThrottle);
    }
  } else {
    if (flag == 1) {
      flag = 0;
      for (int level = maxThrottle;level<52;level--) {
        digitalPotWrite(throttle, level);
        delay(2);
      }
    } else {
      digitalPotWrite(throttle,51);
    }
  }
  
  //the pitch button is a single bit, so whened pressed the pitch is
  //gradually raised, and when not pressed the pitch is gradually
  //lowered. So just forwards and backwards, good luck!
    //values must be determined empirically:
  if(pitchValue) {
    if(pitchFlag==0){
      pitchFlag=1;    
      for (int level = 94; level<160; level++){
        digitalPotWrite(pitch, 255-level);
        delay(2);
      }
    } else {
      digitalPotWrite(pitch, 94);
    }
  } else{
      if(pitchFlag==1)  {
        pitchFlag=0;
        for (int level = 94; level<160; level++){
          digitalPotWrite(pitch, level);
          delay(2);
        }
      } else {
          digitalPotWrite(pitch, 160);
      }
    }
}

void digitalPotWrite(int address, int value) {
  // take the SS pin low to select the chip:
  digitalWrite(slaveSelectPin, LOW);
  //  send in the address and value via SPI:
  SPI.transfer(address);
  SPI.transfer(value);
  // take the SS pin high to de-select the chip:
  digitalWrite(slaveSelectPin, HIGH);
}

Custom parts and enclosures

Mjolnir Parts
These are the parts I started with, but they had to modified on the fly to make sure it...flew. Think of this as a rough draft!
mjolnir_parts_YAauBpirPn.svg

Schematics

Arduino Transmitter Hack
Arduino control an RC transmitter via digital Potentiometer. Check your datasheet and the above code for wiring Pot to Transmitter.
flyingmjolnir_uecS1dvxnq.fzz

Comments

Similar projects you might like

DIY RC Plane 4 Channel Transmitter – Receiver Using Arduino

Project showcase by Team RootSaid

  • 11,984 views
  • 0 comments
  • 22 respects

Arduino GPS Drone RC Boat

Project in progress by maboshi

  • 5,273 views
  • 5 comments
  • 43 respects

AR DRONE and 1SHEELD - Discover the world around your drone

Project tutorial by OMEGA D2

  • 26,758 views
  • 12 comments
  • 166 respects

Make an Autonomous "Follow Me" Cooler

Project tutorial by Hacker Shack

  • 94,586 views
  • 189 comments
  • 362 respects

VU Meter on Steroids: Arduino Nano and NeoPixel WS2812B

Project in progress by Team WannaDuino

  • 21,818 views
  • 81 comments
  • 80 respects

Joystick Controlled RC Car

Project tutorial by Arduino_Scuola

  • 8,948 views
  • 1 comment
  • 9 respects
Add projectSign up / Login