Freesteel Blog » Flightlogger
Tuesday, February 16th, 2016 at 6:30 pm - Flightlogger, Hang-glide Comments Off on Wrynose Pass Delight
Following a very grumpy Friday and an off-the-cuff comment by someone on Facebook to the Wrynose Pass as a potential easterly site, I headed off from Bull Pot Farm into the Lake District where I have never been before.
I was not in the most ideal mood for this sort of thing, being alone with a hang-glider on an unfamiliar craggy hill at 3degreesC and 27mph wind. Fortunately I stopped myself from doing anything really stupid, and sat in the car stewing and programming until suddenly and unexpectedly the wind dropped to something between too light and perfect.
I didn’t hang around, having already scouted for my hillock of a take-off point.
Thursday, February 11th, 2016 at 3:50 pm - Flightlogger, Machining Comments Off on Flattening the electronics
After months and months of stirring through the compact three-dimensional enclosed arrangement of overheated servo motor drivers and circuit boards, unplugging and plugging them back in again, attempting to tune them, and causing all sorts of interference signal spikes and yanked wire problems, I decided that it would be better just spread everything out on a triangle of scrap plywood.

Now that I have totally lost faith in these Leadshine drivers, it’s going to be easy to replace them with gecko drivers, when they show up. They have Error signal pins, which also need wiring into the system, along with other signals. Everything is now completely accessible. The folded shelter material is to keep out the rain of iron filings from the milling that can’t possibly do this circuitry any good.
Then I performed the same trick on the hang glider logger, which similarly was enclosed in a 3D box of circuits. This has been opened out onto a flat panel of wood — after Adrian warned me that acrylic would likely be too brittle and crack. (He didn’t have any spare Delrin after touting how wonderful this type of plastic is.)

It’s an enormously heavy and large panel, even though it contains exactly what was in the original setup. It’s kind of like unpacking your rucksack into a hotel room and making it knee deep in stuff.
Things have to be in the open to be worked on.
It took forever to measure out all the mounting points and design them, even though I mostly resisted the temptation to over-engineer any of it with convenient clip-together holes.

The hardest thing to design is the battery case. I wanted one where the batteries slid in from the end, instead of the usual side entry from which they tend to easily fall out. This is version 5 where the bolts holding it down go between the two battery cylinder channels.
I must have consumed about a kilo of 3D printing filament (we only had black) building all the mounting points. The old box is the coloured bit.

Originally I was going to have this panel mounted on the upright of the glider and poking out forwards on a aluminium rod, like this:

Then when I tried it yesterday morning I realized there would be too much vibration — something I hadn’t noticed while merely handling the rod in my hands without one end stiffly anchored. This wouldn’t do any good to the accelerometers.
I do get a lot of things wrong, so I am used to changing designs suddenly (hence all that scrap). I wonder how much harder it is to change when working in a team and you have to persuade more than one other person that we need to junk everything right away and not waste more time on the wrong track. It’s the inertia, so to speak.
We went walking in the rain on Saturday at Loggerheads and cycling in the murk on Sunday just before it began pelting it down. Here’s a video of the plughole at Ladybower Reservoir from that day.
Friday, January 22nd, 2016 at 1:03 pm - Flightlogger, Machining Comments Off on Kicad tech
The old hang-glider flight logger is falling apart due to shoddy wiring, strip board soldering, being crammed into a 3D printed plastic box and then thrown about in my bag and on the field for a year.
The new way to do things is to design the circuit separately and then cut a special PCB for it.
I’ve been extracting and running the individual components as best I can, including digging into the airspeed probe wheatstone bridge, which unfortunately needs an INA125 amplifier that I had stupidly soldered down onto the board instead of using a socket.
I’ve got very little understanding of the numerous files created by kicad, but I have committed them. Here is the diagram of the circuit:

Now I got to tidy the mess on the desk up and see if any of the electronics still works as well as it once did before I tried to reverse engineer my own work.
Maybe I should have done it this way in the first place. But then that would have added another wall into the learning curve. (The learning curve is the amount you can get done on the X-axis vs how much you need to know to get that amount done on the Y-axis, so a shallow curve means you can get stuff done without needing to know too much.)
Next job is to get some help laying out circuits from someone who has done it before. I hope to sandwich it between two sheets of laser cut acrylic and find some slick way of mounting it on the glider so I don’t kick it on the first day.
Not only that, I’ve got to get back to looking at the data so far. As usual, hardware hacking is a lot more fun than doing the software. This distraction must end. Normal service will be resumed.
Wednesday, September 16th, 2015 at 7:40 pm - Flightlogger 2 Comments »
Following on from last week’s episode and the Emil’s sterling work reverse engineering the HC-SR04 echo location board, JD tapped in to a couple of pins on the surface mounted microcontroller so we could get the echo signal directly.

I’ll try to report this as straightforwardly as possible without too many diversions about how we worked it all out.
With two HC-SR04s facing one another, and as per the datasheet, the scope tracing is as follows:

Cyan is the trigger to device A, Magenta is the 40kHz 8-cycle wave generated by device A (delayed to allow the MAX232A chip to charge up), Yellow is its corresponding echo pin which is programmed to go high once the 8 cycle signal goes out, and Blue is the received signal in device B. [The corresponding wave generated by device B is received at the same time by device A which is programmed to take its the echo pin (yellow) low.]

Zoomed in on the initial cycle to see there are 8 and that their wavelength is four to a vertical division, or about 25microseconds each, corresponding to 40kHz. The transducers probably resonate at this frequency (to give a better energy to sound conversion) which is why so many more waves are received than sent out.

This is the received signal, overlaying the half-second of samples (about 10 because I’m repeating the loop with a delay of 50milliseconds) proving that it’s pretty stable.
By zooming in on a single wavelength and averaging over the previous 64 we can make it dance with the application of the fan
Device B (the receiver) is the one by the oscilloscope. By directing the fan along the sound vector we’re able to blow back the sound signal by approximately half a wavelength or about 12microseconds.
I’ve spent hours playing with this setup, but it’s only going to be any good if we can read the values using a microcontroller, like an Arduino.
(more…)
Tuesday, September 8th, 2015 at 4:08 pm - Flightlogger 6 Comments »
The amazingly cheap HC-SR04 ultrasonic sensor works pretty well for what it does, which is measuring distances by echo location, but I wanted to use it for measuring air velocity as my mechanical anemometer is unreliable and of no use for getting the direction.
The sonic anemometer uses the theory that you can measure the time it takes for sound to travel through the air (about 2938.6microseconds to travel one metre) and the delay it would experience if the air was also traveling against the direction of the sound waves (about 8.6 additional microseconds for each metre per second in velocity). These values should be no problem for an Arduino running at 16MHz frequency to detect.
The basic interface code to run the HC-SR04 is as follows:
float speedofsoundmps = 340.29; // metres-per-second
digitalWrite(triggerpin, LOW);
delayMicroseconds(2);
digitalWrite(triggerpin, HIGH);
delayMicroseconds(10);
digitalWrite(triggerpin, LOW);
long timemicros = pulseIn(echopin, HIGH);
System.out.print("Distance (cm) = ");
System.out.println(timemicros/1e6*speedofsoundmps/2*100);
// factor 2 because distance
// is there and back
The basic code for pulseIn() counts processor cycles for the duration of the voltage being HIGH.
Here’s my experimental setup using two such devices, one sending and the other receiving (though you do need to trigger both in order to arm the receiver). Note the desktop fan to generate the wind.

And these are the experimental results plotted over five minutes, making a reading 20 times a second for ten minutes.

The average time of 1545.7microseconds equates to 52cms, which is an under-reading as the actual distance is 60cm, but we’ll ignore that for now.
If we turn the fan on we get an average reading of 1551.7micoseconds with a higher standard deviation of 13.4 (not surprising as the fan air is chopped and turbulent) which is an average difference of 6microseconds amounting to a wind speed of about 2 metres per second, agreeing approximately with the figure from my mechanical anemometer.
I’m not interested in tracking down the source of the error or calibrating this setup while the readings themselves are so darn noisy and in excess of the signal I am attempting to detect.
What is the source of the noise?
(more…)
Thursday, August 13th, 2015 at 5:27 pm - Flightlogger Comments Off on GPS velocity records
I’ve got a Global Top Inc FGPMMOPA6H GPS module (datasheet) in my hang-glider data logging device. Using the command packet:
$PMTK314,0,50,1,1,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0
I’ve programmed it to give me a GPRMC every 50 cycles, a GPVTG every cycle, GPGGA every cycle and a GPGSA every 10 cycles.
The command $PMTK220, 200 is used to set the length of the cycle at 200ms, so I’m getting a positional and velocity reading 5 times a second.
The code for controlling all this is here. Note that my code does not contain hundreds of lines of #defines of the form:
#define PMTK_API_SET_NMEA_OUTPUT 314
that you tend to get in other people’s programs for the purpose of referencing the this-will-never-change-hardware-encoded 3-digit string ‘314’ by the arguably more readable (ie I will argue with you) string ‘PMTK_API_SET_NMEA_OUTPUT’ that serves no purpose, isn’t interpreted by anything except the preprocessor, and you have to look it up to get back to the number that is actually documented in the manual. Why is this controversial? </rant>
(more…)
