Freesteel Blog » Machining

Thursday, May 5th, 2016 at 4:29 pm - - Flightlogger

I must have changed cards for one in an old camera or something, because the data files went bad on the hang glider logger.

What started out as an effort to plot a timeline of the holes in my data has turned into a simple SD card write benchmarking experiment which allows me to see the slippage.

The code sort of goes like this:

int multiple = 200; 
long biggaptime = multiple*2; 
long sumnormaltimes = 0; 
long nnormaltimes = 0; 
long flushmultiple = 1000; 
void loop()
    // wait for the next 200microsecond moment
    long mstamp; 
    long mstampnext = ((int)(mstampprev/multiple + 1))*multiple; 
    do {
        mstamp = micros(); 
    } while (mstamp <= mstampnext); 
    // output the microsecond value in 8 hex characters
    for (int i = 32-4; i >= 0; i -= 4)

    // if that write took longer than expected, record how long
    long mwritetime = micros() - mstamp; 
    if (mwritetime > biggaptime) {
        if (ngapsline < ngapslineP) {
            PRINT(" ", mwritetime, ".", nbytessincegap); 
        nbytessincegap = 0; 

    // otherwise keep track of the average time
    } else {
        sumnormaltimes += mwritetime; 
    nbytessincegap += 8; 
    // flush at a defined multiple of looks
    if ((n % flushmultiple) == 0) {
        sumnormaltimes = 0; 
        nnormaltimes = 0; 
        long mstamppreflush = micros(); 
        long mstampflushtime = micros() - mstamppreflush; 
        P(" F", mstampflushtime); 
    mstampprev = mstamp; 

This produces output like this:

1085.0 17500.320 2926.512 2906.512 2912.512 3574.512 2925.512 2914.512 2912.512… (33.89)
10000 215737 F7575 994.320 407194.192 4632.512 2915.512 2943.512 2920.512… (33.89)
15000 407211 F7601 1104.384 3279.128 4400.512 205153.512 2916.512 2920.512… (33.82)
20000 207194 F7576 1018.448 3255.64 4535.512 2915.512 2916.512 204380.512… (33.80)

One can interpret it as taking on average 34microseconds per 8 byte write block, with a pause of 3milliseconds after every 512 bytes, and then an enormous 205millisecond pause after every 8*512=4096 bytes. The call to flush() takes 7.6milliseconds.

We can plot the timeline of writes with this function:

ftext = open(“SPEED.TXT”).read()
ts = [ int(ftext[i:i+8], 16) for i in range(0, len(ftext), 8) ]
t0 = ts[-20000]
sendactivity(points=[((t-t0)*1e-6, y) for t in ts[-20000:]])

to get the green series of points labelled 1 in the diagram below (where the yellow vertical lines represent one second increments):

Thursday, April 28th, 2016 at 12:04 am - - Flightlogger, Hang-glide

Well, the hang-gliding has been quite lovely. But the logger appears shot to pieces.
I still don’t know what I am doing when I get to cloud-base, which is probably why I plummeted out of the sky shortly after this picture was taken.

As soon as I took off, the barometer stopped communicating most of its data.
This is the device I lavished so much time on isolating it from the rest of the electrical circuit and arranging for it to bitbash the information back through an interrupt pin.

It could be some timing issue, or whatnot. No way to debug it. Luckily I got myself a Bluefly vario which does the same thing of reading a MS5611 barometer on a tight 50Hz loop and transmitting it back to the main board. In the Bluefly’s case it’s for the purpose of running a Kobo/XCsoar system. I’ve just given up on the one I built as it’s too inferior to simply running XCSoar on the phone where I’ve got colour and more or less know how to use it.

Luckily the Bluefly also sports a GPS and works through a serial port, so I’ve yanked off the Adafruit GPS breakout board and bodged the wires to insert the Bluefly in its place.
Then there was a small matter coding it up using a complex state machine to program the GPS module through the Bluefly pic processor to get it to read at 10 times a second.

But then the BNO055 orientation sensor played up and decides to shutdown at unexplained moments for unexplained periods of time.
The white vertical lines are 10 minute intervals, and there is a green dot for every successful orientation reading, with y-value proportional to the time since the previous reading, so I’m getting gaps in the data of half an hour in flight.

I’ve produced a reset timer to try and start it off again if no data comes through for 20 seconds.

Anyways, here is one of those nerve-wracking close encounters with the ground during the flight.

Monday, April 18th, 2016 at 4:43 pm - - Machining

This has taken a lot of effort fighting through the device trees on the Beaglebone to make it access the PWM and Quadrature encoder services at the same time, which is the minimum required to effect a stimulus response observation from a DC servo motor powered by an H-bridge.

What happens when you apply a fixed voltage to the DC motor for an eighth of a second, then reverse the voltage for another eighth of a second, and then set the voltage to zero (and try it for many different voltages and directions):

Here’s the graph of motor positions (in Y) over time (in X) for 20 different trials:


Tuesday, April 5th, 2016 at 1:04 pm - - Flightlogger

On this second day of heavy rain in the Pyrenees I think I might have the time to catch up some ancient history from all of last week. We waited five hours on El Bosque for the wind to come right, and were then rewarded with this flight with vultures.
These birds came much closer than they ever showed up in the pictures. They fly with hunched shoulders.

Unfortunately the GPS for that flight is inexplicably jagged, so here’s a flight above Teba from a day later where the data is cleaner.



The yellow cube is 1000m on each side for scale from a flight that took off at the point on the frontmost vertical cube edge

Here’s a zoomed in section of the left most section of the path, shown looking down, with 100m XY axes in yellow. The track comes in from the bottom right goes to the top left (against the wind direction), then turns left to make four anticlockwise loops that drift back with the wind

Tuesday, March 29th, 2016 at 9:28 am - - Flightlogger, Hang-glide

It happened towards the end of the flight before last when my wings became my own, and I just wasn’t thinking about it any more. I stopped having those intervals where I lose concentration and fall out of the sky because there was no concentration to lose. It was all about the feeling.

Above the town of Teba watching the cars scooting along the grid of streets like busy beetles in a rotten log

Low on same rocky hill just after take-off where I struggled to survive for some minutes before I found a bubble of rising air

If you need to learn hang-glide, there’s a English school down here called Lejair where you could get it all done in two weeks (instead of the average two years of weekends back in England) because the weather is better and they use tow trucks with gliders tethered above a trailer so you can learn how to fly it without having to run up and down the hill and learn how to steer in short difficult bursts. (If you have to ask why you need to learn hang-gliding, then you don’t need to.)

We were woken by all this nice birdsound. Then we spotted that it was from three tiny birdcages in the courtyard below and it seemed so cruel. Why can’t they use little speakers tuned to a radio channel that broadcasts live birdsound?

Got to go now. We’ve not had an off-day where I can devote 10 straight hours to coding the datalogger analysis or write any of it up. I have two interesting results to report. One being the delay on the GPS, and the second being the clean mathematical relationship between the turning circle and bank angle as measure.

Wednesday, March 23rd, 2016 at 6:16 pm - - Flightlogger

Final late blog of the day.

An end-to-end design in Kicad all by myself, which was then cut out beautifully on the triangle machine tool.



Soldering, laser cutting and 3D printing took up the following week, and it should now small enough to fit onto the glider without getting in the way.

(Tom’s trick of defining a virtual second side of the board which we don’t actually cut, but instead implement with jumper wires worked a treat.)


We’ve got the questionable barometer, GPS, humidity, 2 temperature sensors, wind meter and an absolute orientation sensor (at the top) all logging at high frequency to an SD card and with an OLED screen to show me what’s not working so I can fix it in time. The black slab at the bottom holds 4 AA cells.

First thing that got logged was my fridge over last night using a string of 5 temperature sensors left over from Housahedron days:


It’s the most boring high efficiency fridge in the world with a cooling cycle of four hours and, not surprisingly, different temperatures on each of the glass shelves.

I’m wondering if the new microbit device, of which a million will be distributed to children, has enough tech in it to use as a fridge logger. Everyone has a fridge. This would make an easy project for kids to log and upload the data of their make and model to a common place in order to find where the crappy fridges are. In the future they need to all be found and replaced, because they cost significant energy and CO2, but nobody knows since the electricity bills are aggregated for all appliances in one house and are mostly unknown.

For contrast, here’s an overnight log (interrupted at 4am in the morning for my host to get up and drive to London) of a fridge in Leeds using a different datalogger where the cycle is four times an hour:
I can’t explain the long hiccup at 3am where it skipped 3 cycles. Maybe there is a lot of information in that particular curve, such that the real way to find out about the quality of the fridge is to turn it completely off and measure how warm it gets overnight. Great idea. I can see a lot of kids getting into trouble over that one when the food is all spoiled. To which they can respond: “Hey look, it’s only the fridge. It’s not like I’ve done it to the whole planet.”

Wednesday, March 23rd, 2016 at 5:03 pm - - Machining

Continuing our coverage of Autodesk corporate chaos, we read this from the latest Autodesk Earnings Call:

Carl Bass (CEO): Yeah. I just wanted to say one thing…

The first thing is that I think a number of the 13D filers as well as some of the activist investors have raised legitimate concerns…. I think too much credit is being given to them and not enough credit is being given to our long-term investors, who have asked for a change in a constructive way…

Many of my problems with sort of some of the more activist investors is that their focus is extremely short-term and somewhat simplistic. They just ignore some of the complexities of running a business…

[M]y concern is people who like essentially want to turn Autodesk into Men’s Wearhouse. If you look, I don’t think any of the people who got involved in Men’s Wearhouse intentionally meant to do damage to the company. I don’t think they meant to screw it up, but I think they had some simplistic views and what troubles me is seeing those same views expressed about our business.

Actually I got one little funny story here. I looked at Men’s Wearhouse the other day and they changed the name of the company and the symbol and what I thought was interesting is changing the name makes it actually hard to track the price and how poorly it’s performed. But the symbol is a little bit of a telltale sign because if you just look at it, it’s spelled TURD, it’s actually TLRD, but it’s what it looks like, and it’s probably more like it.

Basically, the investors had declared a truce with the management which involves inserting three of their guys into the chain of corporate command, such as it is.

This is probably the first time in 30-odd years that these folks have had people not of their own choosing within the system. And chances are they’ll find the processes ludicrously informal and ineffective, as they appeared to me lower down.

Wednesday, March 23rd, 2016 at 1:28 pm - - Machining

I haven’t got much time for this blogging lark today.

Before this gets too stale, here are some quick notes on the polar drawing robots that we had running from steppers and servos motors using Machinekit and drivers scavenged from the CNC milling machine.

This got shown at Phrased&Confused acoustic festival, where one of them had to perform on stage and almost peeled the corner off the paper it was drawing on.


This was the state of the robot a couple of days before:

And this was at around 5am the night before:

The project management was on github under

Problems remained with the Z-axis communication and its operation on the gondola, as well as inadequate pen pressure on a vertical surface from an object hanging down next to the vertical surface. But we did learn a lot more about the CNC servo motor operation, and MachineKit on the BeagleboneGreen performed excellently.

We hope to set it up on the wall some place and continue development.

Monday, March 7th, 2016 at 12:12 pm - - Machining 1 Comment »

The less said and remembered about the fighting I’ve had over the past three weeks attempting to get this working the better.


Basically, the problem was eventually traced down to a faulty solder joint on the ground pin of the six channel open collector chip which created too much of a resistance to drain the 5V signal down to ground for the gecko drive to respond in the rare case where four 1-signals were emitted from the Machinekit controller at the same time. This happened only when two of the axes were moving with the direction pins high and two step signals went to the motors simultaneously. This resulted in travel in the Y-positive direction missing 1% of its pulses so that the cutting toolpath drifted ever so slightly in the Y-negative direction as cutting progressed, but there being no effect when you jogged the table or arm axes individually. Drove me nuts, as you can imagine.

It was a learning experience. If we can nail this bug, we can nail anything (we had to check through so many other problems which weren’t there to find it), but it set us back weeks of worry, pain, late nights and missing weekends

Quick edited movie with limited footage as I forgot to film a lot of the exciting bits (like the helix ramping) as was a bit too scared to think of it.

Wednesday, February 17th, 2016 at 3:02 pm - - Machining 1 Comment »

I bricked a BeagleBone Black on Monday by plugging a 5Vs into a 3.3V pin while attempting to get it to run a stepper motor (using the exact same installed software that we have for the milling machine tool).

Oh well. I shall have to financially reward the BeagleBone corporation for their easily broken products by getting a replacement. Time to try out one of these cheaper BeagleNone Greens if I’m going to make a habit out of this.

Here’s what my order from looked like:
Note: I ordered 2 boards so as to qualify for free shipping.

And here’s the report from Fedex of the route:

The seamless efficiency is a little bit scary. I drank a whole cup of coffee staring at it. Then I went downstairs and picked it up from the front desk.