Close

Recap #4: Flying

A project log for BradWii on the Hubsan Q4

In which the author runs open source firmware on a palm sized quadcopter

ajlittajlitt 03/16/2015 at 02:500 Comments

I ran into a couple of roadblocks in the week since barely getting Bradwii loaded:

BradWii for X4 was configured to arm the motors if the yaw is all the way to the right and the throttle at 0. The stock TX has a range too narrow to hit the default thresholds. The stock TX's case has rounded edges in the stick cutout so the values at the corners are lower than at the extreme of one axis. To get around this I changed the arming combination to low throttle + high pitch and decreased the thresholds until they worked reliably.

I got the Q4 to arm, and the props turned at low throttle. But trying to fly resulted in an instant barrel roll. It took a few days of trial and error, but I eventually realized I had mapped the motor PWM channels 180 degrees from the orientation of the sensors. With fixed motor channels I got the Q4 to hover for a few seconds, but then the shakes set in and ultimately it would power dive into the floor. I hadn't changed the PID coefficients from the X4 defaults so I'm not surprised.

On more formal quadcopters, the PID settings are tuned remotely during flight with a sideband channel, or with a serial cable on a fixture that allows the quad to rotate on one axis on the bench. BradWii has a feature to change certain parameters in realtime and save them to on-chip EEPROM, using the micro's UART for communication. Unfortunately the Q4 has no other external interface but the ARM SWD debug port and is too small to use the usual tricks for running tethered anyway.

The pin map I made showed that the UART pads on the Mini54 were being used for radio SPI framing and the interrupt from the accelerometer, so I couldn't blue wire out the UART. One alternative I considered was using unused bytes in the Hubsan protocol and modifying the TX somehow. The Hubsan TX uses an STM8 micro, but even that board has its UART pins committed to other peripherals. It would also mean a descent into yak shaving as I would have to write my own replacement TX firmware. I also considered using [alvaro]'s work in putting the TX under PC control, but being a relative noob to flying RC things I didn't want to stray far from the handheld transmitter.

Discussions