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.
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:
- Get another Teensy, IMU, and DC motor board and mount them together directly with pin headers for a much flatter profile.
- 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.
Comments
The Teensy is a capable little board. We've made sensors using the Teensy, and in fact our first attempt to fly in the dark was performed using a Teensy 3.1 mated to a breakout board using one of our Darkhollow chips (a design from 2013). That was on a hacked eFlite mQX, right before we moved to the Crazyflie in 2014.
Your course looks awesome BTW. I wish such a course was offered when I was in school. I hope your students appreciate how lucky they are.
OK, professor, explain to me what I need to be able to compile Hackflight and load it onto a Teensy, si vous play?
I'm a fan of your posts, but I have yet to plunge into 32bit because I don't know what tools I need.
Merci
Cool, sounds like an awesome project! Now I need to catch up on Season 3 of "Blacklist", then catch some zzzz's.
PS: Buy my book! ;^D
We bought a TX1 for the deep-learning course, but we didn't have much success with it. Unlike RPi or ODROID, the TX1 required a complicated firmware-flashing process (firmware? for $600 full-up computer?!), and the host computer had to be running a specific release of Ubuntu. We did manage to get Theano running on it, but it was significantly slower learning than on the NVIDIA GPUs on our HP desktop boxes. So although I'd be delighted if someone could show me how to get my money's worth out of my TX1 on a quadcopter, the whole thing looks more like a marketing stunt to me: "deep learning + drones = AWESOME". Indeed, googling NVIDIA TX1 DRONE yields links to nvidia.com press releases for the top four hits.
I think that the approach that these guys took makes more sense: collect the visual data, use it to train a deep-learning classifier on a desktop computer (with NVIDIA GPU / CUDA), then run the classifier on an ODROID mounted on the vehicle.
You are correct, Patrix: I am running deeznutz, not nuttx ;^)
Deep learning: I taught a course on this last winter. The textbook author switched from Theano to TensorFlow while I was teaching it! These days I am excited by neurally-inspired vision chips, like the stuff that Geof Barrows works on, and also the new Myriad 2 processor from Movidius -- though now that Intel has acquired them, they don't seem to be moving forward with their plans to sell it directly to developers :^(
Thanks again for your generous and informative reply, I will certainly switchnone of my cleanflight to hackflight this winter. Theses days i am into deep learning and tensorflow...amazing stuff for mad-scientist ;-)
I forgot to include Pixhawk in the list of STM32F4 flight controllers!