Experimenting with a few things…

Posted: July 20, 2016 in General

Once again, time has gone on and I’ve not added much for a while to the site.  However I’ve been playing around with a few things which have been lots of fun.

So I’ll keep adding to this post a little at a time and take you through a few of the interesting things I’ve got my hands on…  No spoilers..yet..but a few really excellent things (at least I think so).

Using Micro-Python with the NodeMCU Board

As usual I’ve written myself some notes on getting this setup, and I fully intend to share (once I get time to write it properly).  However some very quick lessons learnt…

Lesson 1: Micro Python is very nice, and you can use a Python-like terminal with the device by connecting through the serial.  Very swish…but frankly no cigar yet.

Lesson 2: Micro Python with a Wifi device like the ESP8266 on the NodeMCU board is great…but remember the ESP8266 Wifi settings are separate to the firmware, so you may need to ensure it is set to station mode first, before the micropython firmware will reset it.

Lesson 3: When you get webREPL running…we are getting better  – developing over Wifi yes please!  If it isn’t running once you’ve programmed the firmware (which it wasn’t on mine) you’ll never be able to connect using the webREPL console page (which is a html page – you can download a local copy or visit http://micropython.org/webrepl/).  Don’t get annoyed it doesn’t work until you’ve started it!

Lesson 4: Use the serial python console to start webREPL on the device as follows:

>> import webrepl
>>> webrepl.start()
WebREPL daemon started on ws://
Started webrepl in setup mode

Lesson 5: You must connect to the device via Wifi to use the web console!  Connect to the device via the AP it provides “MicroPython-ffffff” with default password “micropythoN).

First time you connect via the console (using the address shown when it starts) you’ll set a new password.  Then reset the board and reload webrepl as before.

Lesson 6: Unless you want to always manually start webrepl use the boot.py file and upload it.  This will run on power up!


import webrepl

Lesson 7: Micro Python is a little annoying…it supports files so you can upload .py files and import them…BUT there is no editing via the webREPL console.  So edit and upload? No not quite!

Lesson 8: Uploading new files and “import mymodule” isn’t enough to update your code!  Import will not reload a module if it is already loaded…deleting a module (using “del mymodule”) will remove it but it is still cached so it will still not update.  WHAT A PAIN!

Lesson 9: After a few experiments (and a hint from @mnelsoneorm1 to checkout https://forum.micropython.org) managed to work out a way to do it.  Sometime later, I wrapped up all the useful bits into a util.py file, which I loaded at startup as well.


import webrepl
import util


def readfile(file="boot.py"):
  with open(file,'r') as thefile:
    data = thefile.read()

def delfile(file):
  import os

def reload(module):
  import sys
  del sys.modules[module]

Lesson 10: The upload might not upload a new version of your file…You may need to upload a different file first to ensure the newer one is reloaded into the browser.

Final lesson is NeoPixels are simply awesome (and deceptively easy)!


import machine,neopixel

def clear():

def all(val):
  for i in range(NUM):

def pattern(val1,val2,val3,val4):
  for i in range(NUM/4):

def demo():
  import time
  for i in range(10):


GPIO Zero Hero.

I thought it was time I took at GPIOZero by Ben Nuttall.  You can see my write up on my Guide to…Embracing GPIOZero.

This also includes a solution for using GPIO.BOARD (physical pin numbering) with the GPIOZero library.  The best part is that you can keep using GPIO.BCM (BCM numbering) by default and just enable GPIO.BOARD when required.  WIN-WIN-WIN!


GPIO.BOARD Physical pin number, just as it says on the tin.

Pi Zero USB-LAN Fan.

I’ve also been playing around with my PiZero.  Which still makes an excellent USB-LAN Device.  You can see the whole Pi-Kitchen process in my Using Pi-Kitchen to “bake” a Raspberry Pi Zero as a USB LAN Device video.


Smaller than a Bourbon????  Well not really (it is a super size Bourbon)


Pi-Stop to go.

Also, I’ve added some details of the Pi-Stop python module which I use in my workshops.


The Pi-Stop is plug and play!

This allows easy plug and play without the wires and hassles with pin numbers.  Just select one of the standard locations A, B, C and D (plus A+ and B+ for Model +/ RPi 2) and away you go!

A neat little HDMI screen.

I also got a nice little HDMI screen which although only being 5″ provides 800×480 resolution and a resistive touch screen.  The config will get added to the Pi-Kitchen in the next update (proto-type recipe is working well).


The screen is from Bandgood.com and was about £20 (GBP) and runs well via a standard USB power pack (surprisingly low power and includes a switch to turn off the back-light too).

It is perfect for my Pi-Kitchen testing since unlike SPI/I2C/DSI interfaces, it works well enough without extra configuration.  The additional configuration makes the display fill the screen and enable the touch screen.

This makes a Model A with keyboard a handy lightweight “kit-to-go” set-up.


That is all for now!  Enjoy.

Time…it just keeps on rolling…

Posted: January 18, 2016 in General

What a year it was for 2015.  Taking a look my blog I’ve not posted for quite some time, but I have been very busy with a lot of other stuff.

Here’s a quick overview of the latest things on the plate for today…

Book review…

First off we have a review of Learn to Program with Minecraft by Craig Richardson.  I had a go with it yesterday and introduced some Python programming to our family Minecraft actives.


Minecraft on the Raspberry Pi – a small keyboard and mouse is ideal for smaller hands!

PiZero enters the Pi-Kitchen and comes out a fully baked USB-LAN device

I’ve managed to package the required modifications to make a Pi Zero (and Model A/A+ Raspberry Pi) into recipes for the Pi-Kitchen.

For more details see the Git-Hub:


To get started use:

Pi-kitchen – Start Baking

See the following video to see the whole Pi-Kitchen process in action and some of the features that can be pre-configured ready for power up.


Some other things I’ve been playing with…but not had time to post about…


Pi-Stop workshop at Digimakers at the @Bristol science centre, along with a selection of books on show.


Movement tracking with the Raspberry Pi Camera module!

 And much much more!



Fun time @Digi_Makers!

Posted: February 28, 2015 in General

Just a quick post (after a long but very fun day)…

Firstly many thanks for all those who attended the Pi-Stop workshop, a super-bright bunch you all were!  Hope you all had as good a time as I did, I shall return will some more challenges next time.

The workshop materials are available on git-hub, along with other guides and information.

For those who had a browse of my books most should be available on Amazon – or for the No-Starch-Press books from their website)

2015-02-28 21.53.42

Good news, my book (and others) is currently 25% off at Packt Publishing (using code PRINT25 at checkout, valid until 6th March 2015).


I love hearing about how people are using the Pi-Stop to discover and learn, many thanks for sending me your stories of what you have got up to with them.

Remember you can now buy them directly from 4Tronix and also CPC Farnell.

I recently I was asked about using them with Python, well it was always my intention to produce a full Python workshop with the Pi-Stops, but I hadn’t quite got around to it.  Although there is the Python Pirate workshop, which I ran back on 29th Nov 2014, it used a rather specific python module for to make the Pi-Stop function as a lighthouse signal (lighthouse.py).

I decided it was about time I created a more general python module for the Pi-Stop.  So I have!

Check out the Pi-Stop Github for details and let me know how you get on with it (and feel free to add/request changes).  I shall add additional comments to the file and some additional tips on how to use it, but it should make a good starting point.

Get the module here: pistop.py

Note: It will work with the Raspberry Pi 2 (as well as Model+ versions – in all 6 locations).  But you will need the latest RPi.GPIO (version 0.5.11) for all the pins to work correctly.

Using the new Raspberry Pi 2 (or Model A+/B+) you can run up to 6 Pi-Stops independently, directly off the GPIO header.

When I get chance I’ll start writing some workshops which make use of it, as well as one which explains how it is constructed.


I recently received a copy of No-Starch Press to take a look at, as a huge fan of “Python for Kids”, I was very keen to take a look!

2014-12-19 07.26.46

Javascript for Kids looks like another winner from No-Starch Press.

Check out my review of “Javascript for Kids”.

The Pi-Kitchen project

The Pi-Kitchen is evolving from the manual process of placing files in the correct places to become a little easier to use (while still retaining the full flexibility it offers). The first stage of creating an initial collection of recipes is completed (lots more to come!), and now there is a brand new component, the “Bake” scripts.

The scripts are a stepping-stone to the final GUI I have planned for the Pi-Kitchen (this allows me to better understand what will be needed in the GUI and to ensure the system is suitable).

There is still a small amount of manual setup to get started, but it is now fairly minimal with the majority of the “Baking process” automated.


Check out the “baking” script on the Start Baking page, creating a full Raspberry Pi set-up right out of the box.


The new Raspberry Pi 2

What a surprise the release of the new powerful Raspberry Pi 2 was!  A quad-core ARMv7 cortex chip with the already awesome GPU and double the RAM thrown in to boot.

The new Pi2 is particularly interesting, for two reasons.

  1. For those of you who have looked at my book (Raspberry Pi Cookbook for Python Programmers) I dedicated  the whole of Chapter 5 to creating 3D worlds using the excellent Pi3D libary.

Chapter 5 of the Raspberry Pi Cookbook for Python Programmers is all about the hidden gem of the GPU.


While the 3D aspect of the examples showed the true power of the Video Core GPU, it did show that the original Raspberry Pi struggled with the calculations to feed the GPU with the data it needs to build complex 3D environments on the fly.  Once the 3D environments were built, the Raspberry Pi transformed into a high-speed smooth machine, allowing you to waltz around beautiful 3D environments without a stutter or blip.

I can’t wait to see how a much faster quad-core Raspberry Pi will do justice to the GPU…roll on the fun!

  1. A key element for the future of hardware and therefore programming and software design is managing multiple cores and multiple threads far more effectively and efficiently.  The new Raspberry Pi will provide an excellent opportunity for people to experience this, at a grass-root level and I feel this will be pivotal for the next generation of engineers.  This aspect of the new Raspberry Pi will be excellent to explore.

Oh, and it looks like the Pi-Kitchen also works with the new NOOBS 1.3.12 version which supports the Raspberry Pi 2 (although no doubt there will be the odd tweak here and there).