Latest Project - ESP8266 + MQTT

1 Comment January 11, 2016

It has been quite a while since I have posted anything, so I may as well post about the last project I’ve been working on to limber up my fingers some.

I picked up a couple of NodeMCU ESP8266 boards from Amazon for about 9$ – I wasn’t 100% sure they would work for what I wanted, but for less than 10$ I was willing to risk it.

They are designed around the NodeMCU  firmware using Lua to develop IoT applications – but I have a limited amount of time to learn and re-learn languages and I’m pretty familiar with the Arduino environment. 

Stepping back a bit…

A few months ago when I was using the environment to program ATTiny85 chips for a Blinkenlights art project, I came across the Arduino core for ESP8266 and realized that it was pretty close to the point where I could skip talking to the ESP by AT commands or trying to make an old-school SLIP connection to the internet through it I could just program it directly…

I had a few requirements that I wanted for the project:

1 - It should start up in Access Point mode and the Wi-Fi should be configurable via a Web Page

2 – Once it has been configured, it should still be accessible on the network to see / change it’s configuration

3 – Use MQTT as my communication protocol between a central server and one or more of my nodes.

… – make it do something interesting,

#N – Security – Really, this shouldn’t be an afterthought

…But at a certain point I realized that I was concentrating to had on the particular point that I couldn’t even get started… I’m probably making a mistake – but since I don’t intend this to be a commercial product or something that I’m going to be running a nuclear or medical device on – that for now, I’ll just keep it in mind and make sure that it is addressed as I go.

Birth of a DataMote…

Getting started was interesting – there were a lot of fits and starts, attempts and test and trying to figure out how to make a web page appear and switch between AP and station Modes and just generally trying to get familiar with the inner workings of the ESP – but not really making much head way on #’s 1 and 2.

I made some progress in April and May getting the Mote to talk MQTT, but making it easy to use had eluded me and at the time, I couldn’t find any good examples on how to start on the path of where I wanted to go.

image

image

So around the first part of December, I came across a Kickstarter project called “The Light Clock” that looked pretty awesome, especially since it was based on an ESP8266!  Then, as I read up on it a bit more, I found out that the creator of the project, Chris Carter, planned to Open Source the Firmware and this would be an amazing learning opportunity for me to see how a product that actually existed did its thing.  Based on that, it gave me ideas on how I might go about figuring out my own path as well.

The plan for “Making it do something interesting” has now evolved into making a set of data loggers that will monitor the temperature in several locations about my house and as I have time, finish building the custom lights in my office and making them controllable as well… it’ll give me a number of inputs and outputs and ways of controlling sensors but nothing that is critical to survival.

So finally, after many fits and starts, I’m at a point where I have a lot of the pieces almost ready to start making something interesting and a reason for me to restart posting to this little blog-o-mine.

image


1 Comment

  • Gravatar Image
    Atrakeur January 15, 2016 12:36 PM

    Hey,

    I'm also working on a mqtt connection through an ESP8266 for an arduino based project.

    It's strange you needed 3 days to get the mqtt connection working. It worked almost out of the box from my arduino (just flash a SLIP based firmware, adapt some arduino lib and here we go). There is also tons of mqtt enabled firmware for esp8266 out there.

    On the other hand I didn't managed to serve web pages directly from ESP yet so very nice job for that.

    Anyway awesome work and keep it up! Let's see what comes out of this little powerfull chip!