Featured post

Staying cool in a heatwave

I’ve been reading lots over the last little while, on how to stay cool in the current heatwave. This is all the recommendations I have. I’ll follow this up with explanations of each suggestion in another post later — writing this has taken a lot out of me! Links are for example, buy what’s available and fits your needs 🙂

The UK is not set up for heat waves of up to 40c, thousands of people will die, we may have power and water outages.

Things to do immediately

Things to do the day before the heatwave

  • Turn your fridge and freezer up — make them colder
  • Freeze bottles of water (Separately from the immediate water stock!). Old fizzy drink bottles are fine. Squeeze them a little before putting the lid on, to give the water space to expand into
    • For one of the bottles, fill it halfway up, and store in the freezer so you can get to it. When you want a cold drink, just fill it a bit, and shake. Instant cold water!
  • If you have south-facing windows, prepare to cover them. A sheet, tin foil, paper.
  • Prepare foods ready to eat cold. Tuna mayo, egg mayo for sandwiches, salads, cold meats, cook some beans ready. Consider cooking a pasta bake or similar and putting it entirely into the fridge
  • At night, open your windows:
    • If you have a multiple level house, open windows/doors on one side of your house on the bottom floor, and on the top open the windows on the other side — so air will flow in a diagonal
    • If you’re in a flat or bungalow, open the windows/doors on opposite side of the house
  • Try to stay at home, or indoors. If your office has air con, I’m jealous. Avoid heavy activity during the day
  • Cover any south facing window with tin foil / paper / baking paper / cardboard / sheets. Do this on the outside if at all possible. If you do it on the inside, you might overheat your windows, and break them. Expensive bills later!

During the heatwave

peeling warning sign


Do not do any of these things. They will harm you!

  • Drink Alcohol
  • Drink too much coffee (A little to prevent withdrawal is a good idea, but give energy drinks a miss)
  • Use “Air Conditioners” that don’t have an extract hose, that you have to fill with water. They use up the indoor air ability to absorb water — and sweating is the main way you lose heat when it’s too hot, so they make you hotter and make fans work less effectively. It’s safe to use them with a window open
  • Use air conditioners with an extract hose out a window without sealing your window with these kits. Yes they’re ugly, but without them you’re literally pulling hot air in from outside!
  • Heavy exercise — including manual work — especially during the peak in the afternoon, 1200 – 2000 (12pm to 8pm)
  • Avoid cooking using the oven, or hobs whilst windows are closed. If you have to, use the microwave
  • Avoid travelling if possible. Trains will be very slow, aircon may fail. Roads may melt
Green node of traffic light


  • An hour after sunrise, or as close as possible, close your windows
    • During the heatwave, check the temperature sensor against the weather app, or your weather station. When the indoor temperature is close to the outdoor temperature, go outside a second to see if it feels cooler outside (in the shade!) than inside. If so, open the windows as recommended above — in a diagonal, or opposite side of your dwelling
  • Drink lots of water. One or two electrolyte drinks a day in the absolute peak temperature
  • If indoor temp is below outdoor temp, keep the windows closed. Make sure to open them when it’s warmer
  • Consider pointing a fan out the window once it’s time to open the windows. Use a tissue or light cloth to work out which way the natural wind is blowing air, and point the fan in the direction to work with the wind, not against it
  • Wear light, airy clothes. If you can, stick to 100% cotton, which will wick your sweat and help it evaporate, keeping you cooler
  • Wear a hat if you go outside, and remember your sunscreen — even if it’s cloudy
  • If you have cats, put out a few bowls of water, spread around the building for them to drink from
  • If you have plants, water them before the temperature peak
  • Shower with a lukewarm shower. You want the water just a little cool to the touch. Too cold, and you’ll confuse your body, too hot, and you’ll just make it worse
  • Freeze a hot water bottle. Wrap it in a towel to cool down
  • Wrap an ice pack in a towel, and hold it between your upper thighs. You have arteries there, so will cool your entire body rapidly
  • Damp a towel and put it around your neck
  • Put your feet in a bucket or large bowl of water
  • Don’t use your fans feature to have it change direction it blows air into — oscillation. You want to set up a breeze of air around your room, that’ll effectively multiply how much air is moving without needing too many fans
  • Put a bowl of ice in front of a fan
  • Damp a sheet, or wet duvet cover before sleeping
  • You can set up a fan to blow *into* a duvet cover, effectively inflating it with a constant supply of fresh air. You can use clothes pegs attach it to the fan’s grills

Comment your own tips below!

First Class Trouble: Crash and game logs

You can find Crash Logs from the game First Class Trouble here:

You can get there quickly by opening a file browser (hit START + E at the same time), copy that line, and paste it into the address bar;

Crashes *should* pop up a window asking for permission to send to devs when the game crashes. If it doesn’t, you can always tweet them and see if they want the crash report 🙂

mosquitto connection refused

Hi all, if you’ve just upgraded mosquitto server on some flavour of linux and wondered why all your mosquitto subscribers and publishers on your network have just started failing, you may have fallen foul of this:

the new mosquitto 2.0 requires a ‘listener’ be configured to the ports required, or else it will only listen to the localhost:1883.

So if all your clients start failing after, edit the configuation and add the following line to the top:

“listener 1883”

See the post here for more information: https://mosquitto.org/documentation/migrating-to-2-0/

Anaconda/Spyder Python IDE Not launching [SOLVED]

If you’ve just installed Anaconda / Spyder IDE (available here for personal use) in Windows find it’s not launching, and neither is the Anaconda launcher, and you have a previous installation of Python e.g. Python 2+<3, remove Python 2.X from your Windows PATH variables and retry opening it.

To do this, right click on ‘My Computer’,
select Properties to bring up System Properties and
click ‘Advanced System Settings’.
Agree to the UAC prompt and click ‘Environment Variables’ then look for Python references anywhere, edit and delete as required.

Retry launching Anaconda/Spyder and it will now work.

If this doesn’t work, open a command prompt (Type cmd/enter from the start menu), navigate to the Anaconda installation (in Windows 10, ‘cd c:\programdata\anaconda3\” and try launching anaconda or spyder (.\scripts\spyder.exe) and noting any error messages that appear which can then be googled for the relevant fixes.

Hope this helps!


Local Weather forecasting

Just a quick note to enquicken someone else’s google seaches in the future,

For local weather forecasting based on ambient air pressure, the algorithm you need is the Zambretti algorithm .

The original Hackaday article on this is here:

And some useful matlab code to get you started is here:

Finally, some tags to help google air pressure wheel forecast ambient air pressure bmp280 bmp180 air pressure forecast etc.


In a fit of desperation, I tweeted asking for *simple*, *easy*, cheap recipes. This is what I got in return. I’m totally posting this so it’s really easy to print them.

And season to taste 😉 Salt & pepper of course, but you can add any herbs you like to it as well.
I must admit, I don’t know what Orzo is..

Arduino ethernet hardware watchdog

So I have a few raspberry pis that (3 in fact!), and sometimes have them set up for remote access such as a raspberry pi webcam using the raspberry pi camera, web servers, remote power socket control, weather monitoring, energy usage – the usual geeky stuff.

Various raspberry pi projects of mine!

Anyway, sometimes the thing runs smoothly and reliably for years on end without problems (usually the less you tinker with it!), surviving power cuts and what have you. My first Model B Rev 1 Pi (thanks Dad!) is an example of these. It ran for years monitoring temperature/humidity and air pressure, before finally being shutdown due to a house move (someday i’ll have to resurrect it!).

Sometimes however, things don’t go to plan and Linux will crash or lock up, or the network interface will go down on power cuts. For instance I once wrote a script to restore the wifi connection of a pi in my GF’s locked and empty house using a lovely blackberry smartphone while sitting in a buddy’s car eating kfc chicken outside. But that’s another story! (Thanks Andy!). It usually happens right when you’re away the Pi and trying to login remotely!

I tried using the raspberry pi watchdog timer (see here: Raspberry pi Watchdog timer), but this didn’t seem to fix the problem

So I built an Arduino hardware watchdog that keeps an eye on the ping result of a host on the network, and reboots the device if it fails tor respond. IT has a 16×02 lcd to display current action/state although someday i’d like to have leds for each state instead. with a button to manually reboot.

The project utilized a remote control socket (from Maplin, RIP), an arduino uno with an ethernet shield and a 16×02 lcd shield (with pin 10 bent out to prevent issues between the ethernet shield and the lcd shield backlight) plus a 433mhz tx module and the rcswitch library.

Maplin/Wilko remote sockets, available here 

code below

Ping Example

This example sends an ICMP pings every 500 milliseconds, sends the human-readable
result over the serial port.

Ethernet shield attached to pins 10, 11, 12, 13
433mhz tx module on pin 2
LCD on pins 8, 9, 4, 5, 6, 7

Pin 10 of the LCD bent out of socket to prevent issues caused by the backlight

created 30 Sep 2010
by Blake Foster

Modified by Garreth Tinsley

const int txDataPin = 2;

#include <SPI.h>
#include <Ethernet.h>
#include <ICMPPing.h>
#include <RCSwitch.h> // for 433 tx module/remote switch control
#include <LiquidCrystal.h> // For LCD
long retrytimeout = 15L * 1000L; //recheck every 15 seconds
long cycletimeout = 120000;
long starttime;
long currtime;

bool looptwice = false;

byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED}; // max address for ethernet shield
//byte ip[] = {192,168,2,177}; // ip address for ethernet shield
IPAddress pingAddr(192, 168, 1, 2); // ip address to ping

SOCKET pingSocket = 0;

char buffer [256];
ICMPPing ping(pingSocket, (uint16_t)random(0, 255));
RCSwitch mySwitch = RCSwitch();
LiquidCrystal lcd(8, 9, 4, 5, 6, 7); // initialize the LCD library with the numbers of the interface pins

void setup()
lcd.begin(16, 2);
lcd.setCursor(0, 0);
lcd.print(“Rebooter 0.2”);
//0.1 it works!
//0.2 it works an is neater (lcd printing countdown, ip addr print not . after last octet, padding seconds)
lcd.setCursor(0, 1);
// start the Ethernet connection:
if (Ethernet.begin(mac) == 0) {

lcd.setCursor(0, 0);
lcd.print(“IP DHCP CONFIG”);
lcd.setCursor(0, 1);
lcd.print(“Failed! Halting.”);
// no point in carrying on, so do nothing forevermore:
while (true) {
Serial.println(“no dhcp, halted”);

lcd.setCursor(0, 0);
lcd.print(“IP DHCP CONFIG”);
lcd.setCursor(0, 1);

//start the rc tx module

void loop()
ICMPEchoReply echoReply = ping(pingAddr, 4);
if (echoReply.status == SUCCESS)
lcd.setCursor(0, 0);
lcd.print(“Ping succeeded.”);
“Reply[%d] from: %d.%d.%d.%d: bytes=%d time=%ldms TTL=%d”,
millis() – echoReply.data.time,

starttime = millis();
currtime = starttime;
long prevtime = starttime;

while (currtime <= starttime + cycletimeout) {
if (currtime >= prevtime + 1000) {
//update the lcd every second
lcd.setCursor(0, 1);
lcd.print(“retest in: “);
lcdPrintSecondsQuad(((starttime + cycletimeout) – currtime) / 1000L);

prevtime = currtime;
currtime = millis();

sprintf(buffer, “Echo request failed; %d”, echoReply.status);
lcd.setCursor(0, 0);
lcd.print(“Ping failed”);

//ensure ping has failed twice consecutively
if (looptwice == true) {

lcd.setCursor(0, 1);
lcd.print(“Switching off…”);
/* See Example: TypeB two rotary */
mySwitch.switchOff(4, 4);


lcd.setCursor(0, 1);
lcd.print(“Switching on…”);
mySwitch.switchOn(4, 4);

lcd.print(“Waiting 1 minute”);
lcd.setCursor(0, 1);
lcd.print(“please wait…”);
looptwice = false;

starttime = millis();
currtime = starttime;
long prevtime = starttime;

while (currtime <= starttime + cycletimeout) {
if (currtime >= prevtime + 1000) {
//update the lcd ever second
lcd.setCursor(0, 1);
lcd.print(“reteest in: “);
lcd.print(((starttime + cycletimeout) – currtime) / 1000L);
prevtime = currtime;
currtime = millis();

else {
lcd.setCursor(0, 1);
lcd.print(“retest in 15s”);

looptwice = true;

starttime = millis();
currtime = starttime;
long prevtime = starttime;

while (currtime <= starttime + retrytimeout) {
if (currtime >= prevtime + 1000) {
//update the lcd ever second
lcd.setCursor(0, 1);
lcd.print(“retest in: “);
lcdPrintSecondsQuad(((starttime + cycletimeout) – currtime) / 1000L);
prevtime = currtime;
currtime = millis();


void printIPAddress()
Serial.print(“My IP address: “);
for (byte thisByte = 0; thisByte < 4; thisByte++) {
// print the value of each byte of the IP address:
lcd.print(Ethernet.localIP()[thisByte], DEC);
Serial.print(Ethernet.localIP()[thisByte], DEC);
if (thisByte < 3) { //dont dot if last octet


void lcdPrintSecondsQuad(int digit)
/* A ten percent reduction in input voltage
will cause the lower bound to drop by ten.
This sketch is calibrated for ~4.9-5.1v
using the linksprite LCD shield. */
if (digit < 10)
{ // 9s
lcd.print(” “);
lcd.print(digit, DEC);
else if (digit < 100)
{ // 99s // 10s
lcd.print(” “);
lcd.print(digit, DEC);
else if (digit < 1000)
{ //999s //100s
lcd.print(digit, DEC);
else if (digit > 999)
{ //1000s
lcd.print(digit, DEC);

Links to guides for some of the projects i’ve tried:

  • Raspberry ambilight clone for Raspbmc/OSMC (Kodi on Linux) – Hyperion Project:

    WS2812b leds providing ambilight like backwash

  • Raspberry pi hardware watchdog timer (reboot on crash using kernel module, only requires raspberry pi, no external hardware) – Raspberry pi Watchdog timer

Ps sorry this post is long and a bit rambly, it was written across a few years!

PPS if anyone knows how to get wordpress to display C++/Arduino sketches nicely with syntax highlighting etc, please let me know in the comments!

sunset photo, taken 20th april 2007 in Wales, UK.

Depression & Suicide

I wrote this as a response to an image post trying to guilt-trip people into not commiting suicide using friends and family, on reddit. The reddit OP removed his post due to criticism, so I’ve copied it here.

Here’s the thing most people don’t get about suicide.

Those who choose to kill themselves aren’t (normally) irrational. They’re making a considered option. They’re aware of the pain they’ll leave. They’re aware of the pain of the method.

Someone who chooses to commit suicide is exactly the same response as the person who chooses to jump to death from a burning building. It’s not that the suicide is a good option. It’s that staying is unbearable.

Severe depression, or severe recurrent depression the type I suffer from, is a cruel, evil disease. It eats at your joy of life, it eats at your ability to look after yourself, it eats at your ability to function day-to-day, even simple things like cooking a meal being more akin to climbing mount Everest in a wheelchair, blindfolded, with your hands tied behind your back, than anything else.

You want to help someone like me not decide in the darkest, most painful times not to die?

First, don’t try to guilt-trip them with friends and family. It won’t help, I already know all those things. I’ve already considered them. I’ve discounted them. Sometimes the suffering is just too great.

Second, be there. That friend who you’ve not heard from for a while? Phone. Suggest popping over for a cuppa tea. Suggest they come to you. Push a little. Text. Email. IM. Skype. Reach out.

Third, if you know someone is suffering, offer to listen, anytime, anywhere, anyhow, and mean it. Keep your phone on next to you, and pick it up at 3am if they call.

Forth, if someone is really bad, struggling day to day, offer real help. Not “I’m here for you” but “hey, I’m coming over Friday, we’ll watch a film and order pizza”. Or “Hey, I’m bringing over my pasta bake, and leaving it with you, I’ll pick up the dish tomorrow.”. “Hey, need any help with housework? I’m free Saturday to come help if you want?”

Finally, Accept that, even then, sometimes someone like me will be suffering too much, and it’s not about you. It’s not about your pain, that they were suffering too much, and decided enough was enough. They’re in less pain than they were before.

P.S. Vote. Vote for people who give a shit about mental health support (in the UK, NOT THE CONSERVATIVES FOR THE LOVE OF ALL THAT IS GOOD). Vote for those who care about basic medical support. Consider donating to research.

p.p.s edit; please don’t say anything along the lines of ‘why don’t you just decide to be happy?’. That doesn’t help.

But seriously, be there for your friends and family, especially if they’re being weirdly distant. You may just save a life.