Weeknote No 3: subscription fatigue; travel; 7 day photo challenge; Microbits; and remembrance (Week 45, 2017)

Another week, another week note. And I really should try and publish these a bit earlier (it’s late on Sunday evening again!)

More on my new roof bars/carriers

Last week I wrote about buying my new Thule roof bars and bike carriers from roofracks.co.uk.

After I’d fitted the bars, I noticed a small dent in one of them. I had been super-careful when fitting them, so I can be pretty sure that it wasn’t anything I did. I emailed roofracks.co.uk and, whilst the dent is only visible in certain light conditions and difficult to photograph, they said they couldn’t clearly see the dent in the pictures I sent (including this one):

Dent in new Thule wingbars

(Is it just me? I thought the red ring would help…)

They wanted me to return the damaged bar at my cost so they could inspect and send a replacement (I’d already said it wasn’t worth it but asked if they could apply a small discount). For that reason, I can no longer recommend roofracks.co.uk. Which is a pity, because they have competitive pricing (presumably based on volume sales).

Subscription fatigue

I also referred to subscription fatigue in last week’s weeknote. I knew that my friend David Hughes had written about it somewhere, but I couldn’t remember where… he pointed me to his newsletters (issue 2 and issue 4).

“Each developer that moves to this business model says “it’s just the price of a cup of coffee” every month, and it is. But my […] issue is that many apps are moving to this business model, and that starts to add up.

I could be in the position where I am spending hundreds of pounds a year to essentially rent software.

That is not for me.”

Hear, hear!

Travel

I spent half the week in the north west of England. Rochdale to be precise.

As it’s so difficult to get a parking space near Milton Keynes station after about 8:00 on a weekday, I caught a bus from home. I found a great website that uses open data to list all UK bus services. Bustimes.org.uk is not an official resource but, like realtimetrains.co.uk, it is an incredibly useful one!

I’d bought a ticket from Milton Keynes to Rochdale and back which, despite showing as only valid via Manchester, was not clear about whether it could be used on trams between Manchester’s two main stations (Piccadilly and Victoria). Manchester Metrolink later confirmed that the ticket wasn’t valid (so it’s a good job I played safe and bought a tram ticket then!).

If only Transport for Greater Manchester took a leaf out of Transport for London’s book with tickets that include public transport transfers (cf. Underground between London termini on through journeys) though it seems you can get a ticket that is valid for tram transfers – I just don’t know how!

I found it interesting to see that people on Twitter thought £67.50 was expensive for a return trip from Milton Keynes to Manchester (I thought it was a bargain). It’s certainly not expensive when compared with demand-based pricing on peak Manchester-London services (which can be over £300) or with the cost of driving ~400 miles to Rochdale and back…

Anyone who’s spent any time in and around Manchester will know it’s a city with a reasonably high chance of precipitation. Stupidly, I forgot to take a coat that fits over my suit to Greater Manchester. Muppet. Luckily I had an umbrella in my work bag…

Also worth knowing (from my travels further south at the end of the week): the rear First Class section in Thameslink trains is declassified until further notice. I have no idea why but it’s useful to get access to some power:

The socket location is a little unusual though:

Work opportunities

A couple of nights in Rochdale also gave me a chance to catch up with an ex-colleague and one of my most supportive former managers, Alan Purchase (@AlanPurchase).  He’s at Capgemini now – who seem to be hoovering up a lot of people with Microsoft skills (as are Microsoft themselves). Meanwhile, I got one of the regular LinkedIn contacts asking me if I’d be interested in a fantastic opportunity from someone I’ve never heard of who won’t even say who they are working for but this one was really special: it would involve moving my family to Ireland. Tempting though it may be to keep my EU citizenship post-Brexit, thanks but no thanks.

The rest of the week

As mentioned above, I was back dahn sarf for the second part of the week and spent two days in London with the first one at Microsoft learning more about the capabilities of Azure with regards to data and the intelligent cloud. I’ve been trying to grok this for a while (my background is Infrastructure). The second day was more mundane, supporting a colleague on a consulting engagement.

I tried using Apple Maps for turn-by-turn navigation on my watch whilst riding my Brompton to Microsoft on Thursday. Unfortunately, Apple Maps lacks cycling directions (it only has walk, drive, public transport or taxi) and I got a bit lost with the various “no cycling” routes in Regents Park which made for an interesting route map!

7 Days 7 Photos Challenge

I’ve been “challenged” for the 7 days 7 photos challenge on Facebook. The rules are simple:

Seven days, seven black and white photos of my life. No humans. No explanation. Challenge someone every day.

Some people are critical of this – saying it’s not a challenge, and suggesting it’s just creating a bunch of poor black and white photos on Facebook. I’m actually finding it a great opportunity to think about what I’m doing and to capture something from the day. Anything that gets me thinking creatively about capturing images has to be good, right?

3 days in and my efforts are on Flickr – see what you think so far…

7 Days 7 Photos Day 2

Other stuff

I was signposted to John Naughton (@jjn1)’s 95 theses about technology by Matt Ballantine (@ballantine70). I think it should be required reading for anyone in a senior technology role…

I do most of my geek stuff with my eldest son, so I asked the youngest if he fancied a play with a BBC Microbit. Our inventor’s kit arrived this week:

We had a lot of fun and it was fantastic to see his face light up when his Microbit started playing the sounds and displaying the letter of the notes as he had instructed.

I’ve played with the Relive app a few times to generate a birds-eye view of a route I’ve cycled. GPX Hyperlapse takes a different view – using Google Streetview to help view a route (perhaps in preparation for a ride).

IBP Index looks interesting as an approach for measuring the relative effort of different activities (e.g. cycling, running, etc.).

Today was Remembrance Sunday and a particularly poignant one where I live in Olney as so many local men were lost at the Battle of Passchendaele, exactly one hundred years ago. It’s always good to see so many people turn out to pay their respects but such a shame the traffic wasn’t halted for the 2 minute silence, as it has been in previous years.

D700-20171112104016.jpg

That’s all for now

Right, that’s all for now. If you read this far, thanks for sticking with me. These posts take a long time to write so any feedback is welcomed – it would be good to know I’m not just writing a diary for my own benefit!

Ethernet control for my office “traffic lights”

A couple of years ago, I wrote about the “traffic lights” I’d created for my home office (and subsequent “upgrade”). Shortly after that, I updated the solution to use three LEDs (as shown below) but it still wasn’t quite what I needed. Walking to the door to push a button and change the light defeated the object somewhat.  I needed to enable this device with a “web service”!

The solution comes in the form of an Arduino Ethernet Shield, allowing pin control over a standard Ethernet connection.  I didn’t use the official shield though – cheap imports can be found on eBay for around £7.  Following that, I amended my code using the Instructables Arduino Ethernet Shield Tutorial and another Instructables post on controlling an LED over the Internet using an Arduino.

The end result is below (or on Github) – and the Arduino uses DHCP to obtain an IP address (reservations can be used to control which one – or DHCP logs can be analysed) and a simple query string is read to set the light using:

  • http://xxx.xxx.xxx.xxx/?r for red.
  • http://xxx.xxx.xxx.xxx/?a for amber.
  • http://xxx.xxx.xxx.xxx/?g for green.

Anything else fails back to red.  

/*
Red/green LED indicator with pushbutton control
Based on http://www.makeuseof.com/tag/arduino-traffic-light-controller/

USE_GITHUB_USERNAME=mark-wilson

*/

// Setup Ethernet Shield
#include <SPI.h>
#include <Ethernet.h>
boolean reading = false;

// Enter a MAC address and IP address for your controller below.
// The IP details will be dependent on your local network (commented out if DHCP in use):
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
// byte ip[] = { 192, 168, 0, 112 }; //Manual setup only
// byte gateway[] = { 192, 168, 0, 1 }; //Manual setup only
// byte subnet[] = { 255, 255, 255, 0 }; //Manual setup only

// Initialize the Ethernet server library
// with the IP address and port you want to use
// (port 80 is default for HTTP):
EthernetServer server(80);

// Pins for coloured LEDs
int red = 3;
int amber = 4;
int green = 5;
int light = 0;

int button = 2; // Pushbutton on pin 2
int buttonValue = 0; // Button defaults to 0 (LOW)

void setup(){
Serial.begin(9600);

// Set up pins with LEDs as output devices and switch for input
// Pins 10,11,12 & 13 are used by the Ethernet Shield
pinMode(red,OUTPUT);
pinMode(amber,OUTPUT);
pinMode(green,OUTPUT);
pinMode(button,INPUT);

// start the Ethernet connection and the server:
Ethernet.begin(mac);
//Ethernet.begin(mac, ip, gateway, subnet); //for manual setup

server.begin();
Serial.println(Ethernet.localIP());
}

void loop(){

// listen for incoming clients, and process qequest.
checkForClient();

// Read the value of the pushbutton switch
buttonValue = digitalRead(button);
if (buttonValue == HIGH){
changeLights();
delay(1000); // Wait 1 second before reading again
}
}

void changeLights(){
// Change the lights based on current value: 0 is not set; 1 is red; 2 is amber; 3 is green
switch (light) {
case 1:
turnLightAmber();
break;
case 2:
turnLightGreen();
break;
case 3:
turnLightRed();
default:
turnLightRed();
}
}

void turnLightGreen(){
// Turn off the red/amber and turn on the green
digitalWrite(red,LOW);
digitalWrite(amber,LOW);
digitalWrite(green,HIGH);
light = 3;
}

void turnLightAmber(){
// Turn off the green/amber and turn on the red
digitalWrite(green,LOW);
digitalWrite(amber,HIGH);
digitalWrite(red,LOW);
light = 2;
}

void turnLightRed(){
// Turn off the green/amber and turn on the red
digitalWrite(green,LOW);
digitalWrite(amber,LOW);
digitalWrite(red,HIGH);
light = 1;
}

void checkForClient(){

EthernetClient client = server.available();

if (client) {

// An http request ends with a blank line
boolean currentLineIsBlank = true;
boolean sentHeader = false;

while (client.connected()) {
  if (client.available()) {

    if(!sentHeader){
      // Send a standard http response header
      client.println("HTTP/1.1 200 OK");
      client.println("Content-Type: text/html");
      client.println();
      sentHeader = true;
    }

    char c = client.read();

    if(reading && c == ' ') reading = false;
    if(c == '?') reading = true; //found the ?, begin reading the info

    if(reading){
      Serial.print(c);

       switch (c) {
         case 'a':
           turnLightAmber();
           break;
         case 'g':
           turnLightGreen();
           break;
         case 'r':
           turnLightRed();
           break;
       }
    }

    if (c == '\n' && currentLineIsBlank)  break;

    if (c == '\n') {
      currentLineIsBlank = true;
    }else if (c != '\r') {
      currentLineIsBlank = false;
    }

  }
}

delay(1); // give the web browser time to receive the data
client.stop(); // close the connection:

}

}

All it needs now is another service to read my Lync status and call the Arduino accordingly, although, having got this far, I have to admit the form factor is not exactly brilliant and I probably should spend the money on a Busylight or a Blynclight instead so that my Arduino can be repurposed for a new project!

Or, of course, there’s Garry Martin (@GarryMartin)’s beautifully simple approach:

Upgraded the “traffic lights” in my office already

Last night I wrote a blog post about the “traffic lights” for my office. The trouble with the original setup was that the light was set to a particular state until I edited the code and uploaded a new version to the Arduino.

I was so excited about having something working that I hadn’t actually finished reading the Arduino Programming For Beginners: The Traffic Light Controller post that I referenced. Scroll down a bit further and James Bruce extends his traffic light sequence to simulate someone pressing a button to change the lights (e.g. to cross the road).

I worked on this to come up with something similar – using a variation on James’ wiring diagram (except with 2 LEDs rather than 3, and using pins 11 and 12 for my LEDs and 2 for the pushbutton switch), I now have a setup which waits for the button to be pressed, then sets the red LED, until the button is pressed again (when it goes green), etc.

My code is available on github but here’s the current version (just in case I lose that version as I get to grips with source control…):

/*
Red/green LED indicator with pushbutton control
Based on http://www.makeuseof.com/tag/arduino-traffic-light-controller/
*/

// Pins for coloured LEDs
int red = 11;
int green = 12;
int light = 0;

int button = 2; // Pushbutton on pin 2
int buttonValue = 0; // Button defaults to 0 (LOW)

void setup(){
// Set up pins with LEDs as output devices and switch for input
pinMode(red,OUTPUT);
pinMode(green,OUTPUT);
pinMode(button,INPUT);
}

void loop(){
// Read the value of the pushbutton switch
buttonValue = digitalRead(button);
if (buttonValue == HIGH){
changeLights();
delay(15000); // Wait 15 seconds before reading again
}
}

void changeLights(){
// Change the lights based on current value: 0 is not set; 1 is green; 2 is red
switch (light) {
case 1:
turnLightRed();
break;
case 2:
turnLightGreen();
break;
default:
turnLightRed();
}
}

void turnLightGreen(){
// Turn off the red and turn on the green
digitalWrite(red,LOW);
digitalWrite(green,HIGH);
light = 1;
}

void turnLightRed(){
// Turn off the green and turn on the red
digitalWrite(green,LOW);
digitalWrite(red,HIGH);
light = 2;
}

Now I’m wondering how long it will be before the kids work out that they too can change the status (like pushing the button at a pedestrian crossing!)…

“Traffic lights” for my home office

It’s the school holidays, which means that working from home can be a little… noisy… at times.  Earlier today I saw a blog post from Scott Hanselman where he had hooked a light up to his instant messenger status to tell his family when he was on a call, or otherwise busy with work – and that gave me an idea…

Scott’s solution uses something called a Busylight but a) I’m too tight to spend €49 on this and b) the geek in me thinks “surely I can rig up something using a few LEDs?”. One of the comments on Scott’s post led me to an open source project called RealStatus but that uses an expensive USB HID for the LEDs so doesn’t really move me much further forward…

I decided that I should use my Arduino instead… with the added bonus that involving the children in the project might get them “onboard” too… the trouble is that my electronics prototyping skills are still fairly rudimentary.

As it happens, that’s not a problem – I found an Arduino traffic light program for beginners and, as I don’t have a yellow LED right now, I adapted it to what I do have – simple red/green status (my son and I had fun trying different resistors to adjust the brightness of the LEDs)

You can see the breadboard view here (generated with Fritzing – I’m still working out how to make this into a schematic) and below is my Arduino code (which is also available on github – although I might have worked on it a bit by the time you read this):


// Pins for coloured LEDs
int red = 12;
int green = 13;

void setup(){
// Set up pins as output devices
pinMode(red,OUTPUT);
pinMode(green,OUTPUT);
}

void loop(){
// Change the lights
// turnLightRed();
turnLightGreen();
}

void turnLightGreen(){
// Turn off the red and turn on the green
digitalWrite(red,LOW);
digitalWrite(green,HIGH);
}

void turnLightRed(){
// Turn off the green and turn on the red
digitalWrite(green,LOW);
digitalWrite(red,HIGH);
}

It’s pretty simple really – I just call the turnLightRed() or turnLightGreen() function according to whether I am ready to accept visitors. In itself, that’s a bit limited but the next step will be to work out how to send commands to the Arduino over USB (for some integration with my instant messaging client, perhaps) or even using a messaging service (Twitter?) and some network connectivity… more research required!

Getting started with Arduino

Arduino UnoA couple of days ago, my new Arduino board arrived and, last night, I finally got around to having a play.

For those who don’t know what an Arduino is:

“Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware and software. It’s intended for artists, designers, hobbyists, and anyone interested in creating interactive objects or environments.”

[Arduino website]

The first thing I noticed was how small the board is (smaller than a credit card) and how large the USB connector makes it… but, when I was working out what I needed to buy (I’ve always been interested in electronics, but never really got into it), I learned a few things about Arduino that might be useful to other newbies:

  • You can buy various Arduino boards, with a variety of processors. I picked up an Arduino Uno, which seems to be a good starting point. My Uno shipped with a USB cable that can also provide power (i.e. powering from a battery or other DC source is optional, as Dave Jacoby and Gareth Halfacree confirmed for me on Twitter – thanks guys). Note that some Uno boards have surface-mounted (SMB) chips – you might prefer to go for a DIP version instead (as I did) as this can be swapped out if necessary.
  • Shields are boards that sit on top of the Arduino and add additional functionality.
  • Whilst my Arduino has an LED on the board that I can interact with to get my head around the concept, you’ll need some more bits and bobs to do anything more complex. There are various starter kits on the interwebs (many or which include the board and a USB cable). I’ve just ordered an ARDX kit from .: oomlout :. (as recommended by Gareth) but one of the reasons for going for this one is that it’s also available without the board if you already have one…  when it arrives, I’ll have a breadboard, and a whole bunch of components to try out different ideas and get my head around controlling electronics programmatically.
  • I bought my board from Amazon (RS Components’ shipping charges were too high and Maplin’s stock levels are appalling) but, I’ve since been recommended a number of suppliers including the aforementioned .: oomlout :., Cool Components and SK Pang (thanks to Andy Piper).

The intention is that I’ll use one or more of these devices to control a model railway (yes, it’s geeky, but it could be a fun project) but, for now, I’ll start off by getting to grips with turning on lights and other similarly simple tasks, and I’ll probably try and get my sons interested too (they’ve already asked what it is… and seen some videos of other people’s projects).

The Arduino integrated developer environment (IDE) runs on Windows, OS X or Linux but, as this is a geek project and my netbook is basically redundant (and very portable), I decided to use that and install it on Ubuntu (11.10). Installation was very simple (I just followed the instructions on the Arduino Playground – a wiki for the Arduino community – and found v22 of the Arduino IDE in the Ubuntu software centre).

With the IDE installed, I set about writing code. Or, perhaps more accurately, I set about modifying other people’s code. There are a load of examples on the Arduino playground and a good getting started guide for Arduino at Bit-Tech but I found the Arduino Tutorials at Lady Ada really accessible for a newbie like me. Pretty soon I used lesson 1 and lesson 2 to change the 1 second blinking LED on my board to a variety of settings, and finally to just off (ready for when I have a go at this with my son).  Once my starter kit arrives with a bunch more components, I’ll try a do something a little more complicated! Maybe one day I’ll even get past the IDE and onto some real C programming (it’s been a while since I wrote any code, let alone in C).

Right… now it’s time to go off and find some cool projects for my new toy…

Image credit: Arduino Uno by Snootlab, on Flickr, used under the Creative Commons Attribution 2.0 Generic licence.