Talking Air Quality at South Hunsley school

David got in touch a while back. Would I like to talk to his students at South Hunsley school? Would I? Oh yes. So today it was into the bag with the Air Quality Sensor Top Hat and a few other goodies and then off back to school. They were a great bunch of folks. And they were even polite enough to laugh at my first (and only) joke. I was talking about air quality, hardware, self promotion and whatnot. I said at the time I’d put some useful links onto my blog (always a good way to drive traffic). Here they are.

To find out about the Arduino and get the software you can go here.

To make yourself poorer buying things from China you can go here. You can get cheap Arduino Uno devices, along with a whole bunch of other hardware.

If you want to buy one of the tiny LoRa enabled devices with a screen search for “Heltec LoRa”. The devices are sold in pairs for some reason, make sure you get the ones which are marked as 868Mhz.

You can also get the tiny cheap WiFi devices here, search for “Lolin D1 mini”.

If you want to get an air quality sensor you can get one of the good ones by searching for “SDS011”. If you want to measure temperature, pressure and humidity, search for “BME280”.

If you want some fun coloured leds search for “WS2812” followed by “ring”, “strip” or “panel”. These are dead easy to interface to any of the devices I’ve mentioned above. But make sure you get hold of a properly beefy power supply if you are driving more than 12 or so to full brightness.

I’ve not had a problem buying from China. In over 50 orders I’ve only had one not turn up, and I’ve only had a couple of broken devices.

You can find my Air Quality stuff on GitHub here. That has drivers for the hardware that you can buy and there are also circuit diagrams and box designs.

Byte ordering is a thing....

I’m upgrading the Air Quality sensor software so that I can send configuration messages over LoRa to the sensor. The thing I’m most interested in is the ability to tell the sensor the rate at which it should send readings. It would be useful to have a message sent every five minutes or so for testing, and then dial back the rate once the sensor has been installed. I’m using a tiny packet format to do this. The packet is three bytes long:

01 58 02

The first byte is the command number (there is only one command at the moment). The other two bytes are the number of seconds the sensor should wait between sending each reading. The value I want to send won’t fit into a single byte (a byte can represent an unsigned integer up to the value 255 and I want to have intervals longer than 255 seconds) so I’m using two bytes. The first byte is the “low” byte of the value I’m sending and the second byte is the “high” byte. In the tiny sample above the low byte is HEX 58 and the high byte is 2. This gives an interval of 2 * 256 + whatever 58 hex is in decimal. This boils down to an interval value of 600 seconds, or 10 minutes.

I wrote the software, tested it, installed it in all four of the sensors we are building and then set them off. I then sent the above command to the sensors to set 10 minute updates and then relaxed in the knowledge of a job well done.

And all my sensors stopped transmitting completely. Wah.

Turns out that I am an idiot. I’d done everything right except the last bit, when I’d sent the following command:

01 02 58

I’d got the MSB and LSB bytes the wrong way round. Rather than having 2*256 I now have HEX 58 times 256. A big number. A six hour or so number. So all my sensors were now not going to transmit for six hours.

Sending the new command wasn’t a problem, but because of the way that we are using LoRa the sensors only look for new commands when they send a reading. So I had to wait for six hours before the command would get picked up and acted on. This is something to bear in mind about LoRa. The remote node is not always listening for a message, it only turns on after it has sent something. This is one way they manage to get such impressive battery life for LoRa connected devices.

I managed to solve the problem by turning the sensors off and on again. They always transmit a packet when they start up so I was able to update the timing with more sensible values without having to wait six hours.

Shelf collapse chaos

That was scary. We were having a quiet coffee downstairs when we heard a noise rather like the one that a house makes when it falls down. A tsunami of bangs and crashes that must have lasted a minute or so. We hurried upstairs to find out what was left of the top half of the building and expecting not to find much..

It turns out that one of my shelves along the top of my project room had come loose, depositing onto the floor all the boxes and bits and bobs I’ve been stashing up there for the last few years. The good news is that nothing was broken that didn’t deserve it. I’ve put most of the stuff back, given everything a proper tighten and I’m going to keep an eye on it in future. Such excitement.

Final day in Iceland

Last day in Iceland today. We visited the capital city which seems to be less like a capital city than pretty much any other place I’ve been. There is some stunning architecture, some lovely art galleries and a whole slew of souvenir shops (almost as many as there are in Whitby) but there was not the level of hustle and bustle that I have seen in most capitals. Not that this was a bad thing, it was nice just to be able to saunter round from one really nice place to another.

Home tomorrow. Oh well.

Keflavik and the Blue Lagoon

Today finds us at the very edge of Iceland, up past Keflavik at the Garður Old Lighthouse which also hosts a really nice restaurant. The weather is trying to make amends for being super wet earlier in the week, not that it has stopped us doing much but it does rather spoil your photographs when you can’t see the top half of the sky for cloud. Anyhoo, this is an amazing place. Even better in good weather.

For the afternoon we headed to the Blue Lagoon, a hot spring that is a “must visit” in the same way that Disneyland is a must see if you ever go to Florida. Just like Disneyland it was expensive, but the experience was worth it. You are out in the open in cloudy blue water that is around the same temperature as a warm bath. Apparently the minerals in the water are good for your skin. There are also mud packs which we tried (they were included in the package). The consensus of the folks around me was that the mud pack didn’t do much for me. The only comment of note was that I looked slightly less scary once I had washed it off.

The spa is surrounded by amazing landscape.

Travelling the Golden Circle

What with me now being a confident Icelandic driver we thought we’d spend today driving “The Golden Circle”. After “sanity checking” the route with the ever-helpful hotel staff we headed off into the unknown on the wrong side of the road….

Actually, I’ve decided that it is not “the wrong side of the road” if everyone is doing it. Not that this is stopping me getting this ghastly frisson each time I see a car coming towards me on the “wrong” side. Then I realise that I’m on the wrong side too, and all is well. Roundabouts are a challenge though, it feels as if I’m deliberately turning into the face of oncoming traffic when I enter one.

Anyhoo, we set off with a bunch of locations programmed into the phone. It all worked splendidly,. I’d taken my venerable old Fuji FX100 camera and managed to get some reasonable pictures. You can click through the images to larger versions on Flickr if you are so minded.

Heading to Iceland (not the shop)

We were up bright and very early this morning to fly to Iceland. Silly me, I thought that because our flight left at 6:30 am the airport would be pretty much deserted when we arrived. Not so. It turns out that, probably because of airport fees or something) that the place was absolutely packed at 5:00 am. Folks were downing lagers and bottles of wine in preparation for their trips. Good for them. We made do with a coffee and a bun.

Never been to Iceland before. We’re staying at a little hotel just outside Reykjavik for a few days. We’ve hired a car too (such bravery). Should be fun. We’ve already discovered that there is a waterfall a few minutes walk from the hotel.

Raspberry Pi Model 4

I remember when the Raspberry Pi was first announced. A credit card sized proper computer which cost 25 quid? A likely story.

Twenty five million sales later, the story is looking more likely than ever. And now we have version 4.0. This version is interesting for a whole bunch of reasons. They reckon it has around twice the speed of the previous version, and you can now get it in memory sizes that go from 1 to 4 Gbytes. It now supports two monitors and 4K video output (although its a bit tricky if you try to use both at the same time). It also has two USB 3.0 sockets and the specs speak of much faster data transfer. The mounting holes look to be in the same place, and the pin-out for the “hat” connector is the same, although the pins can be re-purposed to get some extra I2C and serial ports which is very welcome.

The bad news is that there are a few “breaking” changes from the previous device. The video sockets are now micro-HDMI and there are two of them, which means that case designs will have to change and you’ll need to change your video cables. The power is now supplied via a USB-C socket and you need a bit more of it. The days of hanging a Raspberry Pi off a USB socket on a PC may be over. And if you want to get full speed all the time (or play with overclocking) you’ll need to add cooling to prevent the processor slowing down when it gets too warm.

But this does mean that you can consider using the Pi as a desktop replacement. I know they say that with every new release of the platform, but this time it might actually be true. The extra ram will make it possible to multi-task with ease, and the faster USB sockets mean you can connect fast hard drives too. However, having said that, I reckon that the extra power is interesting because it makes it easy to use a Pi as a proper “edge computing” device. It should be very possible to run some proper AI on this platform, allowing you to put a lot of computing power right next to your sensors, which makes things very interesting.

I can’t find any word from Microsoft as to whether the IoT version of Windows 10 will be ported to the Raspberry Pi 4. I really hope that it will be. Windows 10 on this platform would be awesome.

I’ve ordered myself a device, I’m looking forward to it coming and having a play.

A Lora Gateway of my own

I’ve been playing with LoRa for a while, and I’ve even got a tiny single channel gateway at my house that mostly works.

But last week Adam loaned me a proper The Things Network LoRa gateway to play with.

It’s awesome.

For a start it has a proper 8 channel receiver. This means that it can receive all the messages. For another thing, it has a proper antenna. The result has been that over the air authentication (which used to be hit or miss) works first time. And I can reliably send messages back to the LoRa device when it checks in.

Suddenly all my sensors are reporting results with rock solid quality of service.

I really hope Adam doesn’t ask for it back in a hurry…

Cables for a pound each

If you’re looking for some cheap cables I can recommend you wander down to your local pound shop. I’ve been using their cheap usb cables for a while and they work a treat. They are especially useful if you want to connect up a Wemos or Heltec device to a power supply. They have a good length, 1.5 m, the connectors are sturdily attached, they are packed in a nifty little bag and they only cost one pound each.

Astonishing.

I’ve also been using their one pound HDMI cables and they seem to work fine. It seems that electricity doesn’t mind the price of the wires that it travels down…..

Try Microsoft Edge Insider

If you like Google Chrome I think you’ll like what’s happening to the Edge browser. The latest versions are being based on the same rendering engine. I’m using the latest dev build as my “daily driver” browser at the moment. It seems snappier than Chrome, has some interesting new features and I’m fairly sure it is not sending details of all my browsing back to Google high command. Which is nice.

If you want to have a go, and I think you should, you can download different flavours from here.

Azure IoT Devkit

Image shamelessly stolen from the IoT Devkit site…..

At the talk yesterday I mentioned the Azure IoT Devkit. This can be used as an IoT Endpoint for Azure among other things and has the benefit of a properly secure architecture including proper security to prevent details being stolen from the device or the device being compromised by naughty firmware. It also has a nice little OLED screen and a whole bunch of useful sensors.

You don’t develop for this device using C# and Visual Studio, but you can use the awesome Visual Micro or Visual Studio code to work in C++.

It’s a great place to start creating proper cloud connected devices.

Insider Dev Tour Hardware Mayhem

Picture of a missing train

I should have expected trouble when I discovered that my first train to Manchester didn’t exist. Even though the station display confidently predicted its arrival, and the app on my phone showed a dot moving down the rail line the actual bit lump of moving metal failed to turn up. Not impressive.

Fortunately, I was able to catch the next train (which did exist) and then make it to my connection with literally seconds to spare. Then all I had to do was walk through a cloudburst to the venue in Manchester.

Once I was inside and dried out, things improved a lot. Free coffee and some great sessions. I’d bought a whole bunch of hardware with me and I planned to spend my lunch hour setting it up and making it work.

I got all the way to the end of the setup and then my demonstration Raspberry Pi decided to fail completely. No idea why. Life I suppose. Perhaps last night fate heard me thinking “No need to take a spare device, it all worked fine in London”. Anyhoo, even rebuilding the entire operating system failed to bring the machine back to life and anyway, it seemed that the rather picky video display at the venue refused to talk to the Raspberry Pi at all.

Fortunately I had a plan for this too. It involved my LogoBlaster. In the end I was able to do the Raspberry Pi presentations using the projector on the LogoBlaster to show everyone how a Windows Universal Application can interact with hardware and Azure services. Thanks to Luce and Pete for holding up various devices and helping me get it all to work.

A very patient audience. Thanks folks

If you want to play with my demos, you can find them all here.

You can find all of the Insider Dev Tour lab conten (there’s tons of good stuff) here.

Insider Dev Tour London

A happy audience at the start of my session. Aren’t they always…

We took our Manchester Insider Dev tour to London today. I was there with a Raspberry Pi, the Logo Blaster, and my trusty Surface Go. I’d made all kinds of plans for network and video contingencies, and I was very pleased to find that they had two (yes two!) wired connections and a really fancy video switching system, along with a bunch of fantastic tech folks who knew how to make it all work.

All the sessions I saw were great. I always leave these events with lots of thing to try and ideas for building stuff. When it came to my session I managed to get everything to work eventually. The Surface Go got there in the end, and left me plenty of time to tell all (both) of my wonderful jokes.

Many thanks to the XamlLlama for stepping in when I realised I’d forgotten my mouse to trigger the cognitive services demo and even providing a winning smile for the camera (that was even recognised correctly).

For those who were there yesterday I’ve put all my code up on GitHub here.

On to Manchester on Thursday.

Bandwidth idiot

So, today I’m doing the final tests for my sessions this week at the Insider Dev tour. My plan, such as it is, involves hanging all my devices off the mobile hotspot in the phone. I was testing the whole workflow, including creating a new Windows 10 image for the Raspberry Pi. While I was doing this I noticed that the network was a bit slow. Not painfully so, just slower than I expect in my Lighstream powered house.

Of course, it turned out that I’d done the entire exercise, including fetching the Windows 10 image, on my phone. This is both impressive (it’s nice to know that you can do this kind of thing over a phone network) and potentially expensive (I’ve no idea how close this has taken me to my limits for the month).

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.