Monthly Archives: September, 2016

Car Talk

The Amazon Echo arrived in the UK a couple of days ago, and by combining some of my earlier work with John Wheeler’s excellent Flask-Ask framework I was able to make it talk to my electric car.

Also available on Vimeo here if preferred.

Counting the cars on the new electric turnpike

IMG_2598In the last couple of months there’s been a lot of discussion amongst electric vehicle owners in the UK about Ecotricity’s decision to start charging for its ‘Electric Highway’: the network of rapid charging points at motorway service stations and similar locations. Some think it’s outrageous that, if you’re charging away from home, it can cost as much per mile as petrol. Others point out that these charging points cost many tens of thousands to install and run, and the cost is therefore very modest. Personally, I think they have the pricing about right, but I wish they’d chosen a 15-minute granularity instead of going for 30-minute slots. But no doubt this will be tweaked over time.

One benefit of these chargers no longer being free is that there are fewer ‘casual’ users, or people hogging them for extended periods of time. If you turn up at a charging point now you’re very likely to find that it’s available, something that is, in fact, exceedingly important. (The ideal charging network is one that nobody else seems to use except you! It’s quite a contrast to petrol pumps, where the owners want them to be in use almost constantly.) However, this change is so apparent that some have speculated that almost nobody is using the pumps, and the whole idea is a disaster. The real numbers were, however, pure speculation for anybody outside Ecotricity.

Well, with some devilishly cunning technical tricks, I came up with a way to monitor a few charging points and see how they’re actually being used. I tried to pick a mix of some popular pumps, some I was just personally interested in, and some in more out-of-the-way places, so I settled on the charging points at:

  • Cambridge Services (A14)
  • Baldock Services (A1M)
  • Heston (M4 near Heathrow)
  • IKEA Wembley
  • South Mimms (A1M/M25)
  • Leicester Forest East (M1)
  • Kettering (A14/A43)

And I checked them every 5 minutes for 4 days – a Fri, Sat, Sun and Mon – to see whether they reported their status as ‘Available’ or ‘In Use’.

Kettering, sadly, appears to have been out of action for all this time, as does one of the pumps at Baldock. And one of the Leicester Forest pumps was reporting ‘Swipe card only’. So for this (small and completely unscientific) trial, I effectively had 6 locations and a total of 12 charging stations. And here’s what I found:


Click for a higher-resolution image, or download the PDF here

Each dotted horizontal line represents a normally ‘Available’ pump and the vertical marks indicate when it is ‘In use’. The five minute period of my checks mean that a standard half-hour charge is shown by roughly six little vertical lines.

A few points to note:

  • Some of the sessions are less than half an hour, and some appear to be noticeably longer, though my system wouldn’t detect one car finishing and another immediately taking its place as two separate events.
  • Drivers who get their home electricity supply from Ecotricity do not pay for charging, so they have no particular incentive to work in half-hour units. The majority of sessions, however, are multiples of half an hour.

Here are some numbers derived from the data:

Approx pump statistics

ID Location Samples in use/total Avail% 24hr Avail% >7am 30min sess/day 30min sess.p.a.
1037 Leicester Forest East Services 102/2292 95% 93% 2.1 780
1038 Leicester Forest East Services CCS 94/2286 95% 94% 2.0 720
1068 South Mimms Services 0/2294 100% 100% 0.0 0
1069 South Mimms Services CCS 141/2291 93% 91% 3.0 1078
1080 IKEA Wembley 462/2263 79% 73% 9.8 3577
1081 IKEA Wembley CCS 219/2291 90% 86% 4.6 1675
1132 Heston Services 292/2291 87% 85% 6.1 2233
1133 Heston Services CCS 54/2294 97% 97% 1.1 412
1134 Heston Services CCS 30/2294 98% 98% 0.6 229
1235 Baldock Services 253/2294 88% 85% 5.3 1932
1236 Baldock Services CCS 0/0312 100% 100% 0.0 0
1241 Cambridge Services 0/2294 100% 100% 0.0 0
1242 Cambridge Services CCS 246/3433 92% 89% 3.4 1255

Assume electricity cost per session of £1.44
Annual profit from these pumps approx £63348
From a network of 300 pumps, if these are representative: £1461881

With the exception of the Wembley IKEA points, you can turn up between 7am and midnight and have at least an 85% chance of finding one of these free.

Now, these pumps may not be representative, being generally rather London-focussed, especially since a couple of my more rural ones didn’t yield useful data. I’ve included one which was offline and excluded a couple of others. And all of my figures are very approximate, so should all be taken with a big pinch of salt. But my estimate is that Ecotricity are making £1-2M per year from the network at this rate.

In their announcement about the introduction of the charges they talked about having provided £2.5 million pounds worth of free travel in the first five years of the network. It grew from nothing to its present size over that period, so we might assume that the annual costs of about £0.5M represent the half-way stage and that they were getting close to £1M p.a. at the end of the free period. I don’t believe these numbers include the substantial installation costs of the pumps, which are apparently around £30-50K each. Nor, I think, do they include the salaries of support staff, etc.

But overall, my analysis, for what it’s worth, would suggest that the current charges are not too wide of the mark for what they need to run a sustainable network. It won’t make much profit nor allow much further development, but nor will it run at a huge loss, as it has up to now. Fortunately Ecotricity have a variety of motivations for this work, and not all of them are profit-based.

I could attempt a more substantial analysis, but the APIs I was using are probably not meant to be public and I didn’t want to trespass on their good will. If anybody from Ecotricity would like to authorise me to capture more data (or offer me a job to keep me quiet!) I’d be delighted to talk!

The network will need further investment, since the number of electric vehicles on the road is growing fast. This is offset somewhat by the fact that their electric range is also increasing, so charging points are needed less frequently. But analysts are predicting surprisingly short timescales for us to reach the point where the majority of our cars are electric, so it’s a fascinating space to watch…

The ‘Hyper’ key and Mac OS Sierra

Like many Mac geeks, I’m a fan of the ‘hyper’ key. “What”, you may well ask, “is that? I don’t see one of those on my keyboard.”

Well, you’re familiar with the normal modifier keys – shift, control, alt/option and command – and there are various utilities, both within the operating system and as third-party add-ons, which let you map keystrokes involving these onto particular bits of functionality. So, for example, if you have an application in which a particular menu item has no keyboard shortcut, you can assign one of your own using the Keyboard section of System Preferences.

You can set up more complicated sequences of events using something like the wonderful Keyboard Maestro utility (which, despite its name, can also trigger actions based on all sorts of other events, like starting an app when a particular USB device is plugged in, or mounting a network drive when you join a particular wifi network. However, back to the keyboard…)

If you want a keystroke that will perform a particular action regardless of which app you’re using, though, you may have more of a challenge. Here’s an example: To my surprise, one of the most useful things I’ve found in recent Apple OS updates on the Mac and iOS devices is the previously uninspiring Notes app. It now has enough formatting, searching and organisation to be really useful for odd notes and synchronises beautifully across both my Macs and all my mobile devices. I use it all the time, and I want a keystroke combination that will pop it to the front at any time. It can’t be Cmd-N, because that creates a new file in most apps. Shift-Cmd-N is used, for example, in the Finder to create a new folder. I might get away with Ctrl-N in many of my current apps, but one day soon I’ll install one which uses it and then I’ll be frustrated.

So the idea of the ‘hyper’ key is that you pick a combination of modifiers that nobody in their right mind would ever use for anything else: typically Shift-Ctrl-Alt-Cmd. And then you remap some otherwise-unused key on your keyboard to produce Shift-Ctrl-Alt-Cmd, and that becomes your ‘hyper’ key. Hyper-N fires up Notes, Hyper-C brings up your diary, Hyper-T your todo list, and so on, and they work in any application because no sane application is going to have defined Shift-Ctrl-Alt-Cmd-T as a shortcut.

In the past, the best way to do with was with a little utility called Karabiner. It had an option to use the ‘Fn’ key for this, without interfering with its normal operation when pressed with, say, the volume keys. I’ve used it for years. But at present Karabiner doesn’t work with the new Mac Os Sierra, and I find I’m missing my Hyper key terribly. There’s a lightweight utility called Karabiner Elements being developed, but it’ll currently only map one single key to another, and won’t do the more complex stuff I need for this.

So I was pleased to come across this article by someone calling themselves ‘LunarRed’ which suggests a solution: you use Karabiner Elements to map the CapsLock key to F18, and then Keyboard Maestro to map F18 plus another key to the actions you wish to invoke.

It works nicely, and with a small reprogramming of my fingers, I can pop up Notes with CapsLock-N, my To-do list with CapsLock-T, and so forth. Happy again…

Update 5 Dec 2016 – Karabiner Elements is starting to get proper ‘Hyper’ functionality built in now. At the time of writing it’s not in the official build, but I’m using a version from this thread and it works fine. I’m changing one thing, though: in the past I always used the Fn key for my hyper key, but you need an app that understands that, despite this, you probably want Fn to do its normal thing if you use it with the function keys. Karabiner did that, the new Karabiner Elements doesn’t (yet). So I’m going to switch all my machines to use Caps Lock as the Hyper key, since that has few complications, and my fingers will gradually learn the new location!

Take a Pew

Alan Bennett’s wonderful sketch ‘Take a Pew’ may resonate with fewer and fewer people as time goes on, but for those of us brought up on the sermons of the Anglican church, it’s still hilarious.

There are many different recordings of it out there, but none of them, I think, is quite as polished as the one I remember on an old comedy compilation album from the 80s. After extensive searching, it appears that this never made it online, and in fact, never made it beyond LPs and cassettes. I would have been happy to purchase a copy, but was unable to do so.

So, after finding a second-hand copy of the cassette from an online retailer, digging my old cassette desk out of the loft and giving it a good vacuum, and connecting it through a USB audio interface to my Macbook, I offer it here for your enjoyment.


Crossing the line

A witty road-safety campaign in this part of the country has been putting up signs:


Unless you’re already exceeding them, that is. In which case, presumably, they should be…

This royal throne of kings

Last week I visited Caernarfon for the first time, which has a splendid castle where Edward II, amongst other people, was born.

Here’s how I’m descended from Edward II:


“Wow!”, I can hear you say. “Quentin is royalty? I didn’t know that! But it explains an awful lot.” Actually, I should probably focus on Edward III, who sounds like a much more decent chap to have as an ancestor, but I just happened to be in Caernarfon, not Windsor.

Sadly, however, neither relationship is nearly as exciting as you might think.

Firstly, several links are in the female line, and so don’t really count, of course.

And secondly, if you’re of roughly British descent, you’re probably descended from him too.

Let’s think about the maths. As a gross over-simplification, let’s assume that none of your ancestors are related to each other in any way. So you had two parents, each of them had two parents, and so forth. The number of people who are your ancestors doubles at each generation.

Pick your favourite king from a few centuries back – let’s say Henry V, who lived around 24 generations ago. Using the above model, going back 24 generations would take you to the roughly 16 million people from whom you would be descended. If you weren’t related to somebody back then, they’d need to be outside the 16 million. And the population of the UK back then (not that it was the UK then, of course) was around 3 million.

Now, since people do marry distant relatives, the number is much smaller than 16 million in reality – it must be, because there were only 3 million of ’em, and they didn’t all have children, and relatively few people arrived or departed from this sceptred isle – but if we go back a few more generations to Edward II, the ratio is much greater too, so you can be fairly certain that almost everybody alive here now is related to him. And also to every peasant in his fields. At least, those peasants who do actually have surviving descendants.

I discovered the details for my own particular ancestry because a cousin and I had put some of the family tree into one of the genealogy sites, and a couple of weeks ago I got an email from them saying “Julius Caesar is your 64th great-grandfather!” And so he is, sort of, despite the fact that he didn’t have any children! (He adopted some.) Here are the details if you’re curious.

But when you go back that far, it’s really, really hard not to be related to somebody if they’re in roughly the same continent! So, this is all quite fun, but I won’t be massing my armies and crossing the Rubicon just yet.

I think, though, with the element of surprise on our side, Tilly and I could re-take Caernarfon…




Cregennen Lakes, Wales

Always look on the dark side of life

I love these nihilistic security questions from Soheil Rezayazdi…


Thanks to Rory C-J for the link.

Damp delights

A snowdonia waterfall

North Wales is very moist. But very pretty.

Last orders

Beddgelert, Snowdonia

Beddgelert, Snowdonia

Shifting gear

Family tech support over the phone is a wonderful thing, especially with screen-sharing, but it can still be slow progress to achieve some simple tasks…

Me: “You can select several things at once: click the first one, then shift-click the last one”

Relative: “Shift-click?”

“Yes, hold down the shift key while clicking”

“I’m sorry — I don’t know where the shift key is…”

“The one with the up arrow that you use for making capitals.”

Long pause.

“No, it doesn’t seem to do anything different”.

“Oh. Perhaps it doesn’t work in this mode. Let me try here. Mmm. It works fine for me. Tell me exactly what you’re doing…”

Long discussion during which we discover that beloved relative is actually using the (generally less useful) capslock-click manoeuvre. We try again.

“Are they all selected now?”

“They’re all blue”

“Good, that means they’re selected. Now… Mmm. What were we doing?…”

Tilting at windmills

I love this understated phrase from the ‘Information for visiting pilots’ on the website of Caernarfon Airport:

Runway 02/20 at Caernarfon is now permanently unlicensed due to the installation of two 152’ amsl wind turbines approximately half way down the runway.

Conjures up some wonderful mental images.

“Go on Bob, time it just right… Oh, and roll as you go through…”

© Copyright Quentin Stafford-Fraser