What a wonderful smell you’ve discovered
It’s been a while since I found the time to update both of my regular readers on my latest project.
Which this isn’t. I’ve been working a raspberry pi project for a while and it is progressing nicely, but this isn’t about that (That will be coming along in time for the next HullRaspJam). This is a post about something that has taken over from the longer term project in the last few weeks.
The internet of things. Big data. Smart City. All big buzzwords at the moment and I’m lucky enough to be involved in a group looking at Hull and what we can do. I’m not a big player in the group (in fact, I felt quite a bit out of my depth), but I was invited along as I’m a bit of a geek (I know, surprising revelation eh?) and, thanks to recent developments in my professional life, I now have access to a workshop of tools including 3D printers, laser cutters and much more.
Anyway, off the back of chats with various people in this group I was introduced to a few things in the world of tech that I hadn’t used before.
A techie I know has been trying to get me to try an ESP8266 microcontroller for a few years now. As I progressed from Raspberry Pi to arduino and soldering and stuff he’s been continually suggesting (nagging) me to try one of these wifi enabled thingamybobs. Which eventually I have.
Here it is my NodeMCU (ESP8266) in all its tiny glory.
For size comparison, it’s about the same size as a raspberry pi zero (but smaller versions are available). This one came from AliExpress and cost somewhere in the region of £2.00. Bargain.
All you need is a micro USB cable (if you are anything like me you’ll have plenty of them hanging about from old phones and the like). and you can go for it. I’ve powered mine from an old mobile phone charger and it works like a charm.
It’s not the most user friendly to set up, but remember, Google is your friend and you can find plenty of walk-through instructions, I’m not going to repeat them all here start by heading over to letscontrolit.com for more info. On the suggestion of the aforementioned tech, I downloaded ESPeasy – a simple and easy to use firmware that allowed me to connect the device to my wifi from the laptop and then view the information on the device.
Great, That was easy.
What to do with it though? That was the question.
I’d originally planned to use it to power some fairy lights in the garden, but I managed to find something else for that purpose (I’ll be writing a post about that project soon) and the ESP was left waiting for inspiration.
A recent discussion I was lucky enough to be invited to centred around air quality and particle pollution. It was suggested that we could build devices that would monitor particle levels on a local, granular scale. This seemed like the perfect opportunity to break out the NodeMCU and connect it to some kind of funky smell sensor. It turns out that there are only two (yes, 2) official air quality sensors for the whole of the city and for many in the group, the ability for local people to gather data and supplement this would be beneficial in sharing the power of a “smart” city network.
It was suggested a cheap and usable sensor would be the SDS011 – about £15 or so from the usual Chinese suppliers – and would monitor both PM10 and PM2.5 (These particles are the ones most commercial air quality monitors check for and would be a good place to start with our local level monitoring).
I promptly ordered one and waited with baited breath for it to traverse the planet to get to me.
The SDS011 device as delivered
Upon arrival, it was simply a matter of connecting the 5v and GND pins to the appropriate pins of the NodeMCU, and the transmit pin to one of the data pins on the tiny microcontroller.
I had to flash the developer version of the firmware to gain easy access to a drop down menu dedicated to the SDS011. Once the pins were connected (I just used a bunch of jumper cables from the Pi toolbox), I power cycled the controller and that was it.
All connected up
The settings screen allowed me to set all the required information for the controller and I hit submit.
The settings screen
I have to admit, I’ve never seen setup as simple as this. On closing the settings the smell sensor showed numbers!
This is what success looks like.
After a while the numbers settled down and I had a working particle sensor.
Next up, to get the system to report these numbers to the world at large. I registered at Thingspeak (based on suggestions online that it’s the easiest way to get the numbers out there) and it worked…
IoT on the www
…for about five whole minutes.
No idea why, but all of a sudden it stopped working and hasn’t worked since. The device is working, it’s reorting numbers when I log onto the NodeMCU on the local network, but for some reason, it isn’t talking to Thingspeak.
So, next weekend the next step in this project is to learn enough about MQTT, Node red and possibly MySQL to get the data somewhere it can be used by others in the group… then I can start thinking about 3D printing a housing and working out how to power the device using a battery of some sort.
Stay tuned for more on this and other sheneghans as I try new things and learn more about this ‘Internet of Things’ thing.