Category Archives: thingstudio

A Fresh Pi2 Start

pi2

The thing about rushing in with something new is that you tend to bring your learning mistakes with you.

Firstly for new readers, why am I fascinated with the Raspberry Pi? Well I’ve been working on IOT for some time now and I’ve tried out many ideas most of which you’ll see blogged about in here. I originally used an Atmel 1284 based solution of my own (own board, own software) to control a number of Atmega328-based boards by short range radio. Indeed right now I have 3 properties – two here in the Northeast and one in Spain which are using this successfully. But there were a lot of range issues with the radios and I was running out of steam with the 1284s and along came the ESP8266 chips… This opened up so many possibilities but I really needed something more powerful at the helm without spending more money (many have heard me say “I’m not spending £60 to switch a lightbulb”) – and in the nick of time along came the Raspberry Pi2 – which for £30 is a bargain even though you really have to learn just a little Linux to make good use of it.

The Raspberry Pi 2 was so new to me a matter of weeks ago (never had the original Pi) that I loaded the entire kitchen sink onto it. In anticipation that this might happen I bought a second Pi2. That gave me all sorts of issues, stalled keyboard, memory problems.. I w2as convinced it was the microSD chip… then I realised the other day that this could all be put down to a lousy power supply! I replaced that with something meaty and I’ve never looked back.  Mindful of the fact that my 32Gb microUSB drive for the first Pi2 was taking an hour or more to back up I went out and bought a Sandisk Extreme 16Gb and an Anker USB3 adaptor and that really made a difference – but still I was basing everything on a bloated software base. So this week I sat down and started from scratch.

You can save many, many megabytes by un-installing the rubbish that comes with the Pi2, that Wolfram thing which I cannot imagine any use for, the games etc. Having stripped the Pi down to essentials I then installed Webmin (and if you are not using this, why not?) – which by its nature needs PHP and MQSQL to run – and that’s fine as I have a use for both (graphing). When fitting the WIFI dongle to the board (who wants another wire) I realised I could do with the equivalent of the Windows WiFi properties window and stumbled on Conky – I’ll let you research that one. I then installed Mosquitto with some help from Mike at ThingStud.io (and others) and finally with LOADS of help from the guys responsible for Node-Red, put that up (the installation is very different to my first attempt).

With all of that in place and all the latest updates (courtesy of Webmin) I’ve barely used over 3.5GB which is excellent because as time goes on the size of the microSD will start to shrink if nothing else because these devices have limited lives and the more expensive chips have intelligence on-board to move data around as parts of the chip die. I’m hoping to get several years of life out of this when I’m done so the more spare capacity the better.

So there we are, a clean start on which to build my ESP8266 and Arduino-based home control.

Facebooktwittergoogle_pluspinterestlinkedin

Mosquitto and Web Sockets

This entry is about ThinkStudio (thingstud.io), Web Sockets and Mosquitto in my quest for ESP nirvana.

So TODAY I was alerted to an early version of a new service which I think you might like… so check out http://www.thingstud.io/ 

Clarification: This is ALPHA software but already, provided they keep at it I think this has the potential to replace the rather slow-moving NETIO app which provides a nice user interface for IOT. 

mqttThis software uses MQTT which is right up my street.

Well, always one for a challenge, I went to the site, set up an account and…. nothing – not a thing. I put in my MOSQUITTO (MQTT) credentials and got absolutely no-where apart from having a nice pretty interface. They have a nice pop up live help (pretty amazing for an alpha product) and before long I was happily chatting away to Michael Karliner. It turns out that the product needs MQTT to have Websocket support which my Mosquitto on the Raspberry Pi does not.  I’ve been putting it off because every explanation I’ve seen up to now involves compilers and all sorts of horrible things.

I was pointed to this link… blog.thingstud.io which Michale had just completed - and in there is an article about installing Mosquitto with websockets. I was in one of those “devil may care” moods and so figured there was no reason why this could no upgrade my existing Mosquitto.

So I did – I followed the instructions from the start right up to but not including the bit about installing Node-Red as I’ve already done that.

WELL BLOW ME!!! it worked. Well… not quite. It over-wrote my mosquitto.conf file with a virgin one so now my security was bust and my local boards could not talk to anyone.

I opened the virgin mosquitto.conf which had everything commented out and added these lines as per the blog

listener 9001

protocol websockets

So now I could run a websocket on port 9001 (I tested that by redirecting the port on my external address then trying  http://www.hivemq.com/demos/websocket-client/ – worked a treat)

That allowed the websockets to work – on port 9001. But… my normal port would not work any more – 1883.. so I added this.

listener 1883

protocol mqtt

That got both pipes listening – all that was needed was to restore my user access.

allow_anonymous false

password_file /etc/mosquitto/passwords.txt

And Bob’s your uncle – the latest Mosquitto (which is just excellent) and now websockets.. which means I can write my own web pages to access MQTT if I want to!!! And no doubt I will – but if ThingStud.io works out –  I might not have to. Ensure you are registered to get updates in here or follow my usual Twitter and Facebook accounts to make sure you don’t miss out – I have a hunch about this one.

Update: Oh I found another link with instructions for installing websockets – and a little info on the mosquitto.conf file…

http://harizanov.com/wiki/wiki-home/raspberry-pi/how-to-rasbperry-pi-install-mosquitto-with-websockets-enable/

Facebooktwittergoogle_pluspinterestlinkedin