A sample text widget

Etiam pulvinar consectetur dolor sed malesuada. Ut convallis euismod dolor nec pretium. Nunc ut tristique massa.

Nam sodales mi vitae dolor ullamcorper et vulputate enim accumsan. Morbi orci magna, tincidunt vitae molestie nec, molestie at mi. Nulla nulla lorem, suscipit in posuere in, interdum non magna.

mbed platform – FRDM-KL25Z

I’ve been using the mbed platform for a while now after receiving one to develop the IoT Gateway project. This was based on the NXP LPC1768 chip, the details can be found here. One of the downsides of this mbed was its price, even though the features are impressive for a microcontroller development board. Recently I came across the Freescale FRDM-KL25Z boards which are a similar size to the well known Arduino but for around £10 (prices may vary) they offer more power and features than the Arduino. They have a 48MHz cpu with 16K RAM and 128K Flash compared to the Arduino’s 16MHz cpu, 2K RAM and 32K Flash. The FRDM-KL25Z doesnt include any headers so these have to be purchased separately and soldered in yourself.

The mbed boards use the same on-line compiler which makes for quick and easy development without having to install full development environments on all the computers you use. The FRDM-KL25Z, when it arrives, does not contain the mbed bootloader code. This must be applied as a simple download from the getting started page on the mbed website

For a comprehensive article on the FRDM-KL25Z, head on over to Tronixstuff.

FRDM-KL25Z Basic Snake game
FRDM-KL25Z with headers added Nuelectronics Nokia 3310/5110 LCD and joystick shield on FRDM-KL25Z

One of the interesting features is the Arduino compatible header layout, this enables a range of Arduino shields to be used with the FRDM-KL25Z providing the appropriate libraries are available. For shields to be compatible, they need to be 3.3V shields or use the 5V line to power 3.3V devices via an on-shield voltage regulator as the pins on the FRDM-KL25Z are only 3.3V tolerant. The SPI pins are in the correct place and the STDIO serial pins appear to be in the same place too.

At present I have found existing mbed example code for the Nuelectronics Nokia 3310/5110 LCD and joystick shield and have now converted this to a library. Additional graphic drawing functions have been added, that I had in aprevious Arduino version, to make it more useful.The mbed code and libraries available at

Another library that I’ve ported is the Adafruit Arduino library for WS2801 RGB LED drivers. This can be used to display patterns on a number of RGB LEDs that are chained together. I have 2m of LED strips totaling 64 LEDs which can be quite impressive when all are being used at once! However they do need to be powered from an external source.

More updates on the FRDM-KL25Z libraries and usage coming later.

Bitbucket or GitHub?

I’ve been using GitHub for a couple of years now for distributing code, but for about the past 6 months I’ve started using Bitbucket, initially in a collaboration for Both services offer similar features but at present neither ticks all the right boxes. Below is my comparison of the two.

Both services offer the basic features you’d want:

  • Public repositories
  • Use standard Git client tools integrated with favourite dev tools
  • Issue tracking
  • Wiki
  • Revision history
  • Forking


GitHub Bitbucket
GitHub screenshot

GitHub screenshot

Bitbucket screenshot

Bitbucket screenshot

$7/m for private repositories, couldn’t determine how many though. Unlimited free private repositories
No teams, but any number of collaborators on a repository Free plan can include team of 5 members
Community backed, but uses a .com domain! Corporate backed but uses a .org domain!
GitHub pages for documentation as well as wiki Wiki only
Mobile App Not Yet? Although mobile Git clients could be used
Doesn’t appear to be an import option Can import repositories from GitHub, but just latest version, no history retrieved.
New features added on regular basis New features arrive less frequently
Supports Git Supports Git and Mercurial
  Can use own domain e.g.


At present I’m tending towards Bitbucket mainly because of the free private repositories that will enable code to be kept private if it is work for a customer or before it is released to a wider audience. As a result I’ve started to move a number of my repositories from GitHub to Bitbucket. I’m also re-pointing the Git origin for my local repositories so that they can push to Bitbucket instead of GitHub.

The opinions and views expressed here are my own.

The Coolcomponents 1Kg box of fun!

I recently spotted that Coolcomponents were offering a small number of 1Kg packages of cool stuff for the bargain price of £10. With the usual VAT and postage this was just under £20 for a 1Kg box of fun cool stuff that you’ve no idea what you’re going to get. The small number of boxes sold out fairly quickly, but I was able to get one for myself. The box contents were described as old stock, returns, broken and non-functioning items including Arduino boards.

Here is a photo of the items within the box I received:

Assorted stuff

Inside the box were the following items and their condition: (Prices include VAT and are from searching on net if not currently available from Coolcomponents)

Item Condition Approx Value when new (£)
Arduino BT (Bluetooth), BT06 with ATmega328 Appears to be working after bootloader update, can upload sketches over bluetooth serial when paired with laptop 100.00
Arduino Ethernet + POE module Was able to upload sketches but board has problems. POE module and Wiznet chip appear to be very hot. 60.00
Arduino Ethernet Powers on, verify errors on burning bootloader. 40.00
Seeedstudio Seeduino v2 Power light comes on, unable to upload sketches or bootloader 20.00
Lithium Backpack for Mega (Hi-Capacity) Broken switch to flip between charge and use. Can be replaced easily. Battery seems to be able to be charged and provides 3.3V out. 40.00
Sparkfun MP3 trigger, v2 Would not read uSD cards. Found dry joint on uSD socket, resoldered. Now firmware updated and plays MP3 files 35.00
FEZ Spider 1.0 Unknown, assumed faulty ??.??
GPS Module EB-3531 & MT-662 Identified as a Globalsat EB-3531 GPS receiver module on a demo board. Found datasheet, hooked up antenna and I’m now able to get data from it. ??.??
Large Surface transducer One lead slightly damaged, not fully tested 20.00
NEMA17 Stepper motor with leads One wire broken at motor. Wire fixed but motor not yet tested. 10.00
Servo, boxed with accessories. Model Sky Holic DGS-299 Appears unused. Tested with Arduino Servo library and works fine. 10.00
2x 1m RGB LED Strips with 32 RGB LEDs each strip Appears to have been bent too sharp as it is cracked in places. Total of 64 RGB LEDs and Driver chips. Tested both strips on an Arduino with example sketch and it can light up all 64 LEDs in sequence. So even though it looks in a bad way, it actually works. See video below. 70.00

Overall a mix of boards and parts with an original selling price of over £400. The best finds appear to be the MP3 Trigger, now that it works and the Arduino BT, closely followed by the lithium backpack. Result!!

I’ll try to update this if and when parts get fixed or re-used somehow.

More images of the box contents:

RGB LED strips video

Scrolling message display – From Meetup to Product


I originally saw a demo of the Vodafone K3770 Mobile broadband dongle given by Ashley Mills of Vodafone at IoT London Meetup 9. In the demo the mbed was receiving SMS and outputting them to a printer. Shortly after this I got myself a Vodafone K3770 dongle and started to see what I could do with it. At the time the library was still in a beta state so any feedback was welcomed by the team developing it. Eventually the library was released as an official mbed library.

2013-03-16 16.49.27

The idea

I had previously done projects with a number of 8×32 LED matrix displays with Arduino and had a code base to work with that could then be ported to the mbed platform. The idea of receiving SMS and displaying them on a scrolling message display sounded like an interesting project to use the mobile broadband dongle with. I had also started using the service IFTTT so the idea of being able to automate messages from weather reports to FourSquare checkins while still being able to receive and display other messages was being formed.

The prototype

The prototype was built on stripboard and consisted of the mbed module, a USB socket, voltage regulator and of course 4 8×32 LED matrix displays giving a total message area of 8×128 pixels. I opted for the horizontal format as this lends itself better to long scrolling messages. Alternative configurations include 16×64 which could give a moving display and a static display to include date/time display.

2013-02-18 22.30.44

Mounting the displays

I had a number of reclaimed oak floorboards that I had bought for a woodworking project and thought that mounting the displays in an oak panel would give a combination of old and new things. The oak would also match the furniture in the house so make the display more acceptable as a piece of furniture. The plank was planed and a cutout made using a router. The rear was also recessed to receive the displays.

2013-03-16 16.49.37


The software has a number of features:

  • Query Network for its phone number
  • Display initial message showing its number
  • A number of SMS command words are recognised to perform simple actions (e.g. Retrieve balance)

The code is available from my mbeed page ready to import into your own mbed.

2013-03-16 16.50.07

Designing a PCB

In order to learn how to use EagleCAD for schematic and PCB design I decided to use this project as a learning exercise with the intention of having a number of boards made.

PCB manufacture

The production files were sent to Seeedstudio using their 2 layer Fusion PCB service. This is a relatively cheap way to have a minimum of 10 boards manufactured. The downside is that it takes a number of weeks for the boards to arrive in the UK form China.

Building first PCB

After just over 2 weeks, the PCBs arrived in all their green glory.

PCB topside PCB underside
Topside Underside
low components 2013-03-20 20.36.34
First the resistors, diode and other components close to the board. Add the headers and sockets. At this point the board was powered up and the voltage regulator tested to ensure that all the points that need 5V have the correct voltage.
Completed board  
Completed board  

In use

The new board was connected up to the displays and the first problem was noticed, the displays were in the wrong order. Checking the PCB I had drawn the schematic with the different select lines going to different digital outputs on the mbed. This is an easy fix in the code and within minutes it was displaying scrolling messages properly.
The printer port hasn’t yet been tested


A couple of people had noted that the copper layer covered the area where the dongle was connected, this could affect the signal being received. The other issue is that if the USB socket is soldered in correctly then the dongle is too fat to be able to fit. This was temporarily solved by raising the connector at an angle but this would put strain on the soldered joints.
Both of these issues can be fixed by altering the shape of the board so there is a cutout where the dongle is.


  • Mount the board on back of display
  • Test printer port
  • Update PCB with cutout for dongle
  • Add licensing details
  • Release schematics, parts list and all build files

And finally…

I have a few spare PCBs so if anyone in the UK would like one drop me a message either via my mbed page or via Twitter @andrewdlindsay.

Max1284 – The next step for opensource IoT Gateway

I’ve been helping with a small project over at to produce a cheap, modular Internet Of Things gateway. Progress can be followed on its dedicated page. So far it has support for a number of wireless connections including RFM12 for Jeelab related sensor nodes, XBee and XRF. The data, once collected can then be sent to various destinations including Cosm, Open, Open Energy monitor EmonCMS or custom scripts. The gateway software is currently under development and is base don the successful Mbed IoT gateway project.

The current status of the project is that the first batch of PCBs have been produced, initial boards have been built and are being tested to identify any issues and changes needed for a larger production run with a view to offering a number of kits for sale.

More updates to follow.

A Slice of Pi – Interfacing the Raspberry Pi

Having recently acquired a Raspberry Pi on loan for a few days I decided to try some interfacing. The simple solution would have been to put together a cable and header plug to connect to the I/O pins on the Raspberry Pi. This would need a custom circuit each time I wanted to try something. Another solution is to buy a board that connects to the I/O pins and provides a prototyping area in a similar manner to the Arduino proto-shields. The board chosen is the Slice of Pi from Ciseco plc. This has a number of features that make it a good board to use:

  • It’s cheap!
  • Comes in kit form so you can include as much of it as you want, the minimum being the pcb and 26 way connector
  • Includes connectors for XBee/XRF/RN-XV wifi module.
  • SPI, I2C and GPIO on a pair of 8 way header sockets
  • Pads for 5V, 3.3V, GND, RX and TX

Building the kit is straightforward and is shown in the images below. After building a couple of these I found that if you need the Xbee connectors then its best to put them in first.

The contents of the Slice of Pi kit. Main connector is soldered underneath pcb. Add some headers to the top of the board Add the XBee/XRF header sockets if required Underside view, all soldered. Example showing connector to enable FTDI cable to be used as console cable

That’s all there is to the Slice of Pi from Ciseco plc. While you’re there, check out the XRF radio modules, compatible with Slice of Pi!

More to follow on adding specific hardware.

Long time no post

It looks like its been an absolute age since I posted anything here, too much going on but here are a few things I’ve been doing:

Plus much more…

TinyBasic for Nanode

As one of those that has taken up the TinyBasic Christmas Challenge issued by Ken Boak, the creator of Nanode, a range of Arduino compatible microcontroller boards, I am posting my updates. The basic code is able to run simple Basic commands and run small programs. What it lacked is a place to store programs for later retrieval and also to increase the available memory for program storage. Unlike the Arduino, the Nanode-RF comes with an external 32Kbyte static ram chip fitted and a uSD card slot.

The codebase used is at and already had a number of I/O commands added by Dave CJ.

My updates are:

  • Move static strings to program memory
  • Convert to use SRAM for TinyBasic program, variables and stack giving 32768 bytes instead of the original 1400bytes!
  • Implemented LOAD/SAVE/DIR/LRUN commands for uSD to Load, Save, directory list and load then run basic programs. All stored in plain text and can be changed by editing the files on the uSD card.
  • Include simple SRAM checker, if it fails then pulse digital pins 5 and 6 alternately
  • Added simple MEM command to display memory used
  • Added EPEEK and EPOKE to access EEPROM memory. Thanks Dave-CJ
  • Added RND for simple random number generation. Thanks Dave-CJ
  • Added TSECS for incrementing tenths of a second counter
  • Auto running of program from uSD card. Just name the program autoexec.bas and it will load and run on reset.

Filenames on the uSD card are 8.3 format and there are no checks on file extensions that you can use. Files are stored in the root directory only.

Still to do:

  • Filename handling is basic, only coded to prevent buffer overflows, format isnt checked.
  • No protection on setting I/O pins used by SRAM and uSD card. DOUT 4=0 will cause Syntax Error to be displayed for every subsequent command.

The sketch is available to download from, please note this required a Nanode with SRAM and uSD socket to fully work.

It requires a number of libraries to function:

One thing I have found is that when using Nanode with SRAM fitted, as this is a 3.3V board, the fuses set on the Atmega328P must be set correctly in order to prevent the board locking up. By default this is set to 2.7V but for a 3.3V board this can be too high, resetting it to 1.8V seems to cure this.

For those with suitable programmer, an alternative bootloader is available at This includes options for both 5V and 3.3V boards.

Migrating from EtherShield to EtherCard library

Important Note: I have now stopped development work on the EtherShield library
However, this is not the end for Arduino and ENC28J60 libraries. The excellent EtherCard library from Jeelabs. I have decided this is the library I am to use in my examples and future ENC28J60 developments.

As the two librariers are based on the same original code they share a lot of similarities. One being that I wrote the DHCP code that is used in both the EtherShield and EtherCard libraries. There are a number of things that need to be changed in your sketches in order to use the EtherCard library. These are documented below:

Header file


#include <EtherShield.h>


#include <EtherCard .h>

Library use


#define BUFFER_SIZE 650
static uint8_t buf[BUFFER_SIZE+1];
EtherShield es=EtherShield();


#define BUFFER_SIZE 650
byte Ethernet::buffer[BUFFER_SIZE];

ENC28J60 initialisation


// Initialise SPI interface
// initialize enc28j60
es.ES_enc28j60Init(mymac,8); // To specify CS pin
// es.ES_enc28j60Init(mymac); // To use default CS

es.ES_client_set_wwwip(websrvip); // target web server


if (ether.begin(sizeof Ethernet::buffer, mymac) == 0) {
Serial.println( "Failed to access Ethernet controller");

or, if using a Nuelectronics ENC28J60 shield to use correct select pin

if (ether.begin(sizeof Ethernet::buffer, mymac,10) == 0) {
Serial.println( "Failed to access Ethernet controller");

Allocate IP Address using DHCP


es.allocateIPAddress(buf, BUFFER_SIZE, mymac, 80, myip, mynetmask, gwip, dnsip, dhcpsvrip );


if (!ether.dhcpSetup()) {
Serial.println( "DHCP failed");

Allocate IP Addresses using static addressing

Define Addresses with

static uint8_t myip[4] = { 192,168,1,101 };
static uint8_t gwip[4] = { 192,168,1,1 };

Setup library with

ether.staticSetup(myip, gwip);

Resolve DNS Hostname


if(!es.resolveHostname(buf, BUFFER_SIZE,(uint8_t*)HOSTNAME ) > 0 ) {
Serial.println("Hostname not resolved");


if (!ether.dnsLookup(PSTR( HOSTNAME ) )) {
Serial.println("DNS failed");

Other Bits

You might want this bet next just to make sure ARP has been done for Router address:

while (ether.clientWaitingGw())

Main Processing


dat_p=es.ES_packetloop_icmp_tcp(buf,es.ES_enc28j60PacketReceive(BUFFER_SIZE, buf));


dat_p = ether.packetLoop(ether.packetReceive());

Sending HTTP GET Request


es.ES_client_browse_url(PSTR("/xyz.php"), "?search=Arduino", PSTR(HOSTNAME), &browserresult_callback);


ether.browseUrl(PSTR("/xyz.php"), "?search=Arduino", PSTR(HOSTNAME), &browserresult_callback);

General Packet Buffer Access





DHCP Lease Expiry



if (ether.dhcpExpired())

Setting alternative port for http server


ether.hisport = 1234;

There are more changes but these should cover most cases for now.

Still to address

The EtherCard library still needs a few updates such as:

  • Sleep mode
  • dodgy TCP implementation allowing only one packet before closing connection

Remote sketch upload to Nanode

Recently I made a presentation to the Nanode application development weekend to demonstrate how to send a new sketch to a Nanode. The idea is that the nanode is a network connected device and with a small addition to the ENC28J60 library it would be possible for it to act as a simple TFTP server and accept new code uploads or poll a remote server to check for updated sketches that can be downloaded.

The demonstration on the day conisisted of a Nanode with additional SRAM installed on the empty pads on the underside of the board. The nanode was also converted to run at 3.3V only as this is a requirement for the SRAM chip. The demonstration nanode had a modified bootloader that checked the SRAM for a magic number at the start and a code length. This then triggered the bootloader to reprogram the main flash. The compiled sketch in .hex format was transfered from a laptop to the nanode using a tftp client.

As detailed in the presentation, there are a number of options for delivering the updated code to the nanode, this was a simple proof-of-concept to demonstrate that once a sketch has been transfered to SRAM it is then possible to reprogram the flash with this new image. The actual delivery mechanism is likely to change in the future but the code in the bootloader should not need to change much.

There are still a number of issues to resolve, such as using an optimised bootloader to increase the available code space, add extra checks to make sure malicious code is not sent or recieved by the nanode.

The bootloader is still available from GitHub

More details and code to follow.иконииконописikoniсвети георги