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

  • @Harry: Welcome to my world ;^)   Based on the very short flight times and receiver brownouts I was getting with Hackflight Teensy, I'm actually putting the Teensy on the back-burner for a while, to focus more on developing code for the incredible, inexpensive new micro brushed boards that are coming out, like the Quanum Pico (a.k.a. Micro SciSky), which has a built-in Spektrum DSM receiver and now works with Hackflight.  I'm also working on getting Hackflight to run on the newer F3 boards, and eventually, I hope, the F4 boards that offer more than twice the clock speed of F1/F3.  I even bought one of those little PXFMini boards that Chris Anderson has blogged about, and am working on getting Hackflight running on that.  Fun times ahead!

  • I wouldn't say I have ADD but 6 days ago I took a look at Hackflight and instead of staying focused on getting some hardware and giving it a try, I got distracted by all the 32bit based projects out there.  Ive played with processing and android studio and have some very crude examples of GCS that I put together.  As I looked at all these FC projects, I saw they also have android code to connect to a FC.  Of course I downloaded some and started playing.  One android project even has a graphical Mag calibration feature.  What I've been doing is trying to extract that feature and stick it into my own version of a GCS.  Hey, all this object oriented stuff is supposed to make that easy. So, I fixed all 80 of the recent compile errors.  It should only be a few months now. ;)

    Oh well, one day I might climb out of the rabbit hole and try Hackflight.   Thanks for the exercise.

     

  • @Geof: If you release ArduEye again, then my master plan has succeeded! I started this whole TeensyCopter thing in the hope of getting hold of a Centeye vision sensor.  And I see I'm not your only fan here.

    @Harry: Yeah, that's the downside of Arduino: everything's gotta be in the same folder.  So you end up with confusing folder structures like hackflight/teensy/hackflight.  Upside, of course is that  the IDE runs the same on every OS with little or no trouble.  Last night I made a few modifications to the ground control station Python code (nothing substantial, just the usual image-formatting crap), so that it too runs on Windows.  I'm about to check it on OS X right now ....

  • Simon, thanks again.  I got it to compile after some trouble with understanding where everything needed to be.  It couldn't find the pidvals.h file, so I made one using the error messages.  I used 1's for the values which would have been messed up.  Then it needed the board.cpp and I realized those 2 files need to be in the hackflight folder, duuuhhh.

    Its hardware shopping time.

     

  • @Patrick: Good question. We plan to reboot ArduEye sometime "soon". It was a mistake to stop it. As for the higher performance sensors for nano drones, we have a design that works great for internal development purposes. http://www.centeye.com/small-nano-uas-autonomy/ However the cost-to-make would price it above most diy applications at the moment. That may change as we work out manufacturing kinks and learn what we can eliminate.

    @Simon: Well, in that case, I wish your students luck! :)

    Small / Nano UAS Autonomy
    Solutions for GPS-denied near-Earth autonomy New applications for small and nano UAS, for example inspection and parcel delivery, involve flying clos…
  • You're welcome.

    Class dismissed ;^)

  • Thank You, Professor!!  That's the start I needed. 

  • Geof: Thanks for the details on your Crazyflie mod, and for your kind remarks.  My neural-net students are taking their first exam now, so they probably aren't very happy or appreciative ;^)

  • Harry: Thanks for asking. I've started working on a how-to README hoping to have it done by this evening.

  • @Geof ,  

    Simon's enthusiasm and dedication is quite unique indeed, I do not recall speaking about bare metal coding and tensorflow on a Saturday evening with any of my teachers. 

    BTW, can we expect any new commercial releases of Centeye's products ?

This reply was deleted.