Archive for March, 2016

Setting Up the Oak – Flashing LED

Sunday, March 27th, 2016

The Oak microcontroller is new, Digistump only shipped version 1 firmware a few days ago (20th Match 2016). The hardware I have was shipped sometime in January. So the first thing to do is to upgrade the firmware and then try blinking an LED.

Upgrading the firmware

The Digistump Wiki contains a number of tutorials and troubleshooting guides. First stop the Connecting Your Oak for the First Time page. This shows how the Oak can be connected to your WiFi network and the firmware updated.

The initial over the air firmware update was problematic to say the least. Reading through the Digitsump forums it seems that I am not the only one having a problem with the first update. There are three methods for upgrading the firmware:

  • Over the Air using firmware from the internet
  • Over the air with a local server
  • Serial using pyserial or esptool

I started at the top of the list and slowly worked my way down. In the end the only method that worked for me was the serial update.

Flashing an LED

With the latest version of the firmware installed it is time to test the development environment. What could be simpler than flashing and LED. The on board LED is connected to pin 1 so lets try and use that.

Digistump offer two development environments:

At the time of writing there was a known issue with the Particle development environment which prevented an application being built and flashed successfully. This is an early release and so issues are expected.

This only leaves the Arduino environment, an IDE I really hate.

There are two methods for flashing an application to the Oak using the Arduino environment:

  • Over The Air (OTA)
  • Serial (requires Python)

Despite the earlier problems with the firmware update I decided to try the OTA method first. DigitStump have provided compehensive instructions in their WiKi on how to achieve this.

Following the example was easy and after only 15 minutes I have the LED on the Oak flashing at 1Hz. Just to prove it was not a fluke I then tried changing the frequency and reflashing the Oak.



My initial frustration with the firmware update was soon forgotten once I had an application successfully running on the Oak. I am hoping that the issues were caused by the fact I have an early release of the board with the original firmware installed.

Programming is easy enough and can be done over the air which is convenient.

Next up, talking to sensors.

Weather Station

Friday, March 25th, 2016

The first part of this year has seen me working on some photography projects, now time to get the soldering iron out. I have three projects I’m hoping to complete this year and one long term project that may take me a while, so pay attention 007.

Weather Station

A few weeks ago I received a couple of Oaks. These boards are based around the ESP12 module, a Kickstarter project I backed at the end of 2015. The project aimed to make working with the ESP12 easier by providing integration with The latest firmware was release a few days ago so I think it is time to give this little device a go.

At the start of the year we came across a weather meter which allowed the measurement of rainfall, wind speed and wind direction. My wife mentioned that it might be nice to use one of these to record the weather in the garden.

And so the idea was born, weather meter, meet the Oak.

Mapping Out The Project

After a few hours the project started to become larger than just a couple of sensors, it currently looks something like the following:

Weather Station Mind Map

Weather Station Mind Map

I have coloured each block of concepts the same colour in order to give the project some structure. Let’s look at each block in turn and see how we can approach the problem.

Temperature, Pressure and Humidity

Starting with the green block and five o’clock on the diagram.

Temperature, Presure and Humidity Mind Map

Temperature, Presure and Humidity Mind Map

There are two temperatures we can measure here, air temperature and soil or ground level temperature. The air temperature will give an indication of how pleasant a day it is at the moment and the ground level sensor will give an indication of the progress of the seasons from the plants perspective. For this reason we are interested in both of these measurements.

Air pressure has long been used as a predictor for upcoming weather events.

Luckily we can get the air temperature, pressure and humidity sensor in one convenient package, the BME280. Ground level temperature will need a waterproof sensor. I think this would be best purchased as a unit rather than made so the DS18B20 with a 6 foot cable looks like it might be ideal.

Wind and Rain

Working clockwise, the next block are the wind and rain sensors:

Wind and Rain Sensor Mind Map

Wind and Rain Sensor Mind Map

All of these measurements come from the weather meter. The wind speed and rainfall sensors are simple switches that generate pulses whilst the wind direction is a resistor network.

Light Sensor

The next block shows the two light sensors:

Light Sensor Mind Map

Light Sensor Mind Map

The two light measurements are the overall light intensity (luminosity) and ultraviolet light intensity. Luckily there are a couple of sensors for these two measurements, the TSL2561 and the ML8511.

The ultraviolet light sensor is an analogue sensor and so we will have to consider the stability of the supply voltage when making the reading.

The luminosity sensor uses a measurement window and a sensitivity setting to take a reading. This means that for given settings the sensor may be overwhelmed and simply give a maximum reading. The work around for this is to make the measurement window and sensitivity dynamic. So long, sensitive windows at night and short less sensitive windows on bright sunny days.

Cases and Location

The next things we need to consider are cases and locations:

Case and Location Mind Map

Case and Location Mind Map

The microcontroller and power etc. will need to be located in a case of some form. This will need to be weather proof as water and electricity are not the best of friends. It would also be a good idea to keep any batteries in an environment with a reasonably stable temperature. A little research into how the professionals house weather Stations.

The sensors on the other hand need to be outdoors in a suitable location for the measurements being taken.

Power Supply

All of this equipment will need a stable power supply:

Power Supply Mind Map

Power Supply Mind Map

The initial work can be done using a bench power supply but when the project moves outdoors it will need to either be mains or battery powered. The long term aim is to use a solar cell and rechargeable battery, as they say on Kickstarter, a stretch goal.

Data Logging and Real Time Clock

Now we have collected all of this information we need to do store it somewhere:

Data Logging Mind Map

Data Logging Mind Map

The Oak is a WiFi enabled board so the most obvious place to put the data is the cloud. It might be an idea to also provide some local storage in case the WiFi network is unavailable.

The Real Time Clock (RTC) could have two uses, to wake the microcontroller and also provide a timestamp for the data items.


What started out as a simple wind and rain logging project has grown a little. The current specification is to measure and log the following readings:

  1. Rainfall
  2. Wind speed
  3. Wind direction
  4. Luminosity
  5. Ultraviolet light

The measurements should be collected and reliably logged either locally or preferably to the cloud.

There are several challenges with a number of interesting problems to overcome.

Let’s get this show on the road.

So I’m Sneaky

Sunday, March 6th, 2016

So it’s official, I’m sneaky. That’s what I have been told by my wife, Karen. Why you may ask, well not all of my projects are electronic or software related; I’m also a keen, average amateur photographer.

Flying Scotsman

Restoration on the Flying Scotsman was finally completed this year. This was a long term project after the locomotive was purchased for the nation by the National Railway Museum. The train re-entered service with a run from London to York in February 2016.

As part of the return, the National Railway Museum organised a couple of photo opportunities, one early in the morning and one in the evening when it was dark. In both cases the locomotive would be under light steam and the evening shoot would be atmospherically lit. Now I’m not a train enthusiat per se but as a photographer how could I resist.

Here are a couple of the photos from that evening:

Flying Scotsman in North Yard

Flying Scotsman in North Yard

And a low shot:

Flying Scotsman in North Yard Low Shot

Flying Scotsman in North Yard Low Shot

But that does not explain the sneaky…

Family Photographs

My wife’s family have always been very close but sadly her mother and father are no longer with us. We do have a collection of about 300 photographs from her mothers family collection. Unfortunetly they are in mixed condition, some of them rather poor. The photographs had a variety of problems from creases to marks and tears on the surface of the image. For example, the following is a snippit from one of the images:

Unprocessed Image With Creases

Unprocessed Image With Creases

Time for some restoration work. Modern image software is very impressive and not always expensive. The software I tried (and later purchased) last year is Mac specific, there is no PC version, and won Mac application of the year for 2015. The software is Affinity Photo. This software offers an impressive set of features and the video tutorials provide a new user with an insight on how to use the features.

So taking the image from above and 30 minutes with the software and I had the following:

Processed Images With Creases Removed

Processed Images With Creases Removed

Creases all gone, now on to improving the image a little.

Still no sign of sneaky…

Starting in January, I methodically took each of the 300+ images and started to restore the full collection. A few of the images were in too poor condition or out of focus and so they were discarded but the majority of the images could be improved a little. Six weeks later I had a comprehensive set of photographs going back to Victorian times.

The final stage of the processing was the creation of a family album starting with from Great Grandparents through to the current day. For this I used Boots Photo Service to create an 11×8 inch hardback album.

And that’s why my wife thinks I’m sneaky.


It has been a while since I was able to use the soldering iron and if I am to get through the projects planned for Christmas then I need to pick it up again. The time playing with Affinity Photo has certainly proved fruitful, I can well recommend this product.

The brief diversion into image processing did however bring a moment of pleasure into my wife’s life, a moment I’ll always treasure.