Pester goes – but that isn’t the biggest surprise of the TSB debacle

Paul Pester, CEO of TSB, has finally left the business after the bank’s customers suffered another long weekend of failing processes and systems. That he resigned today “with immediate effect” isn’t the most surprising aspect of the story, even after he grimly clung on for months after the initial failures in April.

BBC report that TSB has lost just 6,000 net customers as a result of April's process and systems failures

From the BBC report on Paul Pester’s resignation

The BBC report that 26,000 TSB customers (out of 4.5 million claimed on their LinkedIn page) closed their accounts as a result of the TSB’s botched project to change their banking systems.

I find it astonishing that nearly 199 in 200 customers chose to stay with the bank. It’s even more astonishing that 20,000 people have actively decided to become customers since April, making a net loss of just 6,000. At this rate TSB will have more customers by the end of 2018 than they had at the beginning.

On this basis, having a high-profile business failure looks like a recipe for success. British financial consumers, no matter how badly they’ve been treated, seem unlikely to change their allegiance. As it happens, it’s also the trait that the government are banking on to push through Brexit.

What to do if you get a scam internet service provider call

Over the last few days I’ve received a number of calls from scammers posing as my internet service provider (ISP). Which? has also noted an uptick in activity from these parasites.

If you do answer a call from them, the best advice is to hang up and block the number they called from. Whatever you do don’t be fooled into providing them with your account details or installing and running any software on your computer. The one call I did answer rather than letting go through to voicemail was amateur in the extreme, but may have easily fooled a vulnerable person.

Scam phone calls are on the riseNumbers that I’ve caught and blocked in the last three days include:

  • 0151 327 3276 and 0151 329 0986

This appears to be an Indian outfit routing calls via a Liverpool number. Their gambit was to suggest that Nigerian scammers had compromised my router. Because my router has no keyboard(!), they needed remote access to my computer to change its address.

Even if the claim was credible, changing the (external) address on a router is usually as simple as restarting it. This is because UK retail ISPs dynamically allocate your address and in some cases, the same one is shared by multiple consumers. I managed to waste 10 minutes of their time by feigning incompetence. They eventually got bored with me and hung up.

  • 020 9637 1427

This is an automated message, claiming that your router has been compromised and threatening disconnection within 12 hours if you don’t press 1 to speak to a technician. Don’t press 1 – hang up!

  • +33 883 571 187, +33 983 215 066, +33 998 826 457, +33 239 932 929, +33 537 542 458, +33 307 433 634, +33 248 324 733 and +33 913 120 655

All of these (French) numbers rang within a few hours of each other. The chances are the number is being spoofed and all the calls originate in the same scammers operation.

  • Your ISP will never call you from an “unknown” number.
  • Your ISP will never call and randomly ask for your personal information, such as your account number, bank details, date of birth etc.
  • If you’re unsure if a call is genuine, hang up and contact your ISP on their official number.
  • If you’ve been scammed or an attempt has been made, contact Action Fraud online or on 0300 123 2040.

Raspberry Pi weather forecaster

In my ongoing struggle to overcome chemo-brain, I’ve recently created a rudimentary (*) weather forecaster. It’s based on a Raspberry Pi Zero W that came as part of a gift subscription to the MagPi. It incorporates a BME280 sensor (for reporting pressure, temperature and humidity) and a LCD display.

The current prototype

Not pretty, but functional. It requires just 3 hours of historical data before it makes a forecast! Somehow I don’t think anyone will claim that professional weather forecasters are no longer needed … unless you’re someone who still believes in unicorns. (+)

Prototype Raspberry Pi weather forecaster

Prototype Raspberry Pi weather forecaster. The Pi is hidden under the multiplexing board.

The technical stuff

The LCD display and BME280 sensor are both connected to the Pi using the I2C bus exposed by GPIO (physical) pins 3 (data) and 5 (clock). Power to the LCD is provided through a 5v pin (2 or 4) and to the BME280 through a 3.3v pin (1 or 17). The final wire to each component is the ground. Any of GPIO pins 6, 9, 14, 20, 25, 30, 34 or 39 will do.

The coding tasks (in C and FORTRAN) were greatly simplified by the use of the excellent wiringPi library.

Release 1.0 of the code is available on github should anyone want to enjoy a good laugh at my legacy coding skills.


BME280 – £5.45 (I bought two for £10.90, just in case my soldering skills let me down).

LCD display – £7.99

Raspberry Pi Zero W – free as part of the current MagPi subscription offer, or around £10-£15 if you need to buy one and a 40 pin GPIO header.

Next steps

Finding a suitably sized waterproof project box with a transparent lid to house the electronics (sadly far harder than it used to be with the demise of Maplins earlier on this year).

Tidying up the wiring by using a piece of Veroboard (other brands are available) so I don’t need to use my only multiplexing board (by far the most expensive component in the current build).

Creating a better forecasting model. In FORTRAN, naturally. I acknowledge that it could take me some time to become as good as the Met Office …



(*) “Rudimentary” makes it sound better than it is. Here’s the current forecasting model it uses for those who don’t want to wade through all the code on github.

C                                                                      C
C                                                                      C
C     CIND  - CHANGE INDICATOR STRING                                  C
C     CFORE - FORECAST STRING                                          C
C                                                                      C
C     AUTHOR: TJH 26-07-2018                                           C
C                                                                      C
      IF (PDIFF.LE.-0.5 .AND. PDIFF.GE.-3.0) THEN
         CIND="v "
         CFORE=" Some rain possible "
      ELSE IF (PDIFF.LT.-3.0 .AND. PDIFF.GE.-6.0) THEN
         CFORE="Wind,rain;fine later"
      ELSE IF (PDIFF.LT.-6.0) THEN
         CFORE="    ** STORMY **    "
         CIND="^ "
         CFORE="Fine, becoming drier"
         CFORE="Becoming dry & windy"
         CFORE="No change in weather"
      END IF


(+) For example, someone who still believes that Brexit is a really good idea. So maybe I should approach the disgraced former defence secretary, Liam Fox, to promote it for me.

B&Q ( = Do It Yourself integration

Earlier on this week I ordered some new fence panels for delivery from (B&Q). This was the message I received during checkout:

DIY "digital" at B&Q

DIY “digital” at B&Q

A DIY (not very) digital experience. The part of their instructions about the letter was wrong, fortunately. I received an email from their supplier some hours later to organise delivery. This (naturally, given the paucity of the shopping experience so far) involved re-typing a B&Q order number into their website, even though they could have provided me with a unique URL to follow in their email.

If only there was a company that provides market-leading business to business integration software

Whetstone FORTRAN benchmark: Raspberry Pi 3B+

Following the launch on 14th March, a shiny new Raspberry Pi 3B+ landed on my doormat yesterday. I purchased it from The Pi Hut for the princely sum of £32 + £2.50pp. I was delighted that it arrived the day after I ordered it, despite not having paid extra to guarantee delivery.

Naturally(+) the first thing I did after setting it up (and deciding on the somewhat unoriginal hostname of ‘custard’) was to install a copy of gfortran to compile and run the Whetstone double precision FORTRAN benchmark(*).

When I was a young programmer in the 1980s, the Whetstone benchmarks were acknowledged as being the standard for assessing general computing performance. I believe that they first appeared in the early 1970s, written in ALGOL. This was way before multi-core processors became the norm, so the benchmark doesn’t give a true reflection of the total computing power available on the Pi 3B+. It’s easy enough to multiply by four to get an estimate, of course, so I’m sticking with it!

Running on a single core, the Pi 3B+ performs the benchmark approximately 33% faster than the Pi 3B (an average over 10 runs of 530,348 KIPS vs 399,858 KIPS). Compared with the original (single core) Raspberry Pi (150,962 KIPS), the improvement in speed is around 3.5x (i.e. 14x, if it had been possible for this benchmark to use all four cores on the Pi 3B+).

Custard running the Whetstone double precision FORTRAN benchmark

Whetstone double precision benchmarks - Raspberry Pi 3B+ and predecessors

Comparing Raspberry Pi models using the Whetstone double precision benchmark (single core performance)



(+) Naturally for me, that is.

(*) My previous posts about this benchmark and the results on earlier Raspberry Pi models are here:

Raspberry Pi 3, Raspberry Pi 2, Raspberry Pi Zero and the original Raspberry Pi.

Before the EU single market and the disaster of a hard Brexit

Yesterday an opinion poll suggested that a majority of voters want the UK to remain in the single market. It’s encouraging that the majority take this view, as I’m old enough to remember the difficulties of trading without it.

In the 1980s, before the EU single market, I worked for a UK software company based in Nottingham. One of our partners was the French computer manufacturer,  Bull. We had an agreement with Bull to support our software on their hardware – the SPS9 and SPS7. In a world before high-speed networks, this meant physically having the machines on loan in our offices. A heavily bureaucratic process known as a carnet was required. This meant the machines had to be shipped back to France every year (“for a holiday”, as my director put it) and updated models returned. We were unable to carry out work for our Bull customers while the lengthy process of satisfying customs regulations took place.

One year, the machines were shipped back from France and held at the Port of Dover for inspection. At best, this process took a couple of days, but on this occasion the days turned into a week, and then almost two. Eventually, our shipping agent suggested that I give the customs people a call, as he was making no progress. After getting through to the right office I was met first with hostility, but after turning on the East Midland’s charm, he agreed to look into the problem for me.

The problem was simple – the carnet was in French, and the person in the customs office dealing with my shipment who spoke French was on holiday. They were due back in a couple of days. I sighed, as arguing with customs is a pointless exercise. Two days later after his colleague had returned, the computers were released and returned to Nottingham. However, this delay eventually contributed to the loss of a large contract.

Any Brexit agreement that fails to keep the UK in the single market will lead to a drag on the economy. And let’s not fool ourselves – the type of no agreement, hard Brexit promoted by the extremists in the Conservative and Labour parties will be even more disastrous.The consequences of a hard Brexit will be dire – especially for funding the public services we all rely on like the NHS.

There’s a great opportunity on June 8th to stop this economic vandalism happening. We need to make sure that there are strong voices in the next parliament that will fight for our place in the single market.

The best way to ensure that this happens is to vote for Liberal Democrats.

Raspberry Pi – camera box

This weekend, I was finally happy that I’d managed to implement a reasonable temperature and humidity project as well as a motion detecting camera for my Raspberry Pi. I decided to invest £19 in a ModMyPi camera box to consolidate them onto my Pi 3. It arrived today, and after an evening’s fun this is the result.

Pi Camera BoxLid open for testing. The DHT22 temperature and humidity sensor is at the front, with the motion sensor and camera mounted in the lid.

Pi Camera Box - installed in the garageIn situ.

I think it looks much better than my original attempt, even if the rather fiddly assembly took a couple of hours (with testing) rather than the 10 minutes claimed by the manufacturer! It also means that as my camera is now mounted the correct way up, I no longer need to rotate the image by 180 degrees in my code …

Update: After I’d installed this in the garage, I started to get a large number of false positives. A change back to my Pi2 made little difference (although the original version I’d put together but without the DHT22 had worked well). Finally, soldering a 10k resistor between the data and ground wires of the PIR detector seems to have resolved the issue of the data pin going high without it sensing movement.

Humidity and temperature monitoring with a Raspberry Pi

Continuing my quest to protect my Caterham 7 using my Raspberry Pi, I bought a bargain box of 37 assorted sensors for £21. One of the devices supplied was a DHT11, capable of monitoring temperature and humidity. A quick internet search led me to discover the very useful pigpio libraries and daemon. Wiring up the DHT11 to the Pi’s GPIO pins was simple – 3 wires, 1 to the 3V3 supply, 1 to a ground pin and the data pin of the device to GPIO pin 17. The author of the pigpio library also provides some example code for the sensor.

This was enough to demonstrate that I could get it to work, but the accuracy of the DHT11 was woeful. It’s advertised as having an accuracy of +/- 2 Celsius, but my experiments suggested that the one I had acquired for the princely sum of 57p had an accuracy of around +/- 5 Celsius. As I also wanted the sensor to work in an unheated garage, another limitation was that the DHT11 is unable to read values below freezing.

Encouraged, I decided to invest a further £6 in a plug compatible DHT22 sensor. This has an operating range of -40 Celsius to 125 Celsius, with an accuracy of +/- 0.5 degrees. Initial tests suggested that it was far more accurate than the DHT11. While the sensor produces a slightly different data stream to the DHT11, it was close enough for the example code to have been written in a way that it would still work.

As part of my experiments, I made a small modification to the example code (testDHT.c) to calculate the dew point from the temperature and relative humidity readings. I’ve also changed the way it outputs data, to write it to a file rather than the screen.

void cbf(DHTXXD_data_t r)
   FILE* fp;
   char buff[100];
   time_t now;
   float rdwpt,rtemp,rhum;
   extern float rdewpt_();
   if (r.status == 0) {
       now = time (0);
       strftime (buff, 100, "%Y%m%d-%H%M", localtime (&now));
       fp=fopen("readings.txt", "a");
       fprintf(fp,"%s ",buff);
       fprintf(fp,"%.1f ", rtemp);
       fprintf(fp,"%.1f ", rhum);
       fprintf(fp,"%.1f", rdwpt);

While it would have been simple enough to write a dew point calculation in C, I decided to write it in FORTRAN instead. Hey, the more people who get to love FORTRAN the better. Here’s the function I wrote, which uses the Magnus formula. It’s declared in the C fragment above as an external function that returns a float. Parameters are passed to FORTRAN by address, rather than by value.

C                               RELATIVE HUMIDITY - RHUM
C     AUTHOR: TJH 28-01-2017
      REAL RH
      RH = (LOG10(RHUM)-2)/0.4343+(17.62*RTEMP)/(243.12+RTEMP)
      RDEWPT = 243.12*RH/(17.62-RH)

Compiling and linking the C and FORTRAN code using gfortran:

gfortran -Wall -pthread -o DHTXXD *.c *.f -lpigpiod_if2

produces an executable that can create a data file. This example was created using the command:

./DHTXXD -g17 -i600

which reads the data from GPIO pin 17 every 10 minutes.

20170128-2009 6.9 72.0 2.2
20170128-2019 6.9 71.7 2.1
20170128-2029 6.8 71.3 2.0
20170128-2039 6.8 71.4 2.0
20170128-2049 6.8 71.7 2.0
20170128-2059 6.8 71.4 2.0
20170128-2109 6.7 71.1 1.8

This provides data in a suitable format to use some relative simple gnuplot commands to create a charts. The first example plots the relative humidity readings over time, with the larger spikes in the relative humidity data correlating to the garage door being opened while it was raining.

set xdata time
set xlabel "Time"
set ylabel "Relative Humidity %"
set timefmt '%Y%m%d-%H%M'
set format x '%H%M'
plot 'readings.txt' using 1:3 title 'Relative Humidity' with linespoints

HumidityThe second example graphs the air temperature reading directly from the DHT22 with the dew point temperature calculated from the Magnus formula.

set xdata time
set xlabel "Time"
set ylabel "Temperature in degrees Celsius"
set timefmt '%Y%m%d-%H%M'
set format x '%H%M'
plot 'readings.txt' using 1:2 title 'Air Temperature' with linespoints, \
     'readings.txt' using 1:4 title 'Dew Point' with linespoints

Air temperature and dew pointI’m going to be keeping an eye on the data, to understand if it might be beneficial to seal the garage door more effectively than at present and invest in a dehumidifier.

Raspberry Pi motion sensitive camera

Other than messing around with a few FORTRAN benchmarks and learning how to code using Python, I haven’t really used my Raspberry Pi computers for very much that’s been practical. However, having bought a Raspberry Pi camera to play with over Christmas, I decided to have a go at building a motion sensitive camera for the garage. It’s cheap and easy to find passive infrared detectors these days, so I acquired three for the princely sum of £5.

The passive infrared detector
PIR detector

The first challenge was working out the function of the three pins in the foreground. A little bit of searching led me to the conclusion that the top pin is the ground, the bottom pin the 5v supply, with the middle being the status pin. If the middle pin goes high, it means that motion has been detected. The sensitivity of the device, and the length of time the status pin stays high for, can be adjusted using the two potentiometers.

I connected the power pins to a couple of the available 5v supply and ground pins on a Raspberry Pi 2. I used physical pin 26 (GPIO pin 7) to connect up to the status pin.

The code

The next challenge was writing some code to detect changes in the status pin and take a photograph when motion is detected. Fortunately, there are plenty of code snippets available that made this task relatively straightforward. The current version of my code is below.

import RPi.GPIO as GPIO
import time
from picamera import PiCamera
# Initialise the camera settings
# Use GPIO pin 7 (physical pin 26) for the PIR detector
# Variables used to determine when a picture should be taken.
# GPIO pin 7 => high (ts==1) from low (qs==0) 
# triggers the camera.
  # Wait until PIR GPIO pin is low (0)  
  print "Waiting ..."
  while GPIO.input(GPIO_PIR)==1:
  print "... detector is ready"     
  # Loop until quit signal
  while 1:
    # Read PIR state
    # DEBUG print ts
    if ts==1 and qs==0:
      # Create unique filename with timestamp and set qs high
      filename=("img" + timestamp + ".jpg")
      print "Movement detected - ",filename," created"
    elif ts==0 and qs==1:
      # GPIO pin 7 has returned to low, therefore set qs low
    # Wait for a second
except KeyboardInterrupt:
  # Cleanup GPIO
  print "PIR-PiCamera program terminated"
The results

My Raspberry Pi 2 is now set up in the garage with the motion detector and camera. At the moment it’s simply saving the images onto a drive available to my home network, but I’m probably going to experiment with sending email alerts as well.

Raspberry Pi motion sensitive cameraI’m pleased to report my motion sensitive camera has already caught an intruder …

C7 thief!

1 2 3 9