Zoe resurrected

I’ve only just boxed up Zoe having reached her limit, but now the Raspberry Pi Zero W has been released with WiFi and Bluetooth built in, freeing up her one micro-USB socket and thus opening up the possibility of adding GPS tracking to her too.  I’ve just ordered one from The PiHut to try it out.

This isn’t going to affect her maximum camera video size of 480 x 480 pixels, so she’s never going to work on gravel like Hermione, but it’s a useful upgrade nonetheless.


I haven’t smiled this much since my kids were born.  I’m still beaming now with the occasional burst of delighted laughter too; my jaws are even starting to ache.  It’s just over 4 years since the project was born, and finally it’s shown that a Raspberry Pi running standard Raspian Linux and programmed in Python is more that capable of running a fully autonomous quadcopter (though strictly speaking, Hermione is an X8 drone). 🙂 😛 😀 😎

P.S. This isn’t the end but the opening up of the next phase:

  • Test higher resolution for the ground facing RaspiCam video, ideally to the maximum of 1076 x 1076 pixels and see whether that’s good enough for lateral flights on the gravel drive.  This is relatively simple and could well happen in the next few days.
  • Add GPS both for setting multi-step targets, and, combined with compass, tracking the flight location / orientation between these targets.  There’s several phases to keep me busy here.
  • Add the imminently arriving Scanse Sweep for object avoidance
  • Set her loose in a maze!

But for the moment, I just need to wait for my rabid grin to ease!

P.P.S. Code’s updated on GitHub

P.P.P.S. I’ve stashed the video on the front page so I can carry on blogging.

Air punch!

just like Andy Murray winning at tennis, I was shouting “Yes!” while beaming, and punching the air!  I don’t think any flight has ever given me this big a sense of joy and success.

Not only had the pre-warmed LiPos combined with the new PCB resolved the I²C problem, Hermione was flying in a breeze and when it gusted, she returned back to where she took of from suggesting her camera motion tracking is working well over the gravel.

So once more, I’m back on a roll.  I’ll make up a better winter coat for the LiPos, and then see if I can crank up Hermione’s video pixels.  I will upgrade to the new PCB next week, and they include the LED and button switch I’ll need for setting up GPS preset flight steps.

And I’ll get a video done to show it all working again once the wind eases up enough.

Hermione in wonderland.

Took her outside this morning, and the safety test without LiPo consistently threw I²C errors as yesterday.  I brought her straight indoors, still powered up, both her and my piPad and ran the same test; she worked perfectly. Curiouser and curiouser.

P.S. Shortly after writing the above, I had a eureka moment in the shower: I remembered reading LiPos don’t work well in the cold, and even the Mavic instructions suggest letting it run for a while before take off to let the battery chemistry warm out.  Next test then is to wrap both LiPos (batter bank and the main power) in bubble wrap, boot her up indoors, and then take her outside to fly.  I’ll report back here anon.

P.P.S. It worked!!!!! I wrapped both LiPos in some neoprene foam (normally used for scuba suits), set everything up and running the code and therefore the GLL and PWM to keep the LiPos warm indoors. After a couple of minutes, I lugged everything outside, and she did two flights without a glitch. Roll on spring / summer!

Boding not well enough…


With the new PCB, she works perfectly with no I²C errors.  So I took her outside, and she hit I²C errors immediately and consistently.  Back indoors immediately, and once more, no I²C errors.  There are only two differences:

  • 20°C indoors compared to 5°C outdoors
  • LiPo not plugged in indoors, but was outdoors.

I’m assuming the latter is the problem, probably caused by ESC drawing too much power.  If so, my even newer PCB layout should resolve this.  I’d better get on and order it pronto.


Bodes well!

The new PCB arrived, and I’ve done a few indoor tests, and I’ve only seen one I²C error over a total of 60s testing.  Previously, the I²C problem would occur in a fraction of a second.  So my power spike / noise speculation was probably right but needs refining.  Next step is to take Hermione out to build up confidence and to check what video frame resolution she can handle – currently it’s 640 x 640 pixels.  Annoyingly there are gales blowing and forecast to stay for the next few days.

I’ve already been designing the layout for the next PCB revision before this one arrived.  The main change is that the PCB is fed 5V independently from the Raspberry Pi.  Obviously their grounds are connected.  The power comes from a dual port (2.5A each) LiPo Battery Bank – one of these already powers my piPad B3 and RPi touch screen independently and beautifully.

In addition, but unrelated to the PCB power solution, the new PCB design includes a button and LED.  These are for use in the next phase: setting up a series of points in the flight plan based upon GPS targets.

Essentially, prior to a flight, Hermione is set down in several places, and the button pressed; the LED flashes while a sufficient number of GPS satellites have been acquired, at which point the LED goes on for 1 second, the GPS position is saved to file and the LED goes off.  This can be repeated several times to construct a list of GPS positions saved to file as the flight plan.

At the start of a flight, the LED flash / on / off sequence is repeated to acquires enough satellites and record the take-off GPS position; Hermione then climbs to 1m height, and hovers there for a second, yawing to face the first GPS target point saved previously in the flight plan file.  Then she heads there at 1m/s.  Once at the first GPS point, she hovers again, yawing to point towards the second GPS target, and off she goes again, with the sequence repeated for all of the prerecorded GPS targets.  On reaching the final pre-recorded GPS point, once more she hovers for a second while she yaws to face the takeoff GPS point taken at the start of the flight, and back home she goes.  Simples!

Doesn’t bode well

I’ve been tinkering with the existing PCB layout (shown below) to see if power supply changes fix the Garmin LiDAR Lite (GLL) I²C interference.

Hermione's closeup

Hermione’s closeup

I’ve basically removed the black cuboid 1.5A 5V switching power regulator using the space instead to add a 680uF electrolytic capacitor between 5V and ground near the GLL as specified in the docs.  I then powered her up directly via the PCB, rather than indirectly via the RPi micro USB 5V output GPIO pin.  I used a lab power supply which can handle up to 5A.

Hermione showed identical I²C errors with the GLL plugged in, even if not used.  The PSU showed only 0.45mA at boot, 0.5mA with Hermione’s code running passively, and about 0.6A while she was ‘flying’.  This strongly suggests the new PCB won’t solve the problem either.  I am running out of fingers to cross 🙁

The option of using the GLL PWM output is still open, but I’m not keen to swap over to using the pigpio library this requires as it uses a daemon process in the background, unlike RPi.GPIO and RPIO which both directly access the /dev/gpio devices.  I wonder how hard it would be to write my own PWM C library with python wrapper to epoll the GLL PWM pin?  It would require a new PCB revision as would pigpio so there’s a PITA there too.  For some reason, probably because this all just works on Zoe, I still want to keep banging my head to solve the I²C problems.

Tangerine dream

I’m waiting for a new PCB for Hermione which hopefully will sort out the I²C errors that the Garmin seems to be the source of.  That means I have 10 days to kill with nearly nothing to do except this – putting her HoG in a Pimoroni Tangerine PiBow:

Tangerine PiBow

Tangerine PiBow

The part that pleases me most is actually the RaspiCam cabling that can be folded flat, nicely fitting between the RPi and the PCB, and emerging from the case dead-center above the video connector.

Once complete and with the new PCB installed, the case can be extended to have a lid (the current PCB overruns the case by the GPIO pins), providing crash and weather protection for Hermione’s HoG* (or should that be Hermione’s HoT now?).

I’ve countersunk the M3 underside corner-holes of case level 0 so the base is flat, allowing the case to be attached to the frame with a double sided foam pad.  To ensure the RPi is held firmly within the case, it’s bolted to the underside of layer 3 with 8mm M2.5 standoffs on the top of layer 3 to connect to the PCB.  This does raise the RPi slightly higher (it’s intended to sit loosely on layer 2) and so some careful filing is needed on the underside of layer 5, both for the camera cable and the HDMI connector.  But as you can see, the result is a perfect fit.  The new PCB (also in Tangerine from Ragworm) will fit perfectly inside.

I just hope the new PCB does resolve the I²C problem so that this make-up doesn’t prove to be Hermione’s end-of-the-line.

*HoG (Heart of Gold) is the the ship from Douglas Adams’ “Hitchhikers’ Guide to the Galaxy” which contains the Infinite Improbability Drive which allowed faster-than-light travel when provided with the Brownian motion source; I consume 3 pints of tea each morning to meet her needs.

DJI Mavic shopping list

First, just pay the extra £350 and buy all the extras with your Mavic:  two spare batteries, multiple battery charger, car charger, phone charger, spare props.  No point going to an amazing location and taking only one battery and no chargers.  There’s also a bag, but it’s useless once you have the essential travel necessities too.

Instead I got a Peli iM2100 storm case.  There’s a B&W equivalent with laser cut-outs, but I prefer to do my own hole making for exactly the pieces I need. And the peli case was available unlike the B&W equivalent.



Joystick clamp: with a custom cutout peli case (and actually even with a laser cut B&W), it’s worth keeping the joysticks on the RC aligned in storage as the instructions say.

Launch pad: not a necessity but there is good reason – on take-off there’s a pause while the Mavic photographs the takeoff point; on return to home, GPS gets the Mavic most of the way home but the launch pad recognition gets it to within a few centimetres.

Landing Legs: unless you’re on a hard, dry surface you’ll need these little legs to keep the camera and gimble off the ground and away from the damp grass.

Cheap mobile: No point risking your iPhone or Samsung when a £60 Android will fit perfectly and provide a fantastic 5.5″ screen; no SIM required though if desired, this one supports 3G, and it’s £69 sibling adds 4G and LTE.

P.S. I’ve found a couple of other options worth mentioning:

For the joystick clamp, I’ve swapped to this one, which is injection molded rather than 3D printed. It’s a better design, a better finish, and cheaper.

For connecting the cheap mobiles to the RC, none of the standard adaptors supplied by DJI work. There are two choices:

Neither option is perfect, just make your own choice.