Soak testing air quality sensors


For the last few weeks I’ve had four air quality sensors sitting on the windowsill in the house that faces the nearest LoRa gateway. I’m soak testing the devices prior to putting them on lamp posts around Hull.The air quality in that room must be one of the most highly measured in the county.

Anyhoo, one of the devices decided to try and spoil Fathers Day today by falling off the LoRa network. It was one of those situations where I really hoped that it was properly broken. There’s nothing worse than something that goes wrong every now and then. Unfortunately the darned thing came back to life at the end of the day, and so we are going to replace the CPU. My number one suspect is the antenna connection, but we’ll have to do some tests to prove this.

And no, it didn’t spoil the day. Had a lovely meal out and got some splendid presents.

Heltec serial port problems fixed


One of the great things about working with other people is that if you get stuck you can simply hand the problem over to someone else. For ages I’ve been having problems with the serial connection between my Heltec device and the PC failing. I’ve tried all kinds of remedies and even thought one or two might have fixed it, but no. It’s a really frustrating problem because when the connection fails I have to re-boot my PC to make it work again. This rather slows down development.

So, I asked Robin to take a look. He put an oscilloscope on the power supply and looked at what happened when the air quality sensor was turned on. This sensor has a little fan on it and it turns out that this draws quite a bit of current as it begins to rotate. This causes the 5 volt supply to drop to 3 volts for around 50 microseconds, which breaks the USB connection on the Heltec.

Putting a 470uf capacitor across the Heltec power supply fixes this. So we now have fully working serial ports. Yay!

Lamp post sensor mountings

lamp post.PNG

I’m not sure how many of my readers really want to know a good place to get plate to mount air quality sensors on a lamp post, but if you do I can recommend these. They seem pretty strong and two of the fixing holes line up neatly with this box.

If you’re prepared to shop around and wait for delivery from China you can get both these items much more cheaply than the Amazon prices.

Always put a hole in the bottom

Note that this is not our air quality sensor. This is a nuclear warhead. Almost as complicated….

Note that this is not our air quality sensor. This is a nuclear warhead. Almost as complicated….

Had a great meeting with John today about the Air Quality sensors that we are going to fit on lampposts around the city. He had a couple of pieces of very sensible advice.

  • don’t make holes in the top where the water can get in

  • make a hole in the bottom where water that gets in can drain out

It's often a power supply problem. Especially if it can't be.


I've been working on an an air quality sensor that we are hoping to attach to a lamp post somewhere in Hull. I’ve got the hardware just about sorted (as you can see above) and the software should work fine.

But it doesn’t.

As soon as I connect everything together the serial interface to the host computer stops working. This is not a problem in operation, but it makes it hard to configure the device. I spent a little while trying to find out how the software could behave in this way and failing. After all, it works fine in other devices that I’ve made. And then I realised a very important aspect of embedded development.

“It’s often a power supply problem. Especially if it can’t be.”

The problem appears when I connect the SDS011 sensor. This is not particularly greedy in power terms, but it does take a bit more out of the device and this seems to tip something over the edge and stop it from working. If I add a second power rail to a different point in the circuit all is well. Now, it might be that the Heltec that I’m using is sensitive in this way, but we can’t have unreliable devices. I think I’m going to have to acquire some PCB design skills and make a proper carrier board with sends the power to all the right places.

Making bendy pipes with FreeCAD


Achievement unlocked. I now know how to make “bendy” things in FreeCAD. It’s actually not that hard once you work out what FreeCAD needs to know. Essentially you use one Sketch to define the path of the template and another (which should be at right angles to the path) to define the closed shape to be created. You can even add another closed shape at the end of the path and then have the shape smoothly change from one to the other. I’ve used this to create tapered tubes.

I’m doing this to make another Air Quality sensor. I want to send the air path round a curve that is too tight for pipe. I also want to add a “u-bend” so that it is harder for water to get into the sensor. I’m quite pleased with the above. Now I just have to figure out how to mount it in the case….

Air Quality Fun at Leeds Sharp

Some of the audience at the start. Note my lovely Surface Go running the whole thing…

Some of the audience at the start. Note my lovely Surface Go running the whole thing…

Had a great time at the Leeds Sharp meetup tonight. I was there to talk about Air Quality, Azure Functions and Lora. With a guest appearance of my Air Quality top hat. I’m pleased to be able to report that every demo worked. Even the impromptu one that I wasn’t expecting to…If you want a look at the slide deck you can find it here.

One of the lovely things about the night was that the first two folks that I saw at the venue were a couple of Hull alumni, Joshua and Andrew . They were there to make a video of the event. So they did. It’s really good, they’ve caught the presentation content along with some shots of me prowling around looking nervous. I think I’ll hire them for all my events. They’ve put the video on YouTube, you can find it below.

Air Quality, Lora and Azure Functions at Leeds

I’m treading the boards again on Thursday evening this week in Leeds. I’m talking about our work with Air Quality sensors and whatnot. With a special guest appearance of the Air Quality Top hat. Should be fun.

If you live in Leeds you can register here. If you don’t live in Leeds you can still travel there and attend if you wish, but I’d probably draw the line at intercontinental flights to get there…..

Please note that, in a break with recent tradition, this session will not be rhyme. (unless they offer me money)

Laser Cutting at Hull Makerspace


I really like it when I head out of the house with the intention of achieving something and then actually manage to complete the task. Today I headed down to the wonderful Hull Makerspace with the intention of completing my air quality sensor mount design and maybe even cutting it out of perspex.

And that’s exactly what I did.

Fair enough, some of the holes are in the wrong places and some are completely missing. But a little drill work and my first prototype is now ready to be fitted.


The holder has our custom circuit board on one side and the SDS011 sensor on the other.

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

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.

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.

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.

Building the Monitair Configuration Interface


I’ve got the web based configuration for the Monitair working quite well now, but it is a bit of a faff to use. You have to connect to the WiFi access point served by the Monitair device and then navigate to the web page it is hosting.

If you have got the device connected to your PC, perhaps to download the software, it would be nice if you could configure the settings via the serial interface. Well, you can now. I’m using the same data source as is used to generate the web page, and I’ve added some useful commands as well. Now you can set any of the values in a device straight after programming it, which is rather nice.

Building the Monitair Configuration Page


The new configuration web page for the Monitair sensor is taking shape. Above you can see the “home page” that the sensor displays during setup. Rather than having one enormous page of settings we now have links to sub-pages which contain different setting categories. The page is generated from a data structure so that it is very easy to add new settings.


These are the simple settings for the device. You can leave everything else at the default values and the sensor will just work on the Connected Humber MQTT broker. The only things you really need are WiFi connection details and the MQTT password. If you happen to know your location details you can put them into the form so that the sensor readings can be displayed on the map. When you click Update the settings are written into EEPROM on the device. You can use the advanced configuration pages to select things like the hardware pins that various peripheral devices are connected to. I’m rather enjoying writing this…

Cottingham Parish Council

After an awesome hardware meetup at c4di tonight Robin and I went on to a meeting of Cottingham Parish Council. We were there to talk about Air Quality, something we are quite passionate about - what with us having done quite a lot of breathing over the years.

As it happened they were discussing an air quality issue just before we were introduced, which gave us a lovely context in which to describe the work of the Connected Humber Group on designing, making and deploying sensors around the area.

Everyone was very interested and I it looks like we’ll be working together in the future on this, which is lovely.