Monthly Archives: February 2016

Raspberry Pi 3 Spoiler

While waiting for my new Raspberry Pi 3 board to arrive so I can blog about it – I thought I’d jot down some thoughts following a conversation with a pal of mine in Canada.

Today, a new Raspbian release came out supporting the 64-bit Raspberry Pi 3.  Hopefully it will be completely backwards compatible – the first thing I’ll be doing is trying out my script and I’ll report back if there are any issues.

The new board has both Bluetooth and WIFI – and of course the thing here is that they are not using any of the 4 USB ports – which means you could be using a Bluetooth keyboard and mouse – and STILL have 4 USB ports available – that pretty much blows away most of the competition – just a shame none of those ports are USB3.

The new NOOBS installer, should you go down that route – now has Windows 10 if that’s your thing. I saw a preview today and it looks ok – apparently both released and insider preview versions are available.

The new 64-bit Arm A8  Raspberry Pi 3 looks once again to have set the bar – it could be that many will be looking at their newly acquired alternatives and pondering putting them in the bin.

Until the postman arrives tomorrow…


Raspberry Pi 3

Raspberry Pi 3So firstly, in case you’ve been on a desert island, what is a Raspberry Pi 3 and why do you need one right now?

The Raspberry Pi is a general purpose tiny computer with USB, Ethernet, audio, HDMI etc and this works using an SD card to store the operating system, for example Raspbian (Debian).

The Pi has had several generations now and the newly-released Raspberry Pi 3 takes the unit to the next level.

So why is it important? Those of you who read this blog will know I’ve looked at many similar boards – some more powerful than the Raspberry Pi 2 (the Orange Pi for example which is a LOT faster). To the last one however, they’ve been let down by lack of support and community. Just about all of them will run the various operating systems but some assume HDMI out only for audio – so if you’re using a 3.5mm jack you are stuffed. Others have everything – but almost no support for ports…all of those wonderful things you could do – if only they provided the drivers?

The thing that makes Raspberry Pi stand out is support and community. In Node-Red for example there are several GPIO nodes that work out of the box with the Pi yet none of them work with other devices without some major work.

The Raspberry Pi 3 then comes with some great expectations of compatibility. In my humble opinion, the original Pi was just too slow and too limited and I don’t really think the Pi Zero is a lot better – when we come to the Pi2 however, it works just fine doing all sorts of complicated stuff… but if you don’t want to use Ethernet you have to start messing with dongles, using up your limited number of USB ports… and a little more speed never hurts.

And so onto the Pi 3 – here’s what’s important:

  • 1.2Ghz 64-bit processor (A53) – in all around 10 times faster than the original Pi
  • Integrated WIFI and Bluetooth including Bluetooth 4
  • 400Mhz GPU (as against 250Mhz in older models)
  • Complete backward compatibility
  • Price as per Raspberry Pi 2 (which no doubt now will drop in price).

So, 33% faster clock rate than Pi2 and other enhancements give up to 50-60%  increase in speed over Pi2 – that is worthwhile. They have not increased the RAM which remains at 1GB which is a shame (having said that I’ve never run out of space yet).

Raspberry Pi 3[5]In case you are wondering about that “educational” label… I’ve been using a Pi2 to control heating and lighting now for a year – it has NEVER failed 24/7 (unless I put in duff code of course).  I am really looking forward to the Pi3 which I expect will arrive tomorrow. Note that the new model tales a little more power than previously and a 2.5amp supply is recommended (5v).  More on that soon.

If community support for the Raspberry Pi 3 is true to form, that support will immediately put power into your hands – something the competition can only dream of.

It’s their anniversary as well, the foundation came into being 4 years ago!

With recent new release of Raspbian and a brand new board there is lots to look forward to. I’ve just grabbed an image of Windows 10 for the Pi from my pal Peter Oakes and this should give it a bit extra kick.

More in a future article coming up “real soon”.


The Saturday Update

OmegaFor those interested – I’ve been quiet the last couple of days as we’re ploughing ahead getting the new office up and running – got walls up and ceiling almost done – got power and Ethernet in last last night and today we’re off to get wall sockets and worktops. I have to say I have never known joint aches like it!

The dangers of controlling stuff over the Internet became apparent last night as the heating went awol. At some point we realised we were roasting to death at about the same time as the Sky box indicated it has no Ethernet. It turns out that in the process of wiring up Ethernet for the office, we’d uncovered a flaky connection to the main access point which provides all the ESPs with connectivity and feeds the Sky box. 

Still – though it took until 1am in the morning to find the problem, at least it’s a clean problem with a clean solution – replacing an RJ45 connector.

Anyway a package turned up for me yesterday which I’ve not had time to do anything with yet - the Omega and a bunch of peripherals – so expect a review coming up soon.


Nextion Progress

Things have come quite a way since my first stab at using the Itead Nextion displays with an ESP8266. I now have a fully working thermostat display running on MQTT – but I’m beginning to wonder if 56KBaud is pushing it a bit for the software UART. Now that I’m pushing a reasonable amount of information onto the little display, I’m very occasionally seeing small glitches in incoming information when pushing buttons. Not enough to worry about but perhaps drop the speed down a notch.

Original Nextion Display

New Nextion Serial Display


From Zero to Star Trek

Or controlling your IOT by voice.

Star Trek Communicator2 days ago I was no-where with this – and today I “stand on the cusp” of having full voice control with just one minor issue bugging me – and as this subject has received so much attention I thought I’d better try to move people on to the matter at hand as most of it is resolved.

If you don’t have an Android device – or home control or MQTT – probably best to read no further.

Having defined my audience…. we’ll move on.  I started looking for some means to divert Google Now and the general speech recognition of Google to actually controlling something as against finding things on the web.  I put up an article in this very blog – and the number of responses was amazing. Clearly this is of interest.

So, the basis of this is that you have some kind of home control and that you are running or thinking of running Node-Red on some device (PC, Raspberry Pi, whatever) to control stuff. Much experience has led me to believe this is definitely the way forward, having the very reliable Node-Red as the central point to control everything. We’re talking I/O from ESP, Arduino and a host of other hardware gadgets and talking to them and Blynk, websockets, Email, Pushbullet, database, you name it.

So I can control stuff (as you’ll see in other items in the blog) using websockets, Blynk, Nextion serial displays and a host of other stuff – but up until now, controlling by voice was not on the cards.

It is now!

Starting with an HTC ONE M8 phone in my case, I added the following items:

  • Autovoice
  • Tasker
  • MQTT Publisher Plugin

There is little initial setup to do – just load these onto your phone. The first two are not free (but are dirt cheap) – but Tasker is SO useful you’ll want it anyway if you don’t already have it – what a bargain.

AutoVoiceSo the general idea here is to have a program trap the return information from Google – let’s say I were to say “execute lamp on”. I could make that a phrase to search for but that’s a bit restricting… so you can set Tasker+Autovoice to look for “execute”. I picked that word as it is easily recognised and I can’t imagine wanting to search for “execute” otherwise.

So depending how you go into this – you might say “Ok Google, Execute lamp on” or you may just press the little microphone button then say “execute lamp on”.

So what I wanted to achieve and DID achieve thanks to perseverance and a lot of help from you guys – was to get “execute” trapped – and then get “lamp on” passed to Node-Red via MQTT for further processing.

Before we get into the phone bit let me tell you about the Node-Red bit.  Many years ago I designed a package to let others write simple text-based adventures and though that may seem a little wasted now it helped me make some good decisions when it comes to how Node-Red handles the text.

Google liked phrases that make sense – whereas we want the minimal.  I wrote some code for Node-Red which you’ll see below (and this is just the start – trust me).  Let’s say I want to turn the heating up, down, to a specific temperature or just to auto.  So there are FOUR variations here and one of them involves a variable number. That could get messy.

In addition I’d like to be able to speak in English for the sake of my good lady who might have trouble remembering limited sets of instructions.

So what’s needed is the ability to say “execute set the heating to 15 degrees”.  What the computer wants is “heating 15” – preferably as 2 arguments.. the easiest way to do that is to separate the LAST argument off.

Here’s what I’ve done – you’ll no doubt immediately think of variations.

In a function in in Node-Red..

msg.payload = msg.payload.replace(/the /g, '');
msg.payload = msg.payload.replace(/to /g, '');
msg.payload = msg.payload.replace(/degrees /g, '');
msg.payload = msg.payload.replace(/degrees/g, '');
msg.payload = msg.payload.replace(/turn /g, '');
msg.payload = msg.payload.replace(/to /g, '');

var incoming=msg.payload.split(" and ");

var msg2 = {
payload : "",
topic : ""

var msg3 = {
payload : "",
topic : ""

for (var a=0; a<incoming.length;a++)
var lastIndex= incoming[a].lastIndexOf(" ");
var leftbit = incoming[a].substring(0, lastIndex);
var rightbit = incoming[a].substring(lastIndex+1,incoming[a].length);

switch (leftbit)
case "salt lamp" :
case "salt":
msg.payload="Turning the salt lamp "+ rightbit;
msg3.payload="salt "+rightbit;
node.send ([msg,msg2,msg3]);

default :
msg.payload="I do not understand "+ leftbit + "?";
node.send ([msg,null,null]);

So – given the example “execute turn the salt lamp off”…   Node-Red never sees “Execute” it only gets “turn the salt lamp off”  I have a function to control as it happens, an Orvibo socket (dealt with elsewhere in the blog) and as it happens it is expecting “salt on” or “salt off” as a message.

In the function above I have 3 outputs – one to a speech synth (Ivona – again dealt with earlier), the lamp and MQTT. Normally I’d just do everything by MQTT so don’t take this too literally.

First things first – remove un-necessary words for example “a”, “the”, “turn”, “degrees” etc. You could do this  the other way but then you have to cater for numbers etc.

Then split the sentence on “ and “ and loop through the parts. For each part split off the LAST word as this is your argument “on”, “off” or a number.

And so now we can handle (‘ve only implemented salt lamp above but heating etc trivial to add) “execute turn the salt lamp on and the heating to 22 degrees”.

That comes down to two sentences… “salt lamp on” (or “salt on”) and “heating 22”

These are then easy to parse in a SWITCH statement, passing any voice (to come out of your speakers somewhere), any direct control – and MQTT messages.

Absolutely works a treat and if it has no idea what “turn boiler off” means it will say “I do not understand boiler”  - similarly one could provide witty responses to invalid parameters “you must be kidding – heating at 5 degrees??”.

So all of that works – and it just ITCHING for further development which by the time you read this it will likely be getting – I’ve already stopped twice to get to the code you see above as I kept thinking of better ways. And please don’t say “you can do this all in Tasker” – I LIKE working in Node-Red.

You may by now be asking what the catch is? There isn’t other than one tiny item bugging me…. I hope to get responses as to how to fix it.

Autovoice/Tasker is listening to what I have to say and sending all but the command word to MQTT – reliably – from power up – no problems.

However and some of you have touched on this – depending on what I say after “execute” it may just pass on the material to MQTT and hence to Node-Red – OR it may first display something on the phone or even Google may have a bash at responding – usually giving up after the first word or so.

I’ve seen your GREAT responses… so before we start, re: Tasker etc.. yes, I’m running Tasker in the foreground, yes I have “Autovoice Google Now integration” turned on. “Do Google Now Search” is disabled.

In other words, pretty much all of the things that are SUPPOSED to stop Chrome+Google sneaking in and saying something or displaying something  - which does happen – but occasionally just a tad late – as if Tasker was not quite getting in there quickly enough to stop things.

Ok so having installled AufoVoice, Tasker and the MQTT plug in – here is what I’ve done – some of you might want to follow my lead – hopefully someone else will say “OH WELL THAT’S WHY YOU’RE HAVING A PROBLEM”  - whoever you are I am sitting here waiting to hear from you.

Open up TASKER… Select a new Event – plugin – Autovoice

1 2 3

After Autovoice you want the RECOGNISED option at the bottom of the menu (was just offscreen on my phone)

4 5 6

After recognise, you want “speak filter” – and in there say “command” or whatever clear, unambiguous word or phrase you want to use. When done – tick “contains all” and tick that box at the top. You are now done with the recognition bit.

7 8 9

So then you should be asked for a new TASK – if not – ask the people who desgned Tasker because it worked for me (I’m doing all of this from scratch now as I build up this blog entry).  Give the task a name – I chose to call it MQTT. Call if FRED if you like. Then you need an ACTION for that task.

10 11 12

Select the MQTT plugin which just appears by magic (assuming you installed it). Fill in you MQTT details – you need address and port, user and pass (if you have a user and pass of course – some don’t but then I would not be using this out of the house if you don’t) and I used the TOPIC “voice”.  The payload is


What happens there is that gets replaced by all the text in your phrase EXCEPT the keyword or phrase.

Hit Accept and if you’ve not messed up that’s it.

I then chose to add another ACTION (not task) – a BEEP – that’s PROFILE – click on the green MQTT next to the profile – then hit + and select ALERT then BEEP and make it 8Khz and 1000ms or less (but not 1ms as you won’t hear anything.


Back out of all of that – press the mic button, say “command turn light on” – and back in your node-red you should have some text coming on in MQTT. You might want to test that with an MQTT client listening for “voice”…

Now – given the above – does anyone know how to make changes so that Google does not try to interfere with this – it never stops the command working but seeing a brief flash of screen or a brief unwanted word – could do without that.

SO – I THEN took the phone (which has good mics) – put it on the wall and from the other side of the room tried “command turn salt lamp on” – and it worked. GRANTED it’s not that big a room – and the wife is in the USA right now and the TV was off and we don’t have dogs.

Star Trek here we come. Once someone gets me out of my final misery and stops the occasional Googleisms, I’m adding heating control (3 fixed – up, down, auto and one variable – ie 22).   You could do the same with lamps (on, off, up, down, auto) etc… and if you make it so big that it slows down your Raspberry Pi – get something faster!!! The sky is the limit. I do this on a Raspberry Pi 2 with a fast SD – no problem – that and 100 other jobs.

So as an alternative to the BEEP – you could setup Pushbullet and have Node-Red send you a message when it gets a valid command – that way you know for SURE that something has happened.  And that is in fact what I have now done – having experimented with lots of MQTT clients for Android all of which seem less than reliable to put it mildly.

If you are interested - makes sure you SUBSCRIBE to this subject even if you don't wish to comment - to make sure you get regular updates!


Coding the Nextion

At the risk of repeating myself (apologies to regular readers for this first para) the Nextion display is in fact a range of touch-LCD displays from small to large.  The thing they all have in common is a a complete programming environment where, by downloading a desktop graphical tool, you can lay out the display, what it will show and how it will respond to button presses. All of this happens serially so that you program it serially via, say an FTDI (usb-to-serial interface) and when you’re done and a button is pressed, serial output is sent back out to your application and you do what you want with that.


So first things first – what it IS, is an excellent low-cost way to get visual controls onto your IOT device. What it is not, is fun to program. There is a language interpreter built into both the display itself and the desktop “debug” simulator – and I would summarise by saying that it is probably the worst interpreter I have ever experienced since Bill Gates 5K BASIC back in the 80s.  However, it works – and with a little effort you can soon bypass the inefficiencies of the interpreter and get the job done.

NextionA friend of mine and I have been looking to use these in our IT projects for some time – and while a serial interface is great, it isn’t much use if you just want to stick a thermostat control on a wall 2 rooms away from where your controller is.

As many of you know I’m a Raspberry Pi/MQTT/Node-Red fan and so everything I do is oriented towards making peripherals that will talk via MQTT protocol, wirelessly back to the Pi – hence my interest in the SONOFF units as they are a VERY cheap mechanism for controlling lights etc – using my own software or that of others which you will have seen in here.

And so it was that Aidan and I set about making a little board to go on the back of the Nextion – the first one came back from the Chinese supplier with the top grounding disconnected – that gave us the opportunity to do a MKII which we’re expecting in a week or so which we actually think will make a GREAT general purpose board for experimenting with the ESP-12… but more of that later.

So – we’ll not concentrate on the communications angle here but on how I managed to get the nice buttons.  That entire display is actually put together from TWO images – thanks to a feature of the Nextion called CROPPED IMAGE

In the Nextion EditorOne apparently BIG problem with the Nextion displays is their inability to handle transparent PNG images – like round buttons. On the surface this might be fine if you have a static background colour and can match it around the edges of the button  -but this is often not the case. In order to work with limited processing power (and I suspect the limited programming ability or program space if the interpreter is anything to go by) they like to handle rectangular areas – these are easy to move about at high speed.   But they have come up with a good solution to this – the cropped image.

So let’s say you make 2 images – one with everything turned OFF and one with everything turned on.  A BUTTON can be a rectangular area with text on it – which looks ABSOLUTELY AWFUL – or it can be a CROPPED IMAGE – showing part of the chosen image depending on the state of the button. So a rectangular area over a round button showing a window into the overall ON image or the OFF image will give the impression that only the rounded area is changing – and you don’t have to worry about gradiated backgrounds etc.

Two imagesYou’ve seen the video – now here are my two images used to construct the display.

In essence you use a basic image with everything shown turned off – i.e. the buttons are nothing more than a single image – in my case a pair of Powerpoint images – I use Powerpoint as it is easy to align images,

Use of the second image – with everything turned on – is controlled by the Nextion itself – that is selectively showing parts of that second image as needed – of course this is just a very BASIC example – you can have multiple pages, you could programmatically select more than just 2 alternatives (3 state button or LED… and the Nextions – if you get TOO ambitious – can handle an external SD for even more images. A cheap throwaway 256Meg SD holds quite a few images.

Thanks to advice from friends and people in here I found quite a few images – I put a link in the comments to a previous article – any transparent PNG images can be pulled into Powerpoint or similar to make up your basic pages  - the cropping ability of the Nextion makes it possible to turn this into a dymamic display.

And so we come to the Nextion interpreter which is HORRIBLE.   How do I get a button press (dual-state button) to send out the right info – this might look like a mess but when you get into the Nextion editor and have a go – you might thank me for this  - no it isn’t my lousy programming that makes it look like this and no you can’t put it all one one line and yes, amazingly you can’t have a space after the IF statement – I’ve thought of volunteering to go over and help them with the interpreter!!! But it works so once you’ve done one – it’s a copy and paste job.

printh 70
print "nodered~tog4="
print "0"
print "1"
printh ff ff ff

As that data comes out of the Nextion, my ESP software picks it up, sends the message out over MQTT and triggers a timer for the little cheap phone buzzer for haptic feedback.

When we get our new boards and I get my office put together – I will endeavour to go into that side of the project – as I see a lot of future in this as a high quality, wireless touch display.


Node Red Grandfather Clock

So I was thinking about all those wasted cycles on my Pi – which is speech and MP3 equipped,

As I sat quietly coding (my wife Maureen is in the USA right now) listening to the hard disk on the Sky box chunking away (well, when they said you could replace the disk with a 1TB disk, I never thought about ordering a specially quiet one)…. I found this..  new ideas are flowing into my head by the second.


Free Dials and Buttons

I wonder if we can all do each other favour here.  Every time I go looking for buttons, slide switches, gauges etc for my projects – like the Nextion – at least 90% of the so called FREE ICONs and PNGs – by the time you get to it – it’s owned by Getty and Corbis or similar and they want ridiculous amounts of money for them.

Can those who have links to DECENT, free home-control/IOT style icons please put links in here so they’re all in one place… 

I found these,,

But they are PSD and I’m afraid GIMP really does not like them – large transparent PNG files like this would be marvelous – the first set of on-off buttons on that page look great – and free but I for one don’t have the tools to turn them into transparent PNG……


IOT Speech recognition

Here’s a thought – now this might be available – but I can’t find it..

Most of us have phones – some Android, some Apple, few Microsoft. So sticking with Android for now – the latest Android phones (I have the HTC One M8 with Android 6.0 which is marvellous) handle speech recognition well.  “Remind me to turn the cooker off in 5 minutes”.  Mind you it never did actually remind me but never mind.

So all of that works.. but what would be REALLY NICE – if the same exact thing could recognise “NODERED”..

So how about “NODERED turn kitchen light on”.

ALL that is needed is for that entire sentence – but only sentences that begin with NODERED – to end up being sent by whatever – MQTT maybe – to the Node-Red installation – from there the most trivial of line parsers could figure out what you were trying to achieve – and do it for you.




Enter the Pixie Pro

This morning I went off to the post office to pick my new new Pixie Pro – making sure that the tax man got his share and that the post office got their rip-off “handling fee” of £8 – yes that’s £8 pounds not dollars.   Not that you have any alternative but to let them “handle” the package. You’d think the government would give them some of the duty or VAT!

Anyway I digress with my deep-seated dislike of being ripped.. Opening video – well, you have to have an opening video..



The Pixie Pro – so firstly – this is NOT one of the cheapest small PC boards  indeed for the cost of it you could buy 2 or more of the others – but then it is not just another Raspberry Pi!

Heatsink on the Pixie ProMy Pixie Pro came with a HONKING great heat sink – which bearing in mind that my Orange Pi could cook eggs, is a welcome addition. This will end up in Spain with me where it gets very warm and so a cool running board is a good start. 

Taking a look at the specification, not 512meg of 32 bit RAM, not one gig but 2GB of 64-bit DDR3 RAM!! The processor offers a quad-core ARM Cortex A9 running at 1Ghz plus 2D and 3D GPUs. The wireless interface is described as state of the art, offering 802.11b/g/n/ac. Bluetooth 4.2, NFC, GPS and mobile broadband interfaces.  Not your average Pi then.

Underside of Pixie ProThe board measures 52mm by 91mm and has 2 USB type A ports, one OTG port, a micro-HDMI output, 2 microSD slots and a 3.5mm line out with TOSLINK optical.

No, I’m not finished – Gigabit Ethermet, PCIe, SDIO, 2 MIPI, SATA II, RGB555, USB2.0 HS, CAN, SPI, 2 Uarts, 2 I2c and several GPIO ports.

I’m done now.

So there it is – a veritable powerhouse – but is it any good – that will be the subject of my next related blog – you can have as much power as you like but without the software -  what use is it?  Now, normally I tend to put Debian on these things but I’m half inclined given the claims above, to start with Android.  Until the next time.


Cheap Raspberry Pi

Now before you say anything – they don’t even know I’m writing this!!  Remember when I was in Chicago a while back (well, you’ll only remember if you’re a regular reader)… I bought a Pi Zero and a Raspberry Pi dirt cheap at somewhere called MicroCenter in Chicago.

Well they’re at it again.

So my question to British dealers is – when are you going to get your fingers out and offer us Brits deals like this – that’s £21 for a Raspberry Pi 2  all in…

I didn’t think so. PC World £29.99, Gearbest £27.28, Amazon £29.99 –