Hackflight Teensycopter

3689701996?profile=original

This video  shows the maiden flight of my new brushed quadrotor, a “totally DIY" project using my own C++
firmware  (Multiwii clone with hardware abstraction), 3DFly
3D-printed frame, and, best of all, a 32-bit brushed-motor flight controller that I built from a Teensy 3.2 board. Why build your own brushed flight controller, instead of using one of the many excellent commercial FCs available today?

Apart from the educational value and satisfaction of building something yourself, I was frustrated by the the limited signal pinout on the commercial off-the-shelf (COTS) boards. Inspired by the work of  Geof Barrows with the Crazyflie platform, I wanted to be able to connect an I2C or SPI sensor to my brushed flight controller, while still using a standard R/C transmitter / receiver. Like many others, I am also drawn to the Teensy/Arduino platform because of the enormous variety of code libraries available for it. By the time you hear about a new sensor, there's likely already Arduino support for it. Finally, I had spent a significant amount of time developing my own hardware-independent C++ firmware , which I already had working with COTS flight controllers on a brushless-motor quad, a brushed quad, and even a DIY simulator. So I was reluctant to buy into another open-source project like the (admittedly awesome-looking) Crazyflie, with its own firmware, radio, base-station software, etc.

The photo below shows one of my earlier attempt to build an FC using a Teensy board and a standard MPU6050 Inertial Measurement Unit (gyro/accelerometer) breakout board. It's obviously much too big for a brushed copter,and I had such poor results using it on one of my brushless vehicles that I gave up, and returned to trying out COTS solutions.

3689701918?profile=original

Then I stumbled across the Pesky Products store on Tindie. Not only was there a cutting-edge IMU shield (with  magnetometer and barometer) suitable for mounting on a Teensy; there was also a shield for turning PWM signals into  rushed DC-motor voltages. Thirty-six bucks and a few days later, I had them in my shop. I soldered pin sockets on the Teensy and pin headers onto the two shields, then soldered a female 1.25mm micro JST connector to each of the four motor through-hole pads on the motor shield. For battery power I cannibalized the power cable on an old Hubsan X4, soldering female jumpers onto the ends (though I subsequently discovered that you can get even these cables on Amazon!) This allowed me to use the standard set of 8.5mm motors and 3.7V battery for this vehicle.

I modified the Pesky Products IMU code to work with my firmware, and then used my own Arduino PWM input library to access the radio signals on my FrSky VD5M receiver. To flash the firmware and test the motors and the receiver signals, I made up a no-power USB cable following the “Option #2: Cut the Red Wire” directions for the Teensy (No, the RED wire!!!)  Several iterations of modify/flash/test later, it was up and flying.

Although the all-DIY quad has about the same gross weight (60g) as the equivalent vehicle with a COTS board, the DIY version is much bulkier. It also doesn't take advantage of the awesome FrSky-compatible micro PPM receiver that I prefer for indoor vehicles; so, instead of one signal wire from the receiver, I need four (or five, for the auxiliary switch). So now that I have a flying prototype, my next steps are:

  1. Get another Teensy, IMU, and DC motor board and mount them together directly with pin headers for a much flatter profile.

  2. Get the micro RX working with an existing Arduino PPM library. I nearly got it working with this library, but I was doing something wrong, because when I powered up the motors, the throttle and yaw signals would swap values with each other intermittently (Yipes!)

One I've done that, I'll do a proper build post, then start comparing flight times and current draw against a COTS board. No data on that yet, but my impression is that the DIY board flies maybe a half or a third as long on the same battery. (I've also ordered a compatible battery  with twice the charge, which should improve things – and this time I ordered the one with the correct polarity!)

Meanwhile, the firmware is on github if you want to look it over.

E-mail me when people leave their comments –

You need to be a member of diydrones to add comments!

Join diydrones

Comments

  • Thanks, Patrick!  Yeah, that's the "solid as a rock" 3DFly rig from GetFPV, but with my own flight controller instead of Beef's Brushed Board.  (I love the BBB, but as I said in the post, these COTS flight controllers are designed for FPV / racing, not mad-scientist experimenting).  As for motors: I couldn't find the 3DFly motors sold separately on GetFPV, so I bought these, which appear identical.  I am driving them with the awesome Teensy DC motor shield from Pesky Products.  Here is his description of the circuit / diodes:

    The PWM pins from the microcontroller drive the gate voltage on the four PMV31XN mosfets, allowing the VIN to be delivered to the motors in increments of the PWM output (from 1/256 to 255/256) individually adjustable for each motor independently .... I have added a second design with the same form factor and function but using 0402-size components including: resistors, FemtoFets (TI's CDS13383F4T 1 mm x 0.6 mm MosFets), and SBR05U20LP 1 mm x 0.6 mm diodes.

    By following his description, I was able to translate motor PWM from my firmware into DC analog voltage very simply.

    I'm also really psyched about the forthcoming Teensy 3.5/3.6.  Like the move from STM32F1 (Naze32 and clones) to STM32F4 (OpenPilot Revolution and clones), this is a move from 72MHz all-integer computing (ARM Cortex M3 generation) to 180 MHz with floating-point support (M4 generation).  Unlike the STM32 boards, however, Teensy does not require learning to work with any new libraries.  

  • I mean brushed 8.5 x 20 mm

  • Hello Simon,

    WOW , you allways have  a real DIYer project on the back-burner, thanks for the inspiration :-) 

    Is that the Brushed Motor ''Solid as a rock'' version you are flying here ?

    These motors seems unusually big compared to my 8025 , can you tell what the model and how you are driving them with the Teensy, (my guess would be IRLML2502) ?

  • Developer

    F.. you. I was blissfully unaware of that Tindie site until you mentioned it. This is going to ruin me and require even more work and storage space for projects.

    Teensy boards are great and have been my go to solution for a long time now, having the perfect balance between size and features for DIY.

    And btw, very nice project. :)

  • Now that's the DIY spirit! Beats the rest hands down!

    Well done.

    The Nampilot

This reply was deleted.