Scratching That Itch

I did something silly. I bought a lot of ten “broken” cheesy indoor quadcopters on eBay — to hopefully cobble one working one together and to amuse my son. At this point, I’ve got eight working. The bad news is that they all come with dirt-cheap transmitters that aren’t really conducive to flying at all. They’d be a lot more fun if they could be controlled with a real remote. Enter the hackers.

Most all of the cheap quads are based on one of a handful of radio chipsets, although they use different protocols. An enterprising hacker could conceivably just bundle together this handful of radio modules, and the rest would be a simple matter of software. That’s exactly what Pascal Langer’s DIY Multiprotocol TX and supporting firmware does. This hobby project was so successful that compatible hardware is manufactured by more than a few Chinese companies, and non-geeks have them installed in their radios. The module lets you control virtually anything that uses 2.4 GHz. Of course, I’ve got one of them.

I opened up the cheesy drone’s transmitter, found that it used a popular chipset, and worked through all the different supported protocols that used it. No dice. But the radio module did have nicely labeled SPI lines, so I reached out to Pascal. A couple of Sigrok sessions later, he’d figured out that it was trying to bind on a different channel, I’d recompiled the firmware, and was playing with the drone’s other functions.

I just love a good SPI-sniffing session. sigrok-cli -d fx2lafw -c samplerate=4000000 -P spi:clk=D0:mosi=D1:cs=D2 -A spi="mosi transfer" --continuous | grep A0 | uniq reads the SPI lines, decodes the packets, filters out the commands, and removes duplicates, in real-time. All that’s left to do is wiggle the sticks, mash buttons, and take good notes.

None of this was hard, and certainly none of it was expensive. I got my drones under the control of my fancy-schmancy remote, and have a good foothold into controlling them algorithmically later on thanks to everyone’s previous work on reverse engineering these protocols. Support for DF Drone’s SkyTumbler will be included in the next DIY Multiprotocol TX release, and I spent about four or five pleasant hours on this project. Maybe only a handful of people will stumble on this particular protocol — or maybe it will just be me. I did it mostly just to scratch my own particular itch.

But that’s one way open source works, thrives, and grows. Here’s to you all out there, from the Deviation team, who did a lot of the early drone protocol reverse engineering, to Pascal for the DIY Module, to the Sigrok folks who made the tools accessible for me to piggyback on everyone’s previous work. Keep on hacking!

11 thoughts on “Scratching That Itch

  1. Had never heard of sigrok before. I suspect sigrok will rapidly become a serious argument subject between my wife and I for the next couple of days as I’m gonna play with it the whole weekend till I fall asleep. it supports sooo many devices already.

    1. It’s nice, and the fx2lafw drivers are good for cash-strapped hobbyists.

      Pulseview has saved my butt a few times by helping me find odd protocol errors that would have been annoying to do with an oscilloscope, like “every other SPI byte is zero” or “the UART bits are shifted by one”.

      It lets you turn a cheap digital logic probe into a multi-function analyzer with a nice and easy learning curve.

  2. Any good recommendations on cheapie sigrok (or some other cheap/free software) compatible logic analyzers? The Saleae products are too rich for my blood, and I’d like to stay under $50. Something that supports common low-ish speed digital protocols, parallel digital captures, and if it could possible do a little analog that would be nice too.

      1. They will be sold as “Saleae 16” clones on eBay. They can’t do ultra-high speed, but they _do_ stream continuously, which is really nice. For general purpose SPI/I2C/I2S/etc they’re just the ticket.

        For analog, though, you really want a scope.

        For $10, everyone should have a cheapo logic analyzer.

        1. I was thinking of possibly using it as a computerized process monitor/logger, in which case I suppose I might be better off using something else like a microcontroller so that I can have outputs too. For in-circuit analog analysis and the like, I do have an o-scope.

  3. I really support your thoughts here and love the hidden purpose within a purpose. You buy 10 drones for the gratification of your child but the higher purpose is to really gratify yourself! I love this life hack.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.