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!
Here’s Chloe’s HoG in Hermione’s frame. You can see I’ve put a large WiFi antenna on one of the side platforms; the other is for GPS in the future. The frame itself is not quite complete – I still need to install a platform on the underside to hang the sensors off. In addition, the LID (LiDAR Installation Desktop) needs assembling – it’s just here for show currently.
Chloe’s HoG in Hermione’s frame
Here’s a flight with just accelerometer and gyro in control for basic stability testing.
With these 1340 high pitch Chinese CF props, there’s no shortage of lift power despite the fact she weighs 2.8kg, so I’m going to defer the X8 format for a while on financial grounds – 4 new T-motor U3 motors and 40A ESCs costs nearly £400.
The PCBs are on order, and first setup will be for LEDDAR and PX4FLOW.
Oddly, only one of my PX4FLOWs works properly – for some reason, the newer one can’t see the URF, so can’t provide velocities, only angular shift rates; however, LEDDAR will give me the height allowing me to convert the angular rates to horizontal velocities. If that works, that also opens up the possibility of replacing the PX4FLOW with a Raspi Camera using the H.264 video macro block increments to allow me to do the equivalent of the PX4FLOW motion processing myself, which if possible, would please me greatly.
Still lurking in the background is getting the compass working to overcome the huge yaw you can see in the video.
I wired up PIX4FLOW to my test rig, knocked together some test code, set up the I2C baudrate to 400kbps to make sure it worked at the same rate as the IMU needs.
PX4FLOW test rig
I took it for a walk around the garden: from the office to the garden via the hallway, then an anticlockwise 6m diameter circle around the garden before returning back to the office. The code was sampling at about 20Hz, with the test rig about 60cm from the ground with the Y axis always pointing away from me. The walk took about 80s.
Here’s the X, Y distance graph based upon integrating the velocities the PIX4FLOW gives.
A quick walk through:
- 0,0 is in the office
- throughout the test the Y axis pointed away from me
- beyond the 4m point, I walked in an anti-clockwise circle
- once complete I doubled back and headed back to the office.
I’m delighted with the garden section; because the y axis was always facing forwards, from the PX4FLOW point of view, it always went forwards, but when transformed to the earth frame using the gyro readings, it shows a really accurate plot shape. Given this was just a green grass surface, I’m amazed the down facing camera did such a good job
Here’s the height graph from the inbuilt URF:
It’s good except for the spikes – I may need LEDDAR to make this better. On the plus side, the height is not integrated, so the spikes do not have a persistent effect.
There were a few problems or inaccuracies:
- the sensors should timestamp each read, but the register value did not change so I had to do this myself with time.time() – I have a second sensor on the way to see if it’s the sensors faul (ebay PX4FLOW to find them)
- the scale of the circle is wrong: the graph shows the circle to be about 3m diameter, but it should be more like 6m – this may just be a problem in my maths
- the end of the walk should return to the start, yet it’s 6m out – the shape of the walk out of and back to the office match, but there’s a 30° error by the end of the flight. I suspect only compass will fix this.
One unexpected positive was that although I’ve heard the I2C SMBus only supports 32 byte buffers, it seemed fine reading the 77 byte registers in a single sequence.
Overall then as a first trial I’m pretty delighted to the extent it’s now worth getting the new PCB for Chloe / Hermione.
PiZero HoG Diet
Space is a bit tight between Zoe’s frame plates since I’d swapped to 3mm thick double sided adhesive foam tape to attach her to the frame. Then I found these low-profile IDT plug and socket connectors which reduced the separation between the PiZero and the HoG PCBs by 5mm.
Just need to reinsert this into her frame. It’ll be good to have her back. It’s so much easier trying to diagnose FIFO overflow problems when the HoG is powered by a separate battery so I can leave the ESCs / props disconnected and do the testing indoors.
Top row are variations of the breadboard PCBs; bottom row are Zoe’s and Phoebe’s new custom PCBs. Phoebe is already wearing her new HoG and I hope I can show her flying the IMU FIFO code imminently.
Gerber files and Eagle board layouts are on GitHub.
Big thanks to Ragworm for there super-fast turnaround.
What have I been up to?
- Phoebe’s HoG PCB is now out for manufacturing – hopefully this will fix the I2C problems and allow me to progress with adding the magnetometer (orientation), URF (height) and camera (motion) sensors into the mix. The new PCBs are due to arrive on or before 29th.
- Zoe’s undergone a minor rebuild of her frame to lift her CoG nearer to prop height to reduce the swinging in an otherwise stable flight – her main battery now resides on the top plate, and her power bank underneath. I could improve this further by getting rid of the power bank completely, but that will require a new PCB to incorporate the regulator.
Other than that, I’m flying Zoe indoors daily tuning her PIDs ready for her upcoming performances. She still drifts, and because she’s now using the IMU FIFO code, I’m back to considering sensor drift due to temperature. She performs best in the freezing cold with the large difference between cold ambient and her IMU operating temperature. However I won’t be investigating this further within the timeframe of the performances.
I simply couldn’t give up on Phoebe so easily: after posting, I spotted all the components needed to build a clean Zoe PCB which I did. I attached it to Phoebe, and everything worked. So the I2C problems are the fault of the breadboard-like PCB Phoebe uses. So once more, Phoebe isn’t dead yet, and the new PCB layout is already in progress for the lovely peeps at Ragworm to produce in the next week or so.
Zoe went to the kids’ playroom for a maiden flight. I did no tuning, she just inherited Phoebe’s PID tuning values. The result was one perfect flight, one flight with horizontal drift, and one flight with a crash and a clipped prop (an unexpected reaction by the ESCs to ctrl-C mid-flight, I think) – replacement props are already on their way (£5 a pair). Clearly there’s some tuning to do.
But at the same time, she is working amazingly well for a set of untuned maiden flights, so here’s the Bill Of Materials which comes to around £270 plus the unpriced bits and bobs that all cost less than a pound each.
There’s now a two week wait before further progress can be made on Zoe the Zero. The PCBs are in production, and the frame is on its way from China. It’s not the frame I was intending to use as that one is unlikely to be available until the new year. But some ebay hunting turned up a fab frame from Tarot, the guys who I got Phoebe’ and Chloe’s fab legs from. Click the pic to see more, but be patient – the Tarot site is very, very slow.
I’ve started to consider adding a barometer, even though it’s anathema to my core target of using just accelerometer and gyro (because consensus is it cannot be done but as yet, I’ve not found a single explanation why not). But if I rigidly stick with just the accelerometer and gyro I have a nasty feeling the project will just grind to a halt and I’ll start getting bored. I don’t do bored at all well.
What’s been holding me adding the barometer up is the pin spacing on my chosen IMU replacement for the MPU6050. There will be an improved version coming in the spring with the pin layout I need for 0.1″ pin spacing, but spring is a very long time away on my getting bored scale. Whereas I could just stop waiting for the world to conform to my needs, and instead, choose to fit in with the rest of the world; in other words, produce a new Raspberry Beret for Zoë that has PCB holes specifically designed to take the current IMU.
The changes are trivial, and I’ve already have a draft layout of the new PCB and components; I’ll be talking to Ragworm tomorrow about a quote.
In the meantime, I’ll start looking at FIR / IIR filters (thanks Phil!) to separate gravity from net-acceleration to cope with the sensor drift.
I also have a niggle that there must be an underlying cause for the sensor drift, and the prime candidate has to be temperature, so I’ll probably do some experimentation there too.
*The worm that turned