Posted on Leave a comment

3 Days of the PixRacer with ArduPilot

I spent my 3 day long weekend getting the Pixracer to work. For some reason it made me think of the classic Robert Redford movie “3 Days of the Condor”, where a CIA research analyst who “just reads books” had to figure out a complex conspiracy in 3 days.

Ok, so this is not that, but I was under the pump, I really thought it would be easy, I was planning to get the Pixracer wired up and flashed on Saturday, then work on my Sopwith Camel build for the rest of the weekend. It didn’t work out like that.

But, in the end – I got it working, 3 long days later!

I recorded the whole saga, so come along for the ride! (please Subscribe to Tim the Planman on YouTube for updates). These are the links to the videos:

Maybe my problems are partly because I use a Mac. Why is the Mac “second fiddle” for things like this? Mission Planner has no official version available for Mac. The new release (thanks ArduPilot), still has this caveat: 

Native MacOS and iOS support is experimental and not recommended for inexperienced users. For MacOS users it is recommended to use Mission Planner for Windows via Boot Camp or Parallels (or equivalent).

https://github.com/ArduPilot/MissionPlanner/blob/master/README.md

Mission Planner does run on the Mac, but

  • It looks horrible, the fonts are too small to be readable on my laptop screen (I put it on an external monitor when I’m at home, but this won’t work in the field)
  • None of the panes are resizable
  • It doesn’t seem to be able to flash the Pixracer. I had to use QGroundControl to do this (worked great).
  • I don’t know why I should have to use BootCamp or Parallels

But my challenges getting it all working were not just about the Mac. 

There is a lot of folklore about flight controllers and how to get them to work, and not a lot of useful documentation. Most of the best information came from getting tidbits of information here and there, from various videos from people like Painless360Joshua Bardwell and Andrew Newton. But even then – I had to pay attention, it was one 2 second soundbite from one of Painless360’s videos that gave me the hint about why the servos didn’t work while I was running the Pixracer off the power from the USB.

That said there is some useful information out there. Here are some useful links:

Posted on Leave a comment

Binary Aurora ArduPlane Build Log

This is the build log for my SonicModell Binary with Arduplane running on the Qio-Tek Zealot H743 flight controller.

See my Youtube Video showing the fully working set of electronics on my Active Wiring Diagram.

See my YouTube video showing how I configured all the electronics on the Active Wiring Diagram.

See my YouTube vide showing how I setup the Express LRS mixes, channels and outputs on the Active Wiring Diagram.

Components

  • SonicModell Binary basic kit
  • SonicModell Binary official “Power Pack” including Motors, ESC’s and servos
  • Qio-Tek ZealotH743 Flight Controller (see more about this below)
  • Qio-Tek ASP5033 CAN AirSpeed sensor
  • Benewake TF-Mini-S i2c LIDAR
  • Generic LED Light Pack
  • RunCam Thumb FPV Camera (front mount)
  • Foxeer Nano Razor FPV Camera (tail mount)
  • Boscom TS582000 video transmitter 
  • 180 Degree pan servo
  • 3d Printed Painless 360’s pan/tilt mount from Thingyverse (thanks Justin)
  • 3D printed Binary motor mounts from Thingyverse
  • Wheel retract kit + steering servo for the nose wheel
  • Naminno Express LRS Nano RX receiver + Flash TX transmitter module running ExpressLRS 2.0
  • [Raspberry Pi Zero + 4GLTE Mobile Data Stick]

The SonicModell Binary model

I’m not really sure why I was drawn to this model, but I really do find it quite appealing. I think the model is based on the real world Tecnam P2006T – at least to me it looks like it. The shape of the nacelles, the sleek nose and the shape of the tail really nail it. It’s a beautiful plane.

But by directly copying the ‘real plane’ it seems that SonicModell got themselves in trouble. There are a lot of videos out there documenting this, and I’ll write up below what I have done to address the issues.

Qio-Tek Zealot H743 Flight Controller

I saw on the ArduPilot discord that this flight controller was recently (maybe at version 4.1.6 or 4.1.7) added to ArduPilot and when I took a look at the Qio-Tek.com website, I was blown away by the specs, especially for the price. So I ordered one and I’ll be using it in the Binary.  You can now buy these at SmartFleet.systems, a North American authorized reseller.

I was originally going to use the PixRacer, but got stuck when I realized that with only 6 servo outputs I would not have enough for extra controls like the camera pan/tilt if I wanted to do anything like:

  • differential thrust on the motors
  • separate channels for ailerons
  • flaps
  • retractable and steerable landing gear

So reluctantly I decided that this would not be a PixRacer build. I’m a little disappointed, I really like the PixRacer but I am going with the ZealotH7 and that’s it.

So what’s so nice about the Zealot? Here’s a few things:

  • Built in AT7456E OSD! (analog, but built in – works great)
  • 2M of Flash and 1M of memory – great for LUA scripts
  • 2x i2c connectors (in addition to the one for the Compass/GPS)
  • 2x FD-CAN connectors
  • 2x Barometers, 2x Gyros, built in Compass
  • Internal 5V, 1.5A internal BEC
  • 14 PWM Outputs with independent power rail 
  • Built-in BEC (6S 1.5A) power input for servos 
  • Includes external GPS/Compass, WiFi module, 14S power module, Safety button/buzzer, i2c/CAN splitter, SD Card and bunch of cables

On top of that, it’s very cheap. About 1/2 the price of a Durandal! 

Wing Loading

The Binary is notorious for “tip stalling”, probably induced by the small wings. (There are lots of videos about this on YouTube). So I have a plan. What I will do is this:

  • Extend the wings. Add about 6cm to each wing about where the flaps/ailerons gap is on the wing.
  • Widen the wings. Add about 3cm in a ‘stripe’ just behind the Motor nacelles and in front of the flaps/ailerons. So not for the full length of the wings. This wider area is just to the part where the wing extension goes. Beyond this the outer part of the wings are standard.
  • Add washout by twisting the outside section of the wing after adding the “stripe”
  • Add a second spar to in the back of the wing – about where the ‘widening’ strip goes. Not full length, probably about 1/2 the wing length.

This will reduce the wing loading and move the centre of lift towards the back of the plane. This means the plane is less likely to be tail heavy and can safely carry more weight.

Surgery

Surgery

Reconstructed

Other problems

As I built out the model I noticed something else that might have caused the problems that others have reported. Rag the Nuts off (on YouTube) said something about the motor mounts but I don’t think he looked at it closely enough. I was worried about the flimsy plywood motor mounts that came with the model and I 3D printed mounts I found on thingiverse.com, but even then I found the mounts came loose very easily. I have now screwed and glued the motor mounts into the plane, but I check them carefully each time I fly because I have found they wriggle loose.

Paint/Covering

I’m using Mod Podge “Hard Coat” to provide a shell like casing over the entire foam surface of the plane. 5x coats dries to an amazing tough shell. I guess it’s an experiment, but I’m going to try this in place of packing tape or laminate or other covering/protection.

I’m going to paint this some outrageous colours, with primer over the Mod Podge and then acrylic paint. But I can’t see investing a huge amount of time/effort in it. I’m definitely not using the stock stickers but I’m going for visibility more than anything.

I’ve found the Mod Podge is amazing. The strength and rigidity it gives to the plane are excellent and it’s very resilient to little bumps and knocks. However the Mod Lodge doesn’t seem to make a great base for painting, so I’m finding that the paint chips off, but it only affects the look, the Mod Lodge shell under the paint is solid and reliable.

Wiring

I’ve built myself an “active” wiring layout because there is a lot going on and I want to make sure everything is working before I build it into the plane. What is happening here is”

  • Zealot H743 running ArduPlane 4.2.3 mounted pretty much right at the CoG – mounted facing forward so there is no compensation required.
  • Qio-Tek Power Distribution board connecting a 4S battery to the flight controller and ESCs. 
  • 2x SonicModell 40A ESC’s. One of the power outputs from these will be diverted so as not to burn out the servo rail on the flight controller. This creates a very useful extra 5V regulated power output that should be perfect for …
  • Both of these ESC’s also have additional pigtail battery voltage (VBAT) connectors. One of these will likely be used for the video transmitter and camera and the other will probably drive the navigation lights.
  • 6x 9g metal geared servos. SonicModell kit provided. I don’t know if these are digital or analog. Ailerons x2, Flaps x2, Elevator x1, Rudder x1. I’ll run separate connectors to each servo, because I want to be able to trim each individually.
  • Nose wheel steering and retract. 1x Retract motor + 1x Steering servo (still TBD)
  • FPV Pan camera mounted at the front. 1x 360 degree pan camera.
  • Caddx Ratel 2 FPV Camera +  
  • Bosom TS582000 Video Transmitter (requires a PWM output for settings)

This requires at total of 12 PWM Outputs including the motors (which will be separately controlled to allow for differential thrust).

This is what it looks like.

Wiring “diagram”

Express LRS

I’ve wired up a Namimno Express LRS micro receiver to a UART on the Zealot. I’m using a UART because I seem to have no other choice for this. For some reason, there is no SPI (or other) connections available for any Express LRS receivers, except for the ones that are built into the flight controller. Very disappointing. But OTOH it “just works”. I also set up Yaapu telemetry on my Open TX radio (still haven’t made the leap to Edge TX), it’s kind of awesome to watch the artificial horizon on the HUD and get direct updates like the flight mode, displayed and announced by the transmitter.

Ardupilot parameters required to get this working are:

SERIAlx_PROTOCOL = 23 (RCin)

RC_OPTIONS = 288 (existing value bit 5 [arming check throttle] = 32 + bit 8 + 256)

  • bit 8 = CRSF (Crossfire) passthrough
  • bit 9 = Suppress Crossfire mode/rate message
  • bit 11 = Crossfire RSSI shows Link Quality

The ExpressLRS communications need to run in “Wide Mode” so that we get fully resolution on at least the first 12 channels. Express LRS updates each channel at 1/8th the packet rate, so to update a servo at 50hz, you need to the packet rate to run at 500Hz. This is a compromise with range. so to get longer rage the packet rate needs to be lower. I’m going with 500 Hz to start and might experiment with a lower rate later once I start to make longer flights.

The telemetry ration is how often telemetry packets are sent back to the transmitter. I higher number means slower updates on the transmitter, but a lower number increases latency since more bandwidth is consumed with teletry. I’m going to go with 1/8 to start.

It’s also important to Turn off ADC filtering in radio (System Settings, Hardware) for Express LRS.

Benwake TF-Mini-S i2c LIDAR

The lidar comes out of the box set for UART (grr) and the provided cable needs to have the tx/rx lines reversed to work. (pull the green and white pins out and flip them on one end). To set to i2c, connect to an FDDI adapter using the provided cable, make sure the lidar is working, then use the Benewake windows “Test app” to send the command:

5A 05 0A 01 6A
5A 04 11 6F
  • 5A 05 0A 01 6A (to switch to i2c mode)
  • 5A 04 11 6F (to save settings)

Warning! As soon as you do this, the lidar will stop working. all of sensor readings will stop and the screen will freeze. You will think you have broken it. This is because i2c and FDDI don’t talk and it’s actually fine. Connect the LIDAR to the flight controller and configure these settings:

RNGFND1_TYPE = 25 (BenewakeTFminiPlus-I2C)
RNGFND1_ADDR = 16 (Bus address of sensor for the TFminiS)
RNGFND1_MIN_CM = 10 (Rangefinder minimum distance)
RNGFND1_MAX_CM = 500 (Rangefinder maximum distance)
RNGFND1_GNDCLEAR = 9 (Distance (in cm) from the range finder to the ground)
RNGFND1_ORIENT = 25 (Rangefinder orientation: 25 = Down)
RNGFND_LANDING = 1 (Enable rangefinder for landing)

It should be working. If it doesn’t work, I have no idea how you would debug or fix it, but I’ve done this twice now with 2 different devices, so it does work. 

Qio-Tek ASP5033 Digital CANbus/DroneCAN Airspeed sensor

CAN bus is so nice. There is no messing around, pretty much turn it on , plug in the device and it works – at 1Mbps! These are the parameter values:

CAN_P1_DRIVER = 1 (requires reboot before doing the rest)
CAN_P1_FDBITRATE = 1000000 (this will default - no need to change it)
ARSPD_TYPE = 8 (CANBus/DroneCAN)
ARSPD_USE = 0 (set to zero to start until flown to make sure it's working)

Video Transmitter/Camera

There will be one camera (Foxeer Razer Nano) mounted on the tail for flying FPV and a Runcam Thumb mounted in the canopy on a pan/tilt mechanism for recording. There will also be a Caddx Ratel 2 on the front of the pan/tilt. I’m not sure yet how I intend to use these, at very least they will be ‘pluggable’ so that either camera can be used for a particular flight.

The Video transmitter will be mounted inside the fuselage above the camera bay. There is a perfect cavity at the back of the plane behind camera bay where a transmitter antenna can be mounted so that it is protected. I’ll mount a circular polarized antenna in this space. This is the TS582000 VTX with antenna mounted on the shelf that will slide into the slot provided above the camera bay:

The white wire on the side is for “Smart Audio”, not really audio at all, it provides 9600 baud control Link from the flight controller to the transmitter to control output power. This is especially useful on a high powered transmitter as it can easily overheat and power should only be applied when needed and not “on the bench”. Smart Audio has a “Pit mode” and ArduPilot understands how to enable this, so by connecting the yellow wire to Rx on UART5 (and also ground), the following configuration settings give pretty complete control of the VTx Power output.

Parameters for setting the VTX control on the flight controller. First set VTX_ENABLE = 1, then reboot. A number of new VTX options will be displayed.

VTX_ENABLE = 1 (enabled)
VTX_POWER = (set to the power you want from your VTX - working?)
VTX_POWER_MAX = 1000 (set to the max power of the VTX)

Retractable Landing Gear

This plane will have a retractable nose wheel. The rear wheels will be fixed, but I want to be able to mount a camera on the underside of the aircraft, so getting the nose wheel out of the way will be essential. Not to mention – the drag, retracting the nosewheel will significantly reduce the drag. So how does it work?

First – I bought a retract set from BangGood. It has 3 sprung wheels and those can be used for spares. The main nose wheel retract and one set of wheels will be installed. The retract has a single PWM style servo cable that connects to the flight controller. It uses two settings PWM < 1200 to retract the wheels and > 1800 (or thereabouts) to deploy them for landing/takeoff. This is connected to PWM output “Aux1” = servo pin 9 on the flight controller. A steering servo is also attached to the wheel and this is connected to PWM output “Aux2” on servo pin 10.

Retracts should work both manually under pilot control (set to Switch B and RC Channel 7) on the radio transmitter and also the flight controller must to be able to retract the wheels automatically for auto takeoff and landing. 

To make all this work, these are the ArduPilot parameter settings:

  • RC8_OPTION = 29 (Landing Gear)
  • SERVO9_FUNCTION = 29 (Landing Gear)
  • LGR_ENABLE = 1 (refresh parameters after setting, no need to reboot)
  • LGR_DEPLOY_ALT = 8 (deploy when less than 8 meters from the ground)
  • LGR_RETRACT_ALT = 12 (retract when higher than 12 meters from the ground)
    • should be higher than LGR_RETRACT_ALT
  • LGR_OPTIONS = 3 (this is the default – retract on takeoff, deploy on landing)

Ground Steering also needs parameters set and tuned to work. The basic one is (GROUNDSTEER_ALT = 5.0, STEER2SRV_TCONST = 0.5)

Ardupilot Parameter configuration

There are a lot of steps required to set up a basic plane configuration with ArduPilot, but although it seems like a lot, if it’s organized it really isn’t too bad, although it would be great if ArduPilot had a “configurator” like iNav or BetaFlight as tracking down all these parameters is a bit laborious and potentially error prone.

Hardware components

Each piece of hardware has it’s own requirements for configuration required to get it to work. I’ve mentioned most of these above. In a nutshell:

  • Express LRS receiver ()
  • i2c LIDAR (see above)
  • DroneCAN Airspeed Sensor (CAN_P1_DRIVER = 1, ARSPD_TYPE = 8)
  • Video Transmitter control with SmartAudio
  • Camera switcher
  • OSD configuration
  • Landing Gear (LGR_ENABLE = 1, RC8_OPTION = 29, SERVO9_OPTION = 29, LGR_DEPLOY_ALT = 8, LGR_RETRACT_ALT = 12, LGR_STARTUP = 0)
  • Ground Steering (GROUNDSTEER_ALT = 5.0, STEER2SRV_TCONST = 0.5)

Radio Control

The basic rule is don’t do anything on the transmitter. Send the raw signal (e.g. sticks etc) through to ArduPilot and let ArduPilot do it’s magic. This applies to everything except for RC passthrough which is really a “passthrough” because Ardupilot does nothing with these. (so see below for special treatment for the Pan/Tilt servos).’

Basic Flight Parameters

For the first flight, is seems like there is a bewildering array of parameters that need to be set, but it’s actually quite simple because almost everything can be left as default. Some things might need to be added later for autonomous missions and auto takeoff and landing but this should not be done right away. Keep it simple.

Many of these are being set to very conservative values because of the known issues with the Binary. Although I think I’ve improved this (see above), this needs to be tested and proven.

  • MAN_ROLL_EXPO = 30% , MAN_YAW_EXPO = 25%, MAN_PITCH_EXPO = 25% – expo used when flying in manual mode
  • ARMING_RUDDER = 2 — Rudder right to arm, Rudder left to disarm
  • STALL_PREVENTION = 1, STAB_PITCH_DOWN = 2 (degrees)
  • TRIM_ARSPD_CM = 1500 (15 m/s) — target airspeed for automated modes
  • ARSPD_FBW_MIN 12 (10 m/s) keep the speed high until we learn more about this plane – 20% higher than stall speed
  • ARSPD_FBW_MAX 20 (20 m/s) assume fairly high max speed – must be 50% > MIN
  • LIM_PITCH_MAX = 2000
  • LIM_ROLL_CD = 4500 (45 degree max roll) – limit bank angle to reduce the risk of tip stall on turns.
  • WP_LOITER_RAD = 50 (50 meter loiter radius will be used by RTL and Loiter)
    • This is quite small because of my flying field. Bigger would be better but I don’t have that luxury.
  • ALT_HOLD_RTL = 6000 cm (60m) – this is safely above the treeline.

Advanced Flight Parameters

  • Automated Takeoff (TKOFF_TDRAGSPD = ??, TKOFF_DIST 75, TKOFF_THR_SLEW = 20, TKOFF_TDRAG_ELEV = 0) TKOFF_TDRAG_ELEV is set to keep the nose wheel on the ground.
  • Automated Landing (LAND_PF_ALT = 0, LAND_PF_SEC = 0, LAND_FLARE_ALT = 1, LAND_FLARE_SEC = 4, LAND_ABORT_THR = 1)
  • Retractable Nose wheel (LGR_ENABLE = 1, RC8_OPTION = 29, SERVO9_OPTION = 29, LGR_DEPLOY_ALT = 8, LGR_RETRACT_ALT = 12, LGR_STARTUP = 0 (wait for pilot input))
  • Ground Steering (GROUNDSTEER_ALT = 5.0, STEER2SRV_TCONST = 0.5)
  • Return to Launch FLIGHT_OPTIONS (set 16 bit maybe 20)
  • Scripting – SCR_ENABLE = enable Lua scripting, SCR_HEAP_SIZE = 200000
  • Terrain following – TERRAIN_ENABLE =1, TERRAIN_FOLLOW = 0 (all modes), TERRAIN_FOLLOWING = 30m
  • Flight Options (16 = climb to ALT_HOLD_RTL before RTL)

Geo Fence Options

As you may know, I’m a big fan of the Geo Fence Options. These are the ones I’m likely to use, but to until the basic flights and auto tune have been created. Some of these options are generic (always on) and some depend on their being a fence set up on the vehicle.

FENCE_AUTOENABLE = 1 (Requires a fence), FENCE_ALT_MAX = 100m, FENCE_RADIUS = 300m (for initial testing).