Raspberry Pi Pinout Command with GPIOZero

raspberry pi gpiozero pinout commandPictured above is a screen capture showing a new (late July 2017) feature of GPIOZero for the Raspberry Pi – pinout – which shows the status of the general purpose input/output pins of the Raspberry Pi and additional useful information about your Pi.

Simply enter pinout at the command prompt. If the command is not recognised, do a sudo apt-get update; sudo apt-get upgrade to update your Raspberry Pi and GPIOZero software to the latest version, and it will then work.

Click here for full details from the command-line tools section of the GPIOzero docs.

New Raspberry Pi Zero On Sale

Raspberry Pi ZeroPictured above is the new Raspberry Pi Zero available for just US$5 or £4.

This stripped down Raspberry Pi is the lowest power consumption version yet at just 160mA or lower at 5VDC.

It has one micro USB connection for power input, and one for connection to peripherals such as a USB hub (for connection of a keyboard and mouse etc) or for a WiFi dongle for headless applications.

The standard Raspberry Pi HDMI port has been replaced with a mini-HDMI port, there is no ethernet, no composite video (although headers are supplied), and even the 40 pin GPIO header is not supplied.

As with the more recent Raspberry Pi models, a micro-SD card port is fitted for you to load your operating system of choice.

The Raspberry Pi Zero has a single-core BCM2835 processor overclocked to 1GHz, and 512MB of on board RAM. This offers three times the performance of the original Raspberry Pi at less than one-quarter the price.

The price of the Raspberry Pi Zero is so low that it competes with even the cheapest Arduino clones, even when the cost of a micro-SD card and GPIO headers is included. It is still more power hungry than an Arduino, but offers much more functionality than any Arduino board.

Raspberry Pi Zero is half the size of the already diminutive Raspberry Pi A+ coming in at a tiny 65mm x 30mm x 5mm and weighing just 9g.

Raspberry Pi cable adapters and GPIO headers

Pictured above is a bundle on offer comprising the GPIO headers, a micro-USB adapter and mini-HDMI adapter offered for £4 at the Raspberry Pi Swag Store. With this bundle or equivalent, you can connect your Raspberry Pi Zero to a television with a standard HDMI cable and plug in a standard USB hub.

New Raspberry Pi 2 Model B – Six Times More Power

The new Raspberry Pi 2 Model B has just been released, and promises to be six times more powerful than the previous Raspberry Pi models.

Raspberry Pi 2 Model BThe original Raspberry Pi was released around 3 years ago, and since then technology has moved on and competitors have joined the marketplace. The single core 700MHz processor and 512MB of RAM of the recently released Raspberry Pi A+ and B+ make them feel quite sluggish and out-dated, and there are many applications which cannot be used as they run so slowly.

The new Raspberry Pi 2 Model B though has a quad-core 900MHz processor (ARM Cortex-A7) with a full 1GB or RAM,  effectively turned the Raspberry Pi into a low spec PC capable of running the new Windows 10 (which will be offered free of charge for Raspberry Pi to makers!) and the full range of ARM Linux distributions.

The new model is fully backwards compatible with previous models, it will just run everything much faster. You just need the new ARMv7 kernel version of Raspian, and all existing projects will work.

Amazingly, despite the huge lift in specs, the new Raspberry Pi 2 Model B will still be sold for just $35 (around £25-30 in the UK).

Get yours now (in the UK) at cpc.farnell.com.

New Raspberry Pi Model A+

Pictured below is the latest Raspberry Pi – the Raspberry Pi Model A+ which replaces the old Model A.

Raspberry Pi A+ ModelAs with the Raspberry Pi Model B+ released back in July 2014 (see here: New Raspberry Pi Model B+), the Model A+ has the 40 GPIO pins, reduced power consumption, modified composite video, and a micro SD slot, but the Model A+ still only have 256MB of RAM compared to 512MB for the B+.

The Raspberry Pi Model A+ is smaller than all previous credit card sized Raspberry Pi’s being a whole 2cm shorter in length.

With just the one USB port and no ethernet port, if the Model A+ is to be accessible over your network, you will need a USB WiFi adapter as pictured below installed in the A+.

Raspberry Pi A+ Model with USB WiFi Module

It is likely that the Model A+ will primarily be used as a headless device, but initial set up of Wi-Fi still requires a keyboard and display to be connected – a USB hub is useful at this time. With everything configured, the Model A+ is ready for embedding in your projects.

The following is a very useful guide from How-To Geek which shows how to set up Wi-Fi from the command line: How to Setup Wi-FI on Your Raspberry Pi from the Command Line.

The Raspberry Pi Model A+ is available in the UK for around £17, considerably cheaper than the £27 Model B+. (Both best priced from cpc.farnell.com)

Raspberry Pi-Mote Mains Control

We are currently reviewing the Pi-Mote from Energenie. This is a small Raspberry Pi compatible radio transmitter board which can control up to four 13A mains sockets. We are reviewing the starter kit which includes two radio controlled sockets and the Raspberry Pi transmitter board (pictured below).

Raspberry Pi Pi-Mote Transmitter BoardThe Pi-Mote simply plugs onto the GPIO pins of the Raspberry Pi (compatible with both Raspberry Pi B and B+ but for the B it takes up all of the GPIO pins) and then a simple provided Python script is run on the Pi to supply an identifying control code to each of your sockets so you can subsequently toggle them on or off individually (or all at the same time) as and when you desire.

We sell a lot of low voltage controllers designed to be used to control mains powered devices – e.g. pumps in solar water heating pump controllers and in rainwater toilet flushing systems, immersion elements, motors, lighting, heaters, coolers, etc. The benefit of the Pi-Mote is that it is completely unnecessary to mess around with any mains wiring – you just plug the mains powered device(s) to be controlled into energenie radio-controlled sockets, and then use software on the Raspberry Pi to control the devices remotely.

Energenie raspberry pi controlled mains socket

We will be conducting a thorough review of the Pi-Mote and writing some Python scripts to provide some real world examples of its potential uses for a detailed article coming soon on the REUK.co.uk website. In the meantime, click here for more information or to buy the Pi-Mote Starter Kit now.

DS18B20 Temperature Measurement with Spark Core

In our blog post Spark Core Introduction and First Impressions we introduced Spark Core – a Wi-Fi enabled Internet of Things device which can be programmed like an Arduino and accessed via the internet.

Spark Core Wi-Fi Open Source IoT development board

Of most interest to us at REUK is using Spark Core to enhance our range of solar water heating controller adding datalogging and internet functionality. Therefore we want to access temperature readings from DS18B20 digital temperature sensors of the type used in our 2014 Solar Water Heating Pump Controller connected to Spark Core.

As a test we connected a DS18B20 temperature sensor to the Spark Core. Pin 1 of the sensor connects to GND, Pin 3 to 3.3V, and Pin 2 to a digital pin on Spark Core – we randomly chose D2. Finally we connected a 4K7 resistor across Pins 1 and 3 of the sensor and entered the following code via the Spark IDE to flash to the Spark Core:

#include "spark-dallas-temperature/spark-dallas-temperature.h"
#include "OneWire/OneWire.h"
#define ONE_WIRE_BUS 2
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensor(&oneWire);

float temperature = 1.0;
char myStr[10];

void setup() {
 Spark.variable("read", &myStr, STRING);

void loop() {
 temperature= sensor.getTempCByIndex(0);

At the time of writing (August 2014) it is not possible to have a Spark.variable which is a float – the code just will not compile – so the temperature measurement from the sensor (which is a float/double) must either be saved as an integer (losing accuracy due to rounding) or be converted into a string (which is what we did above to three decimal places with the sprintf function) so it can be accessed remotely.

We then wrote the following Python script on an internet connected Raspberry Pi to grab the temperature measurement once every minute and to append it to a text file for datalogging and later analysis:


import urllib2
import json
import time

var = 1
while var == 1:
   response = urllib2.urlopen('https://api.spark.io/v1/devices/YOURDEVICEID/read?access_token=YOURACCESSTOKEN')
   html = response.read()
   reading = json.loads(html)
   temperature = reading['result']
   with open("core-temp-log.txt", "a") as myfile:

The string variable read is the string conversion of the value read in by the temperature sensor.

Having got the Spark Core successfully reading data from a DS18B20 it is possible to fully replicate our Arduino based solar water heating pump controllers with the added benefit of internet connectivity and effective remote datalogging.

See our Raspberry Pi related articles Publish Temperature Sensor Readings to Twitter and Temperature Logger with Xively to find out how to automatically publish your collected data to the internet – either as a Twitter feed or with Xively as an online datalogger with graph plotting etc.

Size Comparison of Pyboard with Raspberry Pi and Arduino UNO

We have just received our Pyboard – a prototyping platform that runs Micropython which is an implementation of the popular Python programming lanuage.

Micropython PyboardAbove is the Pyboard in the hard shell padded case in which it arrived. It looks to be very well made, sturdy, and best of all, physically very small.

Size comparison between Pyboard, Raspberry Pi B+ and Arduino UNOThe photo above shows just how small the Pyboard is in comparison with the Raspberry Pi Model B+, and an Arduino UNO.

We have lots of projects in the pipeline for which we would previously have used a Raspberry Pi, but the simplicity, size, and much lower power consumption of the Pyboard will often make it the obvious option.

New Raspberry Pi Model B+

We have just received our new Raspberry Pi Model B+. This is not the Raspberry Pi 2 or C (which is likely to be released in 2017), but is instead a Model B with a few very useful changes and additions.

Raspberry Pi Model B+

The biggest addition is a further two USB ports bringing the total up to four USB 2.0 ports. This is particularly useful since a mouse and keyboard would use all the ports on the Model B leaving no ports free for thumb drives, and other peripherals without the use of a secondary powered USB hub.

Raspberry Pi B+ can now be configured to output a total of 1.2 Amps in total (0.6A by default) from its USB ports (assuming a good quality 2A power supply is used). Therefore external hard drives can be used without the need for a powered hub.

The original SD card slot has been replaced by a micro-SD card which means no more SD card sticking out of the Raspberry Pi, and it is easier and cheaper to buy micro-SD cards.

A further 14 GPIO pins have been added to the 26 pins found on the Raspberry Pi Model B for a total of 40 GPIO pins for hardware projects. The layout of the first 26 pins has been kept the same for backwards compatibility.

Finally, power consumption has been reduced a little, sound quality has been improved with the audio connector changed to integrate composite video, and the overall layout of the board has been changed and mounting holes added to the corners of the board.

The processor and RAM (512MB) remain unchanged.

We will be doing some interesting projects with our new Raspberry Pi B+ over the next few weeks and months to make use of the additional functionality offered by this new model.

Pyboard Python for Microcontrollers

Pyboard python for microcontrollersPictured above is the Pyboard – an open source prototyping platform designed and manufactured in the UK. This board with its ARM microcontroller (STM32F405 clocked at 168MHz) is programmed using micropython a low memory usage version of the Python 3 scripting language.

The board has LEDs, microswitches, a built in accelerometer, and 30 general purpose IO connections (including 4 PWM, 14 ADC, I2C, and SPI pins) for connection to external components and analogue/digital sensors for your projects.

The board has 1MB of on board flash memory, 192KB of RAM, and also a micro SD card slot which can be used to store scripts and hold project generated data. It has a built in USB interface.

Pyboard fits in the marketplace somewhere between Raspberry Pi and Arduino. A Raspberry Pi is a full computer which means that it can be complicated to use, power hungry, and large in size. An Arduino is simple to use, has lots of useful GPIO and shields, and they are available in small versions, but they are not very fast and scripts need to be compiled on a PC before loading them to the Arduino. Pyboard is perfect for processor intensive stand alone projects – particularly for anyone who already has experience programming with Python.

Pyboard is just 33 x 40mm in size and weighs just 6g.

The official Micro Python website is here, and the tutorial which shows how to get strarted with Pyboard and Micro Python is here: Micro Python Tutorial.

Raspberry Pi GPIO Sensor Readings to Twitter

We have just published a new article Publish Temperature Sensor Readings to Twitter with Raspberry Pi to the REUK.co.uk website which includes full details on how to get sensor measurements from a Raspberry Pi up to the internet for remote viewing.

Raspberry Pi and TwitterWe will soon be returning to this to look at how batteries can be monitored, solar generation can be monitored, and many other similar projects.

We will then be showing how devices can be controlled from Twitter – for example, you could turn on your immersion heater element with a Twitter message if your Twitter feed tells you that your water tank is cold and you are on the way home and would like a hot bath.