## Saturday, June 1, 2013

### Beginner's Microquad Research: Hubsan x4, Hobbyking microquad, RC transmitter terminology, and more

Hrm, so besides ukuleles, I've also been doing researching into quadcopters for my startup (http://eon.businesswire.com/news/eon/20130516005905/en/accelerator/MIT/MIT-Sloan -- you can guess which one is mine).
Yes, I am going to use quadcopters to teach controls. Even though I know almost nothing about quadcopters.

Well, I did fly a quadcopter for the first time last week. It was a Hubsan x4 I got for $43 including shipping off of ebay. I bought it 3/28/2013 and it arrived on 4/20/2013, and all it required was the addition of 4x AAA batteries (and an hour or so of charging) and it was all set to fly. I bought it after reading this thread, a bit less than a year old (Jul 30 2012), which compares a ton of different microquads: http://www.rcgroups.com/forums/showthread.php?t=1701910  that's how tiny it is. I also tried to fly it outside. In the grass. That was a poor plan. It was super cute, though, because first I set it down in the grass, but it couldn't take off because it was so tiny that the props were buried in the grass. So I set it on top of a tuft of grass and it took off, but when I crash landed one of the props flew off, and I definitely had to search pretty hard to find a 1'' black prop in the grass. So I learned my lesson and now just fly it indoors, though I'm sure an empty tennis court would work fine too. It's tiny enough that I can just fly it down the corridor of my dorm though, and stable enough that I can do this out of the box, even with minimal RC plane experience on my part. Err. But I still broke a prop (or rather my friend did, by flying it into a chair, but I had glued on the prop because it kept coming off due to an earlier crash, so I considered it partially my fault). So still out of commission until I get new props from Orlando, FL later this week. Anyway, so the plot was to try to hack a commercial fully assembled quadcopter and write custom controls for it. I'm sure someone out there is going to read this and laugh in my face ("MIT student sets about reverse engineering Chinese quadcopter"), but whatever, it's a fine way to learn things when you're starting out. " It just appeared to me why it would be interesting! If it's an Atmega328 we'd be able to buy a dirt cheap micro quad and use our own code on it." No one I asked knew about which microquads ran atmegas, though, which is the mcu (microcontroller) I am most familiar with and the one that the hobbyist community is most likely to already have written a lot of flight controller code for. The hubsan, in fact, runs a MINI54ZAN ARM controller.  zoom in the image to see the IC numbers. also, that scar on my hand? hot glue freshman year from small hexalinkagepod. kiddos, watch where that hot glue is dripping, because it can scar you. and if it drops on your hand, run cold water over it immediately. =========== Anyway, then I realized, you know what, hobby king has sort of already done this. They made a quad that is just missing a 4ch DSM transmitter, aka it is RTF (ready to fly) minus the radio, aka it is BNF (Bind-'N-Fly). It's a 70mm quad with 45 mm props, whereas the hubsan x4 is 60mm body. So a bit larger. But it is "multiwii based so it's an atmega 32U4 (the arduino Uno uses the same chip)" (says Charles), yay! It seems that Spektra might have a license on it that makes official DSM radio controllers way more expensive than their non-DSM counterparts. Compare the 2.007 radioshttp://www.hobbyking.com/hobbyking/store/__8338__Hobby_King_2_4Ghz_4Ch_Tx_Rx_V2_Mode_2_.html, which are$23, to the DSM ones available on hobbyking, which range from $65 to$700. Seven hundred dollars! *dies* http://hobbyking.com/hobbyking/store/RC_PRODUCT_SEARCH.asp?strSearch=dsm+transmitter&x=-1197&y=-32. (source: Charles).

The other potential explanation for the price difference is power of transmitter. For real RC airplane flying outside, people will want "full-range" transmitters which are 100mW or more, while for indoors micro-quadcopter flying, especially the ones that come bundled into the ultra-cheap quadcopters like the hubsan x4, they are probably more like 10mW transmitters. (source: Shane). *

Note: I was confused about 4ch versus 5ch and 6ch transmitters. The 5th and 6th channels are usually extra buttons or knobs, e.g. for mode switching.

Anyway, so with the latter, I only need a transmitter, but I need a DSM transmitter. I was concerned at first about reusability of DSM parts, i.e. whether I could easily read the DSM receiver signals and reinterpret them to control a robot. I don't want people to just be stuck with parts they can't use unless they build another quadcopter or something. With the normal 2.007 radio rx/tx, I know it's pretty easy -- Sparkfun has a guide here: https://www.sparkfun.com/tutorials/348 "RC Hobby Controllers and Arduino". According to Shane and Charles, with DSM radios it should be pretty straightforward as well, as there are also PWM receivers.

More clearly, Shane explains it:
there is the link between the receiver and the transmitter, which is wireless
that is what DSM, DSM2, DSMX, FHSS, and 2.4GHz refer to
that is what PWM, serial, and sbus refer to
so you can mix and match, to some extent...you can have a DSM PWM receiver or a DSM serial receiver
you cannot have a DSM Sbus receiver though
because DSM is a Spektrum technology and S.Bus is a Futaba technology and they are competitors
With respect to the hobbyking microquad kit, Shane says:
the one that came with my microquad is a DSM2 serial receiver
which can bind with any DSM transmitter
but some of the more commercial microquads (less targeted towards RC people, more towards being sold in gift stores) tend to use generic 2.4GHz serial receivers
which are not compatible with DSM
so they sell them with the matching transmitter
and that's all you can use
me:
and I cannot find a receiver that will pair with that el commercial transmitter easily
so not reusable in that manner either
correct?
Shane:
not likely
unless they happen to use the same generic 2.4GHz chip
==========
The other thing I can get is to get a hobbyking microquad frame, the one without flight controller, motors, props, and batteries. This may be the path to follow in the future if I want to build my own atmega quadrotor from near-scratch, like my fellow builders (Shane: http://www.instructables.com/id/PCB-Quadrotor-Brushless/ , Charles: http://www.etotheipiplusone.net/?cat=89, Jamison: http://thevariableconstant.blogspot.com/p/kawaiicopter-v13.html).

 (doesn't come assembled)
So, it's missing a lot of things, including the flight controller
KK, Ardupilot, and Multiwii are the three well known top level strains
they all work about the same with different levels of integration and size
and available software
KK is fairly basic and self contained
to ardupilot where you can use PC side software and set waypoints and live data streaming and what not
for a micro quad you'd proabbly be gunning for size and weight the most
my recommendation would be http://www.hobbyking.com/hobbyking/store/__27033__MultiWii_328P_Flight_Controller_w_FTDI_DSM2_Port.html for your list - it's extremely small and is basically an arduino so you can code hack easily
and it has all n degrees of freedom you could want anyway
i would wager against the "hobbyking native" boards - they are typically based off old KK versions
With this frame, though, I can use my own transmitter, which means I can use el cheapo 2.4 ghz transmitters from hobbyking. I could also start development on my own flight controller board, initially with the expensive ($40-$60) IMU boards from sparkfun and then eventually down to just using the invensense MPU3050 or MPU6050 ICs ($3 or something). =========== So at the end of today that's where I'm at. I'm still forming the shopping list, but I thought I should get this braindump out. I am going to investigate all options -- 1. the hobbyking atmega kit (just needs a cheap DSM transmitter, but then I could not release the full kit as open source, and the transmitter costs$20 on ebay so the total cost is ~$70 and I don't know how to legit source DSM transmitters in large quantities for cheap yet -- otherwise the total cost is closer to$120)
2. the hobbyking frame (for research into building my own quad), loading my own firmware onto a commercial quad that is atmega-based (have to find one that is first, or investigate the ARM source code available currently)
3. and building a pcb quadrotor from scratch.
Additional trade-off: smaller copters are safer and less likely to maul you, but their time constants are also smaller so that they are harder to program controls for.

===========
Appendix
Things Shane said:
yeah the receivers on the HK microquad are serial output, not PWM
they would feed into a bigger, PWM-output receiver on a model airplane
so you could have two or more serial "satellite" receivers feeding on master PWM receiver
for redundancy on large model airplanes
if one satellite fails, the other still works
the microquads tend not to use PWM receivers, though, because they're too big
you can get really small ones or take the case off and desolder all the headers from the big ones
yeah just look for four channel micro receivers
but there are only a few that will actually bind to the HobbyKing radios
and i'm not sure if they have small ones
DSM is a more widely used protocol so you can find DSM receivers of all shapes and sizes
Conversation between Charles and I:
do those flight controllers also have software on them / in the community?
yes, you do not have to write the software, it comes preloaded
but is the source code available to work with
yes it is as far as i know they're all community/OS projects
are any of the microquads on the market atmega based? the complete ones on the market like the hubsan x4
oh that i don't know unless they specifically advertise one of the big hardware families, i doubt it
the KKs are ATmega1280? based
modern ardupilots are all atmel ARM cores
* Shane said:
one is that the most expensive part is the plastic and mechanicals
two is that their customer base (RC people) is different than the customer base for the little transmitters that come with the micro quads
the RC people want full-range transmitters (100mW Tx power or more)
so they can fly full-size planes outdoors with them
the ones that come with the micro quads are low-power transmitters for indoor use
maybe 10mW
you can get one of those for pretty cheap: http://compare.ebay.com/like/380587527000?var=lv&ltyp=AllFixedPriceItemTypes&var=sbar