Category Archives: Uncategorized

Obsolete Fixed IP Tutorials

I’ve just spent half the day trying to fix the address of one of my Raspberry Pis. No matter what I did, it kept the address that it was assigned some time ago.

I even tied the IP address to MAC in the router – and THAT didn’t help. Countless resets of the router and the board got me nowhere until I read this:

My /etc/network/interfaces file didn’t look like that so I updated it… turns out in Jessie you have to update the file /etc/dhcpcd.conf

Here’s mine..

 interface eth0
       static ip_address=
       static routers=
       static domain_name_servers=

Even getting this far, some tutorials said you needed far more information than this or the Pi would not be able to contact the outside world. Well, mine does now and the address fixing works. Worth keeping that link in your bookmarks.


Happy New Year


Just wasted part of the day trying to get Python 3 working properly on an upgraded Raspberry Pi 2 updated from Wheezy to Jessie without luck – very depressing – so I think an early night (yes, on NYE – having seen the fireworks in Moscow and the “special” fireworks in Dubai I’ve had enough for one night Smile

(Update: I did get it working - I have TWO Node-Reds in there now but the latter one works).

So – to everyone  – lots happening soon, more reviews, new interesting kit, more new ideas and hopefully more exciting feedback in the new year!

Thanks to everyone looking in and I'd like to point out that I regularly go  back to older posts and update if I think something is hopelessly out of date so do look around when you're in here, I don't think the system sends out emails for such updates.



New ESP Boards

Are these new? Reader Christian brought these to my attention this evening – price is ok – and if size is at a premium….

tmpD351Small footprint,  USB-to-TTL is on the underside. This is quite interesting when space is an issue. Supplier also has a DHT11 shield:


Next is a piggyback development board with an RGB LED, a photo resistor and three buttons:




The more I dig into Node-Red the more I end up coding my own routines – and the internal function has nice colour coding etc but eventually you start to get a little frustrated with the internal editor especially if you are used to using an IDE.

tmpA7E2It just so happens that some enterprising chap has come up with a function node that allows you to use functions held in separate documents! It is called FILE FUNCTION. And so it was that I went looking for an IDE that would ease programming of the Node.JS code and hopefully other stuff as well. Code Lobster describes itself as “PHP Edition” but has plug-ins for various other languages including something that is new to me – AngularJS. So off I went for the free edition – you’ll find that here.

I ended up with the pro edition but the differences are not as marked as you might think. I was impressed by the intelligent lookup – though when editing a .JS file a little bemused as to why SOME intellisense didn’t work – for example “msg.payload.” only offered “switch” whereas I was after .substring, however it was nice to be able to look at structures I’d created and have the facilities of a full IDE – something I miss a lot when editing in Node-Red editor itself (I’m not complaining – it’s free for heaven’s sake but one always wants more).

That of course is not what Codelobster is about … it’s a PHP editor and allows for full debugging and visual development. It did catch me out – when I wrote a simple one-liner PHP program and tried to “run” the program in the preview mode. That failed of course because at least by default, Codelobster assumes you have a working local webserver “http://localhost/whatever/php” which I don’t – but that will be rectified soon.

There is FTP support – which is just as well as I edit everything on my PC and then fire it off to the Raspberry Pi!

I could rant on for ages and no doubt will at some time – but for now if you are interested in playing with their free version (which needs a key but I understand that will soon disappear) it’s in the link above.


Espressif ESP8266 New SDK Update

You may be aware that ESPRESSIF have released a new update to their SDK which now stands at version 1.5

I’ll be interested to hear what experience other folks have of this..  On compiling my normal home control code which has worked without modification since version 1.0 I got this..

LD build/app.out
c:/Espressif/ESP8266_SDK/lib\libwpa.a(wpa_auth.o): In function `wpa_receive':
(.irom0.text+0x9a0): undefined reference to `aes_wrap'
c:/Espressif/ESP8266_SDK/lib\libwpa.a(wpa_auth.o): In function `__wpa_send_eapol':
(.irom0.text+0xd73): undefined reference to `aes_wrap'
collect2.exe: error: ld returned 1 exit status
mingw32-make.exe: *** [build/app.out] Error 1

and in the update info from Espressif they say ….

User application needs to add "-lcrypto" in '" area of Makefile.

Well I don’t have one of those in my Make file.

Not a good start, what? But there is a simple solution (not quite what it said on the Espressif forum)  - see the comments!


Node Red Script

imageNow that I’m back in the UK, I’ve left a Raspberry Pi2 in Spain monitoring my solar pergola lighting installation as an ESP8266 measures the state of a solar-charged car battery every 15 minutes and reports minimum and maximum voltages daily by email. The unit also controls lighting and while not actually controlling heating, has a test setup which controls a Nextion display. Meanwhile I have a similar setup here in the UK which is actually connected to a Nextion and which will soon be in charge of the household heating.

But something has been bugging me. Regular readers will know that during the last month or so in Spain I had a lot of WIFI issues, pretty much resolved now thanks to the help of you readers – and in that time until I got to the bottom of it all I spent a lot of time improving my ESP8266 boards to the point where I recently took off the last-ditch reset-the-board option as they are working utterly reliably even in the face of rubbish electricity and the WIFI issues.

In a recent development I decided that in the unlikely event of another power cut (turns out not as unlikely as I’d hoped) I’d have Node-red send me an email on startup.

Well, once a day I was getting these, usually around 11am or so. The unit in the UK was slightly different but still generally resetting in the morning. I wrote off to the guys in the Node-Red Google group – they’re really very helpful and they asked me to check using PM2 some things.

Turns out PM2 (process manager) is a lot more powerful than I’d given it credit for. Anyway I sent the guys a copy of my script or rather the part that starts Node-Red and puts it into a service to run after powerup. It goes like this…

cd /root
pm2 start /usr/bin/node-red -- -v
pm2 save
pm2 startup

The first line is probably irrelevant but I tend to do that a lot to avoid surprises. Anyway, I’ve used this from day 1. I’d sent an example log and one of the things in the log was logging of a LED I toggle off once a second in a simple indicator. I did comment that I thought it was a bit daft logging that every second.

One of the guys in the Google group (Dave) asked me why I was using verbose mode for Node-Red and don’t you know – I spotted the “-v” in my script. How that got in there I’ve no idea.

Anyway to cut a long story short, I needed to scrap that service and create a new one without the –v for verbose.

pm2 list

The above line shows list of services running under PM2 – turns out only one – service 0 so…

pm2 delete 0

got rid of if which allowed me to start again…

cd /root
pm2 start /usr/bin/node-red
pm2 save
pm2 startup

So now I have Mode-red running on both machines (since last night) without the verbose logging. I should stress I made absolutely NO other changes.  Now bearing in mind that my total work on these Pis is using a couple of percent of processor power typically and maybe 50% of the RAM…. let me throw this at you…

Since restarting the services without verbose mode last night – and bearing in mind it is now 4:30 pm the next day – NEITHER of the Node-Red installations has rebooted yet both have sent in their daily battery state email reports.

There is time yet of course – I may be going off on a complete tangent – but it does seem odd that simply removing verbose logging would stop regular Node-Red reboots!

Update 21:00:00 Wednesday – oh, well, I just had an email from the local Pi to say Node-Red has reset itself. Sigh.


WIFI Congestion?–Help Requested?

Update: See bottom

I have a problem – and I’m going to shamelessly use this blog to see if someone can help.

In the midst of my home control nirvana – I’m having some WIFI issues that I simply don’t understand.

So -  my setup:  Broadband coming in is maybe 6Mb in each direction so no issues of lack of speed.  It comes into a Draytek (PPOE) router from a small window mounted dish to a large aerial in the middle of the village. I have no problem streaming TV or downloading big programs etc.

Indeed I have very few problems with hardwired use – our PCs always connect to the web. I’ve had my little wifi ESP boards talking to a Raspberry Pi for months without issue.. and then a couple of weeks ago it started…

The units would log in but not stay logged in, or be unable to login. I thought it might be my little WIFI control units – but then my wife started griping here phone would not log into the network. The mobile phones suggest this is not an issue with my little WIFI boards.   Sure enough – try to log in – the phone would say “connecting” then just go back to “saved” .  After a while it would connect for no good reason.

I switched the WIFI off for a couple of hours and back on. All was well for maybe 30 hours – and then slowly but surely my little control units would have trouble logging into the WIFI – and so would our mobile phones.  Strangely, though our PCS which are hardwired would have no apparent issues, I’d find it might take seconds to connect to the router with the web interface, something that should be virtually instant. WHY? The router is on a wire as is the computer. What can be so jamming up the network?

So – I reduced the router to factory settings. I altered the DHCP to start at and did some IP-MAC fixing for things like the PI (well, two or three of them) and my PC. This was to ensure that no devices with fixed IPs were in the same range with possible overlap with devices working on DHCP. We’re taking maybe 20 devices all in – some controllers, a couple of computers, 2 phones, 2 tablets, 2 Raspberry Pis… and some ESP8266 WIFI units.

All worked well, my devices operated flawlessly as did the phones and the TV for DAYS on end. Yesterday a couple of times I heard devices logging in to the Pi (I have speech warnings). Might be an issue, might be not.

But this morning, whatever is wrong is back full steam, devices logging in every few minutes and generally not taking any notice of remote instructions – or taking ages to respond.  It is as if something is absolutely hogging the radio network.

And yet… I put checks in to see how many messages were  being passed back and forth between my PI and the devices… one a second if that – no big deal. I’ve looked at bandwidth use in the router – nothing stands out . BUT SOMETHING is gumming up the works.  I have 3 routers acting as access points and yes I’ve spread channels so no overlaps.

I’m missing something here, I have no way to see what it is that is actually going wrong here.  If anyone considers themselves a whiz at wireless networks – feel free to get in touch – – I could do with some fresh thinking.

Update 28/10 – A couple of days with almost no problems – tonight back with a vengeance – WIFI feels “clogged” – attempts to get Wireshark invariably gave me an incomplete download on my otherwise very fast laptop. Went to the (wired) PC and no problem.

Here’s a heatmap of the place with very rough positions of kit.. only the two WIFI access points (actually identical position as both on the Draytek) are mine – others are WAY further away than they look and so unlikely to cause problems.  All but one is nearly a street away.



So after having difficulty loading Wireshark, I downloaded it on my WIRED machine and ran on the laptop in the main room – I’ve no idea how to run Wireshark but I’m pretty sure that screen was showing problems – failures, some stuff in red, retries… After saving the file from Wireshark I turned off the external WIFI coming in – and turned the Draytek off. I left them both off for maybe 10 minutes. I turned them back on – hardly any units logged in and would not communicate (but one did as the Pi replayed the login message that comes from the unit). So any ideas of overheating went out the window (it’s cooler here today anyway than normal).

At this point, I’m sitting with a perfectly working wired machine, a laptop that seems ok and ESP units that are failing to get through – and resetting – after many hours of operating perfectly.  The laptop is seeing my two access points and next doors, intermittently – they are actually disappearing and re-appearing. Next I started to turn off all the ESPs, no difference, the mobile phones – no difference. My wife who by now was in bed reading said that the WIFI said it was disabled.  I even disconnected the Raspberry Pis from the network – no difference, our neighbour’s weak signal and our two strong signals were turning on and off, on and off on my Windows 10 tablet.  I turned off the dish and the router – this left the neighbour’s signal – still turning on and off about once a second. Turned the router back on – turned the phone on and turned on WIFI Analyser on the phone – I could watch the two WIFI signals come on full strength – and turn off – once every few seconds (I suspect even though it has a 1 second refresh it’s response is slower). I turned the entire Pergola off (PWM solar powered lights – actually disconnected the battery – no difference.

I need sleep.


Raspberry Pi Serial and Node-Red issues

SOLVED: Node-Red serial I/O


Looks simple doesn’t it – tie RX and TX together on your Raspberry Pi and press the button – text comes out of the other end – except that it doesn’t. More likely the Pi will CRASH (not something you see every day).

Serial out seems fine – no error messages, you can change baud rate and according to my scope, all is fine on pin 8 of the RPi2.  Input on the other hand, can cause interrupt issues, messages on the console and crashing – and almost never actually produces any output.

So what is the problem?Well, one of the guys at the Node-Red forum set me onto this link.

And therein lies the problem – by default – the RPI uses the serial port for communications. Trying to add another hook to the serial in interrupt – kills the Pi.

The solution is simple – extracted from the above link.

  1. edit the file /etc/inittab as root (I used “sudo vi /etc/inittab”)
  2. change this line: T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100 to#T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100. I.e. comment it out, and save these changes.
  3. run the command “sudo kill -1 1” to pick up these inittab changes

And that  - was that  - I now have comms in and out  - the idea being to put a serial display such as the NEXTION onto the Pi with simple touch input commands – and an output display showing status, temperature etc. DODDLE in Node-Red once you have serial up and running.



In case anyone was thinking I'd fallen off a cliff..  I'm waiting for my Orange Pi PC to turn up so I can find out if it works of if the doubters are correct. In the meantime I'm working on my script to install everything but the kitchen sink - and learning a lot about BASH scripts - things like how to stop someone entering Control-C when you want them to select Y/N,  how to clear the buffer so your script is not entirely screwed up by accidental key presses - etc. How to put the script in pretty colours, how to make sure passwords aren't messed up - the list goes on  -anyway, right now I'm just starting another 1 hour+ installation and waiting to see what I've done wrong this time.

I will put the script in here later on with an explanation  - once I get it to actually work correctly - so that's why I'm not writing about ESP8266s etc.. Meanwhile I'm wiring up my Pergola with RGB strip when it's not raining. More on all of this later.