Making an Air Quality Top Hat

This how I made my Air Quality Top Hat. It’s actually more of an Air Quality belt really, in that the sensors and the lights are attached to a strip of webbing which can then be fitted around the hat. I’ve made it slightly too long, so that it can also be turned into an Air Quality belt if you prefer.

Click on the image for a large version on Flickr

I’m using a Wemos D1 Mini and a Winsen ZPH01 particle sensor. The sensor will detect 2.5 micron particles but it’s not super stable (mind you - it is very cheap). For the light display I’ve added a strip of NeoPixels.

The wiring is just point to point, with some wires twisted together, soldered and then covered with heat shrink cable. The ground line is connected to the grounds on the pixel strip, the Wenos, the ZPH01 ground and the ZPH01 control line to pull that line low and request that the sensor sends serial data out of the TX line. The 5V line from the WEMOS is connected to V+ on the ZPH01 and the V+ of the NeoPixels.

The data line of the NeoPixels is connected to D4 on the WEMOS which is actually GPIO2. I’m using a lovely pixel library from Makuna which uses the onboard UART on the ESP8266 to drive the pixels. This forces them to be connected to GPIO2.

I’m using a specially hand tampered SoftwareSeral driver to get the sensor data, which is read on GPIO12 which is exposed as D6 on the WEMOS device.

The device is powered by a short usb cable that I’ve plugged into the WEMOS and then taped in place. I can use a USB extension lead to program the Wemos and plug it directly into a usb power bank to power the whole thing.

Rather than find a plug and wire up a cable, I’ve actually soldered the wires directly to the back of the sensor. I’m not proud of this, but it does seem to work. The Air Quality sensor and the Wemos are secured to the belt by double sided adhesive foam.

The software I’m using is an early release of my Monitair software for Air Quality sensors. You can find the “Top Hat” version on GitHub here.

Red Nose Day Screencast Recorded and Ready for Premiere

I’m actually ahead of myself. Amazing. I’ve got the words for the lecture written (a mere 96 slides), the Air Quality Top Hat works, and I’ve even had time to record a quick screencast of the material.

The screencast goes live after the lecture, at 14:00 GMT tomorrow on Red Nose Day.

I’ll update it with footage of the event over the weekend.

Oh, and you can still sponsor me here.

Azure Storage Explorer

I’ve been playing with Azure Functions and storing values in Azure Tables. It’s very easy to do. If you decide to have a to have a play with these (and you should - you can do it for free) you should download Azure Storage Explorer. It lets you explore your storage (the clue’s in the name) but it also lets you download CSV files, manage binary objects and lots of other nice things. And it works a treat.

Amazing facts to impress your friends....

If you want to really impress someone just tell them this:

“If you want to use MQTT with PubSubClient and talk to an Azure IoT Hub over secure sockets you should use Version 2.4.2 of the LOLIN Wemos framework or your program will crash when it runs out of memory during socket open.”

Then again, it might just be me that would be impressed by this.

Building an Air Quality Top Hat and Letting the Smoke Out

I’m building an Air Quality Measuring Top Hat for my Red Nose Day Lecture in Rhyme next week.

I think I’m the first person in the world to do this. No idea why.

Anyhoo. I’m going to equip the hat with a bunch of coloured leds to indicate the quality of the air around the wearer. Yesterday I started building up the hardware. I was driving all the leds with one of my trusty Wemos 8266 devices. Half way through my first test of the leds I noticed smoke rising from the device. Now, I don’t know much about electronics (obviously) but I do know that all electronic devices are actually powered by “magic smoke”. I know this for one simple reason.

If you let the magic smoke out of a device, it stops working.

It turns out that I hadn’t turned on my main power supply for the leds, so all the power was being drawn through the Wemos device; specifically the blackened and unhappy looking component above. Which got very hot, let out its magic smoke and stopped working.

Oh well.

The good news is that the Wemos devices only cost around two pounds each. I’ve ordered ten more…

Sponsor Me for Red Nose Day Madness

I’ve just sponsored myself for my lecture in Rhyme next week. I’d love it if you did too. Click on the image above to go straight to my donation page.

If you can make it to the lecture I’d love to see you. It should be fun and there will be FREE DONUTS as well as lots of the usual fun and games.

You might even learn something about air quality, which is what I’ll be rhyming about.

The lecture is at the University of Hull on 15th of March (Red Nose Day) at 1:00pm in Lecture Theatre A in the Robert Blackburn Building. David from c4di-Eagles Labs is bringing the donuts. I’m bringing air quality sensors and maybe even a light up top hat. As you do.

You can find out all about my illustrious Red Nose Day history at my special red nose day page.

Connected Humber MonitAIR Circuit Board

There comes a point in a project where things start to look real. I think we’ve hit that in our Air Quality monitoring project. At the Connected Humber hardware group this evening Brian gave out some populated versions of the sensor circuit board he’s designed and had made. Rather than making all the individual connections by hand we now have a beautiful little board that takes our processor, some power supply and switching circuitry and sensor connections.

It’s very pretty. The next step is to marry it up with our housing designs and start putting sensors into the hands of our waiting test users.

Exciting times.

Sensor Base Design the Hard Way

If I ever join you climbing a mountain, I’ll probably be the one wearing roller skates and carrying a piano.

Sometimes it seems to me that I have a stubborn determination to do things the hard way. For example, today’s task was to create some designs for an outdoor air quality sensor. I wanted a circular fitting to go in the base of a pipe and a support that would attach to the fitting and hold the processor and air quality sensor.

Some people (I think I call these people the “sensible ones”) would reach for their CAD tool and begin designing. Not me though. I reached for my Python interpeter and the ezdxf library that lets you write Autocad files from your code.

I wanted to use the “nut holder” approach to fitting where the laser cut plastic (which is what I want to make the stand out of) holds nuts that a bolt engages with to grip it. I’ve used these on the Hull Pixelbot quite successfully. I was quite proud of the “nut holder generator” that I’d written for the Pixelbot, it even makes each change of direction into a tiny curve, which apparently reduces the chances of the plastic cracking after it has been cut. However, my original code only drew the holders in one direction, whereas for the holder I wanted to put them all around the edges of a circle, as shown above.

Cue lots of bits of paper covered in drawings of triangles, sines and cosines and cursing over code. Eventually I managed it though, and the next step will be to get the plans cut into plastic so that we can make some sensors.

DDD North was super awesome

The best conferences are the ones where you go and learn a bunch of useful stuff and also like to think that you’ve told a few folks useful things that they didn’t know.

DDD North yesterday was one of the very best. I was blown away by the quality of the sessions, the enthusiasm of the audiences and the sheer good humour of the whole event. I learnt a whole slew of new stuff; from IoT development tools that you can run from you laptop through Mob based development techniques, some nifty .NET library tricks and a lovely take on how to use generics in C#.

I even presented a session of my own which I hope taught people a few new tricks. I was so engrossed in my bits and bobs that I totally failed to take any pictures (which is most unlike me and a measure of the quality of the occasion).

And to make it even better, it was in based in my favourite university and old stomping grounds in Hull, so I just had to get up, grab breakfast and tootle down the road to take part.

Hats off to the organisers for making it all work, the sponsors for paying for great food and a lovely setting and the speakers for taking their time out to spread knowledge. You could pay an awful lot of money in conference fees for an experience nowhere near as good as this one.

If you ever get the chance to go to one of these in the future, you really should.

DDD North is tomorrow and I'm presenting

I’m getting rather excited. It’s DDD North tomorrow. Four tracks of excellent computing content crammed into the lecture theatres in Hull University. A whole day of splendid sessions.

And one from me.

I’m on at 2:30 pm in Lecture Theatre A in the Robert Blackburn Building talking about Azure Functions, Air Quality and a bit of LoRa. I’ve just finished the slide deck and the demos. Should be fun. If you happen to be on campus at Hull you really should come along. I’d love to see you.

Azure Functions with Azure IoT Hub

I really like Azure Functions. I love the idea that you can write pure code that sits in the cloud and just runs. Sometimes all you want is a thing that takes in some data, does something with it, and spits it out somewhere else. You don’t want to build and manage a server, set programs to run on startup, bind them to events and so on and so on. You just want a piece of code with a name and an address.

I’ve been using Azure Functions to capture MQTT messages and store their payload data. This turns out to be extremely easy to do, until you deploy your function in the cloud. Then it stops working. And you scratch your head and wonder what stupid thing you’ve done. You scratch your head, turn on lots of tracing and eventually find that the function is failing on load.

It turns out that one of the configuration items, the connection string to the IoT Hub that the program is using, is not passed over to the settings in the cloud app. You have to manually create the setting for the application and then set it to the required value. Then it all works. Wonderful.