Monthly Archives: February 2015

ESP8266 MQTT and the UART

I wonder… those of you who have used the excellent MQTT software (stand-alone – not the LUA version)… I need to do two things – one of them is giving me problems but is no doubt trivial – the other I’m hoping someone has already solved.

Ok, so I’m using the MQTT software and I’ve added my own drivers… and that’s fine.

There is a function call INFO which prints stuff to the serial – I want to optionally turn that off. Here’s the DEBUG.H file.

#ifndef USER_DEBUG_H_
#define USER_DEBUG_H_

#ifndef INFO
    #define INFO os_printf

#endif /* USER_DEBUG_H_ */

That’s simple enough – INFO function simply is the os_printf function. So I figured I’d put my own function in which I could control.

#ifndef USER_DEBUG_H_
#define USER_DEBUG_H_

#ifndef INFO
    #include <stdarg.h>
    void ICACHE_FLASH_ATTR petes_debug_print(char *fmt, … ){
     // if (debug==0) return;
      va_list args;
      va_start (args, fmt );
      os_printf(fmt, args);
      va_end (args);

    #define INFO petes_debug_print

#endif /* USER_DEBUG_H_ */

Looks simple enough but this will NOT compile – stating that the function is being redefined… ie (petes_debug_print) –  this occurs NO-where else – I have of course tried a different name just in case I’m living in an alternative reality – no matter what I do it says it’s being redefined – and yet the IFNDEF should be stopping that.

Anyone know what I’m doing wrong?

Secondly – in the MQTT code – only UART out is used…. uart IN is not – and what I’d like to do is have an Arduino send a suggested MQTT subscription… for the life of me I can’t get my head around how to simple check for incoming characters…’


FTDI Bricked Chips Fix

I odn’t know if I’ve been in a cave for the last few months – I certainly have for the last couple of weeks (literally), but when I came to program my little ESP8266 boards using the only trusty FTDI chip I have here in Spain (and as you can imagine they don’t sell them at the corner shop) – I was mortified to find that the FTDI board didn’t work.

Well, it did not take long to realise that I’d missed one of the biggest scandals of modern times, the bastards at FTDI have DELIBERATELY put out an update for Windows that BRICKED counterfeit chips (now removed but too late, the damage is done).. HOW THE HELL ARE WE END USERS SUPPOSED TO KNOW??? How many people out there go and buy a car and get the manufacturer to sign a document to state that every single component in there is genuine?  I thought not. Think of all the schools who will have bought this kit on a budget, totally unaware of what was about to happen mid-lesson!!

So it turns out there are a number of counterfeit versions of the large chip you see on typical FTDI boards – and the Windows update has been deliberately BRICKING them – I would imagine this will bankrupt the company once a large manufacturer sues the ARSE off them.

Anyway, after spending the afternoon reading this up – it turns out the product ID is set to ZERO in the internal EEPROM.  Windows can neither make use of this NOR can Windows 8 do anything about it – but Linux can – and guess what, I just happen to have a RASPBERRY PI 2 here with me.. .i.e. a Linux computer.

I scoured the web, one guy offered a solution for Windows – didn’t work as Windows can’t even SEE a device with product ID 0000… so that went out of the “window” – another fellow wanted you to download something to a Linux machine but didn’t say where. That would be fine for most Linux users but I wasn’t suer – anyway here’s his blog.

Finally after much searching I found this.

It didn’t work – the last line was wrong somehow. but comparing the two I could see what was wrong in that last line from the OTHER blog… and so…

Firstly plug the knackered FTDI board into your PI and try this..

$ lsusb

You’ll see a line with a reference to the board and a PID of 0000.

$ sudo apt-get install make gcc libftdi-dev
$ wget
$ tar -zxvf ft232r_prog-1.24.tar.gz
$ cd ft232r_prog-1.24
$ make
$ sudo ./ft232r_prog –-old-pid 0x0000 -–new-pid 0x6001

So… unplug the board, plug it back in, run this checker again..

$ lsusb

and hopefully, Voila – Bob’s your uncle – worked for me. I unplugged the FTDI – plugged it back into Windows and…. started blowing Arduino programs once again just like the good old days.

I’d like to say at this point – I do NOT condone piracy, the company obviously worked hard to make a chip and a driver to work together – so I’d say this – don’t consider this a long term solution. Go out and buy a proper board. BUT – I consider the tactic against the end user here to be an ATTROCIOUS mis-use of trust. I suggest if you really want long term success at programming your boards – find an alternative from a company who CARE about end users! Oh and I accept NO responsibility if this breaks anything – make sure the chip is 0000 before you do this – i.e. deliberately bricked.


Graphing Wonders

Tonight I’ve been building on my earlier work on graphing, if you read a few blogs back you’ll know I got some basic graphing running on the Raspberry Pi 2, taking MQTT data from a sensor and storing it in MYSQL.

Well that was fine apart from the graphs having no anti-aliasing and hence looking a bit naff. The big problem was I could not get my head around how to handle missing items- if you have a sensor sending MQTT messages on a regular basis, well, you might have any number of reasons why some might be missed. If relying on waking up for a solar installation or just you’ve been in there and been messing with the unit or upgrading it – you could end up instead of a nice set of regular readings, some chunks missing!

Well, as of this evening the whole graphics library is in the bin, saving me some room in the PI. I discovered – which for all except proper commercial use can be had for free. They use JQUERY and 2 highcharts libraries all of which are on CDNs and hence you only need 3 links to access them.

I suggest you go look at DEMOS, BASIC LINE, TIME DATA WITH IRREGULAR INTERVALS. It’s wonderful. ONE PHP/Javascript page does this.

Not only do you get a relatively simple page but it’s HTML5, the imagery is really nice etc. AND you’re looking at filling in with data including the time-date and your reading…. either one graph – or many lines superimposed and if the latter, colouring the different lines and matching them up is all done automatically, you don’t have to lift a finger. Took me less than an hour to take the Javascript code they supply, bang some PHP in there to populate the table with data from mysql and produce nice graphs on demand all done inside the Raspberry Pi. Pretty much all modern browsers will support the output…including the naff browser that comes with the Pi itself.

Here’s a sample – remembering that the data from the two lines were at completely different intervals and one had more samples than the other! All scaling, smoothing etc. is done completely automatically.


And if you don’t like the idea of relying on external libraries you can of course download the lot onto your Pi. Personally, I look at it this way, if the Internet isn’t working, I can’t access the graphs anyway! Hopefully now I’m using my un-interruptible power supply idea that will happen less and less (the bottom of the range Juicebar was involuntarily tested this evening – I forgot to plug it in – it powered the Pi for nearly 2 hours).

I ended up bringing everything into a PHP function with 2 arguments – the title of the line – and the SQL statement needed to get the results. I store all of my temperature readings with 3 fields – the value, a timedate stamp and the location – so I can easily select for example all front room readings from X date to Y  date. The titles and data above are just dummy data I entered into the database. I have 5 months worth of internal, external temperature and internal humidity data available to import from Grovestreams as soon as I figure out how to do it.

If you look at their examples here you’ll see the source code is simply not that hard and dropping in some PHP to replace the static figures takes no time. This has saved me so much time and effort.

After some messing about, automating commas in the right place and struggling with the ridiculous fact that PHP doesn’t by default recognise global variables in a function (EH!!!?!!?!?!) I finally reduced the effort to adding lines to the graph to this..

drawgraph(“Autumn”,”select value,UNIX_TIMESTAMP(logged) as logging from readings where location=’office'”);
drawgraph(“Spring”,”select value,UNIX_TIMESTAMP(logged) as logging from readings where location=’kitchen'”);

That’s it… as many lines as needed.  I’m sure once you look at this if it’s of use you’ll come up with your own scheme using your own preferred language.

I really do need to back up this Pi. There has to be a better way than turning it off for several hours to copy the SD…


Pi 2 Pocket Control

Update July 2015:  Hard to believe it is months since I wrote this – anyway a few of you have had trouble with this so I’m making some changes.

MeshThose of you who’ve been following my exploits for some time will know that initially I started using Arduino to control the home – typically I would use an Atmega 1284-based controller which in turn would talk via TCP/IP to my mobile phone and controls it’s own IO pins plus those of a number of simple Atmega 328-based boards (i.e. home-made customised Arduinos) via the hated NRF24L01 boards using a simple internal network.

I had this running in 3 buildings including heating and lighting. What I don’t like is having to go in and re-compile code every time I come up with a new idea for using the same inputs and outputs – and that’s where the new thinking with the Raspberry Pi2 and Node-Red is already starting to get me excited.

So that worked and all of that was fine except for the range of the NRF24L01 and the fact that they can’t listen and talk at the same time.

As for the network finding the best route – forget it as the NRF24L01 can’t even report signal strength. My next move was to be to start using 433Mhz based radios with spread spectrum etc. and that was coming along nicely when the ESP8266 devices turned up on the market. (All of this is documented in previous blogs if you’re interested in alternative routes to home control nirvana).

Don’t get me wrong, there’s nothing wrong with the home control setup I have using Arduinos – indeed this summer I will be spending the summer in Spain while the heating back home in the UK is controlled by an Arduino with just this kind of setup, I just want to move on to something more ambitious and with less compiling – especially when one of the rigs is on another continent!!

So the idea of using the Ethernet for everything appeals and that’s how I plan to proceed.

Shortly after the ESP8266s came about, the marvellous TuanPM MQTT library for these appeared and most of my earlier ideas went in the bin – this is just SO much a better way to do it. However there remains a problem….

If you want to roll your own as against using the rather restricted graphics (and somewhat steep learning curve) of the likes of OpenHab then there are not too many choices.

What I’d really like is for the designer of NETIO to get a move on and introduce MQTT – apparently that is in the works but don’t hold your breath and I’ve not found an equivalent for MQTT that is not attached to a particular system – so in the meantime I’m playing with TCP/IP and NETIO, which is what I use in the original system. NETIO lets you use any graphics you want and easily move it around the screen – it does have some issues however. If for example on your mobile phone,

serverYou have a couple of buttons to turn a light on and off and an indicator to show the status, they are completely separate – and that means you need to poll the light (say every half second) so you get realistic feedback from the light. I don’t like the old X-10 method of simply ASSUMING the state of anything.

So some time ago I thought it would be useful to recreate what I have already but using Node-Red which fascinates me more and more, on the Raspberry Pi 2. 

I should stress right now that there are no security measures with this – which is why I wanted MQTT in the first place. In over 2 years I have had ZERO problems with this (read later comment)  but you are warned if you replicate what I’m doing here. You could of course also arrange some setup that as soon as your APP powers up it triggers a VPN which would give you some security. Actually, that’s not a bad idea.

The image you see above right is typical of the control screens on my phone, I can control heating and lighting etc. and monitor the status of all outputs, the temperature, humidity and more – all using NETIO on my Android phone (it is also available for IOS). The control has several pages and only the current page generates Internet traffic so it is easy to end up with a really complex setup.

netioIn order to replicate this whole thing on the Pi using ESP8266 boards, I’ve put most of the pieces in place as you’ll see from previous blogs. But now to test TCP/IP control using a much simpler example. Over on the left we have a simple NETIO screen with  some buttons and labels – the latter will be the indicators – a pair of images  to show status off and on of GPIO pins on the Pi 2.  I’ll refer to this as the Pi from now on but I’m making no promises about the original Pi which I always assumed was too slow to bother with. I could be wrong.

So I press ON, the relevant LED comes on in the Pi, press OFF and that LED goes off – in addition, the indictor light on the APP reflects the true state of the LED.

Right now the NETIO app is using an external address using a port redirect on my router. I tend to insist on fixed port addresses from my service providers but you can easily get around that with services such as no-ip (DYNDNS) which are free if you don’t mind being harassed to update your details from time to time. remember – no security here so beware. As well as the host address and port – and protocol TCP/IP – I have EVENTBASED button ticked (add attribute if it is not there initially.

button onThe NETIO setup is easy enough, you tell it you want to use TCP, you set the address of your Pi and the PORT number and for each button you define what it is going to spit out. Generally speaking the package would expect the reply to terminate in a new line – you can add a TINY amount of security though not much by adding a string of characters in there. It would not stop anyone getting in but might protect you against any random rubbish coming in (again I’ve not seen that since I started 2 years or more ago). Anyway you have to send SOMETHING back or the buttons just lock up.

On the right you’ll see a typical button setup.. when you press the button it sends “gpio|1|1” out via TCP to the Pi2, which then needs to send nothing more than a new line for acknowledgement. The text and the format is entirely arbitrary. Since I discovered the SPLIT function in JavaScript  I figured this was the way to go, sending vertical line delimited arguments. I have also done RGB control but to keep things simple I’ll not discuss that here.

So what I’ve defined so far is simple enough… gpio,0,1 turns light 0 (pin 11 on the Pi connector) on… gpio,0,0 turns it off. I’ll leave you to ponder what gpio,1,1 and gpio,1,0 might do (hint, pin 12).

In addition I wanted to monitor the state of the outputs so the message simple becomes gpio?|0,  gpio?|1 for the two respective pins.

labelAnd here I came across my first issue with Node-Red… once you set a Pi pin to output – I could not for the life of me figure out how to read state the state of the pin and the program chucked out objections when I treated it as an input – thankfully there is always the dreaded global variable and that’ll do the job nicely.

So this is a simple visually designed process in Node-Red. The TCP comes in – it is processed by a server-side JavaScript function in node-red – which then shoves out commands to the two ports (in the case of output, not status) – and replies to the TCP by using the original incoming message (so it knows where to send the reply).

The TCP in and out setup are trivial (double-click) so I won’t go into them (Node-Red doesn’t need any init or anything for the GPIO pins  -they just work) – the fact that the FUNCTION has multiple outputs may worry you – I didn’t even realise you could do this until a while ago – it’s simple. The function button in node-red can return a single argument – or many using an array – in the case of an array, you can define more than one output – and send the relevant array subscript automatically to the relevant output without a single line of code. You want to return a message to a single output, then it’s simply return msg; if you want to send to more than one output it’s return [msg1,msg2] etc.  If you only want to send anything to one of the outputs, make the others null. The guys who designed this were brilliant imho.

And so without further ado, here is my simple function that handles the lot!!.  Note that a context variable can be used over and over for the same function block. Sticking .global. in the middle means it will work across all blocks – I figured I might want this information elsewhere.

var newMsg = { payload: msg.payload.trim() };
var myMsg=newMsg.payload.split(“|”);

if (myMsg[0]==”gpio”)
        switch (myMsg[1]) {
            case “0”:
                newMsg.topic=”Update pins set gpio0=” + myMsg[2];
                return [newMsg,null,null,null,msg,null];
            case “1”:
                newMsg.topic=”Update pins set gpio1=” + myMsg[2];
                return [null,newMsg,null,null,msg,null];
            case “2”:
                newMsg.topic=”Update pins set gpio2=” + myMsg[2];
                return [null,null,newMsg,null,msg,null];
            case “3”:
                newMsg.topic=”Update pins set gpio3=” + myMsg[2];
                return [null,null,null,newMsg,msg,null];
                return [null,null,null,null,msg,null];
else if (myMsg[0]==”gpio?”)
        switch (myMsg[1]) {   
            case “0”:
                return [null,null,null,null,msg,null];
            case “1”:
                return [null,null,null,null,msg,null];
            case “2”:
                return [null,null,null,null,msg,null];
            case “3”:
                return [null,null,null,null,msg,null];
                return [null,null,null,null,msg,null];

else if (myMsg[0]==”mqtt”) // message and topic passed on
     return [null,null,null,null,msg,msg];

return [null,null,null,null,msg,null];

That function has 6  outputs. I’m controlling up to 4 ports and also I’m storing the state of the ports away when I change them into a MYSQL database, the result is that on power up I can now read that database and restore the outputs to their former glory.

more ports

and for initialising the ports on power up, a one-off trigger.. it doesn’t get any easier than this.



What is needed now – is a block to control and monitor an ESP-12 board and all it’s I/O over an MQTT link.  Later I mess around with TCP/IP sockets and my own graphics but it has to be said it is hard to beat NETIO for simplicity.

Have fun.


Pi Graphing Progress

Making great progress with the Raspberry Pi despite not knowing Linux from a hole in the ground a week ago.  We’re at our place in Spain for a short break with limited facilities (I’ve ordered a USB scope for the next time we’re here).

As of this morning, I’ve managed to get Node-Red running on the Pi 2 (well, the more important modules anyway including Twitter, email, ports and MQTT and I can turn the facility on and off as a service. A hell of a lot of the modules have dependencies that don’t seem to want to load).  I also have MYSQL in there.

I have just finished a PHP page running on Apache with JP-Graphs (free and wonderful) all on the Pi 2, taking data from MYSQL and plotting.


So what you’re looking at above is dummy data on the Pi, served on a Pi web page – the blue line is coming from the MYSQL database but after I’ve finished writing this and entering more dummy data all 3 will come from the database. The next stage will be to take in MQTT message from ESP8266 devices which will be sent to mysql every minute but logged less frequently until I find how more about how the Pi uses the SD memory – bearing in mind this stuff has limited write life. writing rules for temperature control will be a different matter as I’ve no gut feeling for the scripting language yet.

Coming along quite nicely – between that and the discovery that I can get NETIO to talk to Node-Red, I might not need OpenHab after all.

On the Arduino side we’re looking at making a development of what we call the Aiduino, an Atmega1284-based 5v board, taking it down to 3v3 and sticking an ESP-12 on the end – why? Because I have it on good authority that we’re near to getting some code to handle both MQTT and serial control for the ESPs… which makes matching them with Arduino good sense – the Arduino can handle the intensive stuff like fading serial LEDs without interfering with incoming MQTT messages.  Very exciting stuff.  

Don’t ask me how I installed Node-Red, it was bodged but before long the Node-Red site itself will have updated info for Pi 2 no doubt.

It did not help that the Node-red block “mysql” doesn’t exactly have millions of examples – but with a little help from the one of the guys maintaining it – I cracked that, too. Here’s an example of getting a value into a mysql database from MQTT.



So I have an MQTT node taking in from the topic “testtemperature”. It passes this through a function node which turns that into a SQL INSERT. Here’s the code in the “function” block…(with luck this will save some of you a lot of messing about)

var newMsg = { payload: msg.payload };
newMsg.topic="insert into readings (location,value) values (\"Kitchen\","+newMsg.payload+")";
return newMsg;

And the final bit the MQTT node – it is simply expecting the query in the incoming topic – it simply connects to the local mysql database and runs that query.

A few values added using mqtt-spy….

mqtt spy

Note that last one at 99… and the updated graph shows this! This is real and working, not a dummy.


I’m storing a title and a value in the database – so I can extract the latest values for each of 3 different inputs along with an automatic timestamp. I’ve not quite figured out how to ensure they all match up time-wise yet… but it’s a start….


Node-Red Strangeness



I freely admit to being utterly stumped. Having spent the day getting node-red on the Blackberry Pi2 I’ve made this simple page… an MQTT message coming in is passed out… and also goes to GPIO 0. This works – send a 1 in the message – the LED comes on – send a 0, the LED goes off. The litttle indicator below GPIO 0 shows the 1 or the 0.

TCP in… I’m using NETIO on my phone to sent a TCP package with 1 or 0 in it.  The TCP reply is necessary or NETIO won’t respond. Send a 0 via TCP – and the light goes off (if, say turned on by MQTT).


But – send 1 via TCP and the light flashes ever so briefly – ending up OFF – even though the little indicator on GPIO 0 says 1.

It’s as if the 1 command I’m sending from the phone is being followed by a 0.

The other strange thing about GPIO is that if you send a blank message or a space from MQTT it also turns off – it’s only supposed to be affected by 1 or 0.


Well, it turns out that any whitespace or a RETURN sent to the GPIO module – turns the output OFF – how DAFT is THAT? The solution was simple.. filter whitespace out of the incoming TCP signal.


var newMsg = { payload: msg.payload.trim() };
return newMsg;


And here it is in action…




apt-get WHAT?

Raspberry PiIf like me you are a reluctant Linux user, dragged in merely because you want to make use of the new Raspberry Pi 2 in your projects (and I bought mine as a hub for my Arduino/ESP8266 projects) – you’ll be slowly coming to grips with meaningful terms like SUDO and APT-GET. But until this morning I still wasn’t that clear on the various ways of updating packages – there’s apt-get followed by update or upgrade or dist-upgrade, all carefully designed to confuse the pants of beginners.

So I was rather pleased when reader Rob dropped me a note with this link – which describes the various options.


Domain Issues on Pi 2

So a little while ago, one of you helpful people in here gave me a tip when my Raspberry Pi 2 based CRON JOB started up and failed to send emails.

I added MAILTO: to whatever I was working on and lo and behold the emails worked.

But now I’ve noted that a daily cron job (etc/cron.daily/logrotate) who’s purpose escapes me – has had a go at sending me an email and that has failed (well, an error email was sent out). The text below is what ended up on my PC in the inbox.

Can anyone who understands this well enough please respond in here with the simplest possible fix that will cover all bases – i.e. any attempts to send emails to me will work without having to pepper “MAILTO:” commands in various places?

Delivery to the following recipient failed permanently:

Delivery to the following recipient failed permanently:


Technical details of permanent failure:

DNS Error: Address resolution of raspberrypi. failed: Domain name not found

—– Original message —–

DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;; s=20120113;









X-Received: by with SMTP id s3mr10918962wiz.58.1423981511381;

Sat, 14 Feb 2015 22:25:11 -0800 (PST)

Return-Path: <>

Received: from raspberrypi ([])

by with ESMTPSA id jg3sm13818995wid.0.2015.

for <postmaster@raspberrypi>

(version=TLSv1 cipher=RC4-SHA bits=128/128);

Sat, 14 Feb 2015 22:25:10 -0800 (PST)

Message-ID: <>

Sender: Peter Scargill <>

From: root <>

X-Google-Original-From: root (Cron Daemon)

Received: by raspberrypi (sSMTP sendmail emulation); Sun, 15 Feb 2015 06:25:07 +0000

Date: Sun, 15 Feb 2015 06:25:07 +0000

To: root

Subject: Cron <root@raspberrypi> test -x /usr/sbin/anacron || ( cd / && run-parts –report /etc/cron.daily )

Content-Type: text/plain; charset=UTF-8

X-Cron-Env: <SHELL=/bin/sh>

X-Cron-Env: <PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin>

X-Cron-Env: <HOME=/root>

X-Cron-Env: <LOGNAME=root>


apache2: Could not reliably determine the server’s fully qualified domain name, using for ServerName


Pi 2 Memory Boost

Or: How to get back that missing quarter gigabyte of RAM.

I must admit, though I’m very pleased with my new Raspberry Pi as a potential controller for my various Arduino and ESP8266 boards, I was a bit bemused given the claim of 1GB of main memory to realise on test that in fact only 768MB was available. Task Manager output below:


But I assumed that this was once the operating system had taken it’s share. At first this was no big deal but as I started to realise the potential for this board, I started also to realise that memory would still be critical… MYSQL, MOSQUITTO and other programs running constantly would take a chunk out of this.

And so I was interested this morning when reader Rob Bell wrote to me with a link – echoed here.

So I took my Pi’s life into my hands, opened a terminal and keyed in…

sudo rpi-update

At which point this lot happened – took a couple of minutes all in…

Updating pi

The result –  verified after rebooting the device…

new pi

And so thanks to my friend Bob, the author of that blog item and the wonderful people who work on this stuff, I now have nearly 200Mbyte more than I had first thing this morning, for the most trivial effort and for free. Can’t be bad. Please note this applies to Raspberry Pi 2 – NOT the original A or B models.

Beware: Reader Daniel has the following to say…. “Just as a warning rpi-update takes your Raspberry Pi onto the bleeding edge software development tree and is known to break compatibility with a lot of applications and hardware addons in addition to making your system unstable. Unless you are a Raspberry Pi developer its best avoided.
Any positive gains you get from running rpi-update will be migrated into the standard Raspbian updates and available with apt-get update; apt-get upgrade as soon as they are considered stable.
In the past a lot of people recommended rpi-update as it was the only way to get certain things to work but nowadays it’s definitely best avoided.”

If you just want to ensure you have the latest of everything without getting into leading edge stuff, the following commands run in order will ensure you have the latest upgrades.

sudo apt-get update

sudo apt-get upgrade

And for those as new as I was last week – “sudo” is “super-user do” – i.e. it lets make you run the command as a super-user – and update ensures your Pi knows about the latest versions of the various packages – upgrade actually does the upgrading. All of this should be painless and take minutes only. I ran all of this from the graphical Raspbian environment in a terminal window.


Enter Bluefish for Pi and PC

If you’ve read my blog you will know I have a near pathological aversion to the command line – reminds me too much of DOS and the 90s.

So when I got my new spiffy Raspberry Pi 2 (which I am really impressed with and which will almost definitely form my new come control hub working alongside the ESP boards and the odd Arduino (unless someone eventually writes the assembly necessary to get serial LEDS running reliably on the ESP boards in which case the Arduinos become less relevant by the day especially now the ESP-12 can be had for under £2) the horror of what I’d done quickly came home.

Thanks to research and asking lots of questions in here however I’m slowly developing an environment on my PCs that supports the Pi without me having to get my hands dirty. Still it is handy at times to use utilities on the Pi itself.. and that brings me to the subject of EDITORS.

Frankly, the editor that comes with the Pi is PANTS as are most of the offerings out there unless you’re a former WordPerfect for DOS fan who likes complicated control sequences for breakfast.

And so it was that I completely accidentally discovered BLUEFISH.

For the PC –

and for the Pi

sudo apt-get install bluefish


Don’t be put off by the really horrible font in my screenshot here, the editor looks quite nice in Windows 8 and only marginally worse in the Pi (I must find a decent font for the Pi) – but the point is – it works- and it’s familiar, it’s free and it doesn’t look like DOS. I’ve used it to edit PHP, the cronfile and all sorts of stuff. I’ve no idea how it would run on earlier Pi boards but on the Pi2 it works just fine. When you run it (Terminal SUDO BLUEFISH – I’ve yet to figure out how to make a desktop icon to run it as root – help anyone?) there’s some garbage comes up in the terminal, something about error retrieving accessibility bus address – anyone know how to remove that?) but then the editor window pops up and works a treat.