Azure IoT Devkit

Image shamelessly stolen from the IoT Devkit site…..

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

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

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…

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

40830302503_8e49098ce5_z.jpg

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

48060254666_503165681d_k.jpg

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.

Making a PAX counter

PAX counter and plastic pig

PAX counter and plastic pig

PAX is an abbreviation for “passenger”. A PAX counter is a device that counts passengers, although you could use it to count people in lots of other situations too. One way to count people is to detect the devices they are carrying. I’ve built the PAX device above from the code here. It’s based on the Heltec WiFi Lora device and I’ve printed a rather neat little case for it too.

It listens to Bluetooth and WiFi. It doesn’t eavesdrop on anyone, or log data packets, it just counts the number of different device addresses that it sees and then sends the totals over LoRa to an application.

If you want to build it my strong advice is to use Visual Studio Code running under Windows 10 and with the PlatformIO framework installed. I used this and followed the instructions carefully and the program built and deployed without much fuss. I did get one warning about a missing configuration for the LMIC but this doesn’t seem to matter. The device works fine and I’ve even managed to send control commands back into the device over LoRa.

If you want to get a rough idea of passenger traffic at a particular location then I can see it being a very useful device. I’m a bit worried about privacy issues though, in that while it would be very hard to go from the MAC addresses of my devices to actually identify me directly, it would be trivial to detect that the same person has been to a particular place multiple times. This might be considered an encroachment onto privacy.

Whether or not you use the data like this is really down to self-discipline as an individual programmer, but then again they are already doing this kind of thing in shopping centres…

Spotting a smile with Windows IoT

48060254721_8f6444a77e_k.jpg

I’ve been working on my demos for the Insider Dev tour. One of the examples shows how to use Azure Cognitive Services to analyse a picture, find faces and see how happy they are. I’d like to use this in my demo, but I want to use the camera rather than a fixed image.

Anyhoo, I’ve got it working. The Raspberry Pi snaps a picture, sends it to the cloud and then gets back the location and happiness of anyone in it. I’m looking forward to showing it off next week.

I don’t intend to point the camera at the audience though……

Deal or Duel Game

deal or duel.PNG

I bought Deal or Duel on a whim. It seemed like a good price for a game with lots of moving parts and I liked the idea of setting up a pistol fight between King George III and Napoleon Bonaparte. We’ve had two goes at playing it now, and I must say it is growing on me a bit.

It is fiendishly complicated. And the rules don’t help much. There’s lots of details on some aspects, but others are left delightfully vague. There’s a knack to writing good game instructions and the people behind this game don’t have it. We had quite a few situations where it just wasn’t clear what should happen and we fixed the problem by making something up.

Having said that, it was quite fun to play, and you do get rather attached to the characters in your “roster”. The gameplay is peppered with American Independence facts that are interesting in a pub quiz kind of way and I’d like to have another go at it to try out a strategy that will involve picking fights with everyone.

If you’re prepared to put the time in, you can have fun with this game.

Heltec serial port problems fixed

48060352142_d46f965eeb_k.jpg

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!

IoT at the Insider Dev Tour

insiderDevTour.PNG

I’m doing some IoT sessions for the Windows 10 Insider Dev Tour. I’m in London on the 18th of June and Manchester on the 20th. If you fancy going I’m afraid they are all booked up, but there should be some recordings.

Anyhoo, I’ve been brushing up on my Windows 10 on Raspberry Pi skills. It’s come on a bit since I started playing with it a few years ago. You can create SD card images and deploy them from a single program. The Windows IoT Dashboard also lets you search for devices and there is now a neat device portal that you can use to remotely manage them. Deploying and debugging programs from Visual Studio is as easy as I remember. This is going to be fun.

Vader Immortal for Oculus Quest

vadar immortal.PNG

Well, that was embarrassing. Fortunately number one wife was out so nobody saw. Yesterday evening in the middle of light sabre training I managed to wallop one of the lights in the living room with my “sabre”. Quite scary to have the real world intrude on the virtual one. And I think I’ve broken the bulb in the lamp.

I was having such fun too. Once in a while you do something and think “This is the future”. Playing Vader Immortal is like that. The quality of the experience is first rate. The use of the controllers is very clever. The “sense of place” is very well realised. I particularly like the bits where you climb hand on hand up ladders and look down at where you’ve come from. And get a bit of vertigo. Once people have had a dose of this they will all want their own virtual reality. And quite right too.

I think the game doesn’t take that long to play. I’m deliberately rationing myself because I don’t want it to end. The first episode of the game is only 8 pounds or so, and great value at that price. If you have a VR device you should have a copy of this game. It really is the future.

Self destructing Apple Pencil

I’ve not used my Apple pencil much. And that turns out to be a problem. Apparently the circuitry is such that if a pencil isn’t charged and used regularly the battery can be irreparably damaged. Not cool.

For a while I’ve been convinced that this has happened to me. The power supply where I leave my pencil plugged failed and I had a pencil that didn’t work, even after charging with a working supply.

However, the good news is that all I needed to do was delete the pencil from the iPad and then re-pair it. The bad news is that anyone could make something which was so easy to break. I’ve turned on Nintendo DS machines after years of none-use and they have fired up without a problem. Sometimes in mid-game.

I think that sometimes Apple need to focus a bit less on making stuff that is awesome and more on making stuff properly.

Home the weary traveller and his Surface Go

48006649291_750fe43917_k.jpg

Another day, another six hour train journey. But then again it is quite a long way from Dundee to Hull. Fortunately I’d taken my Surface Go with me, so I could be properly productive on the journey. Even when it turned out that the mains sockets at my table on the train were broken. I did three hours on one train, then another bunch of work on the next one - that had working sockets which was nice. Pro travel tip: take an adaptor with a light on it so that you can discover which sockets are working before you sit down.

I love working with the Surface Go. It recognises me and give me a cheery hello when I start it up. It’ doesn’t make a fuss when I ask it to do something. It just gets on with it. Actions like opening Visual Studio provoke no reaction at all from the hardware, rather than the furious whirring of fans I used to get with my Surface devices. Yes, it is slower than them, but it does get there, it was half their price, and it gives me time to admire the scenery going past the windows. I even don’t mind the smaller screen, bearing in mind I’m having to carry it around. It’s a great device.

More Heltec Fun

heltec v2.PNG

Welcome to the blog all about the Heltec Lora 32 V2 device that occasionally mentions Rob Miles.

Last night I was feeling quite pleased with myself because I reckoned that between us we’d solved all the problems relating to our Air Quality sensor. We’d picked hardware that seems to work, a case that seems the right size and even got a power supply that looks like it will cut the mustard. We’ve even figured out how to attach the box to a lamp post.

I should know not to think things like that. In my experience it is just at this point in a project when something that has been totally reliable suddenly breaks for no reason. So it was with our Air Quality sensor. The LoRa transmission code broke. The driver locked up after only having sent one packet. Since this has never gone wrong before it was a bit of a scary head scratcher. Just before I’m due to head off to Dundee for some external examining too. Oh well.

Last night I did the very best thing that I could. I stopped thinking about the problem and walked away from it for a while. And today, that approach paid off. Coming back to it fresh I decided to look for some known good code on the Heltec site. At which point I found the following little gem:

#if defined(V1)
const lmic_pinmap lmic_pins = {
    .nss = 18,
    .rxtx = LMIC_UNUSED_PIN,
    .rst = 14,
    .dio = {26, 33, 32},
};
#elif defined(V2)
const lmic_pinmap lmic_pins = {
    .nss = 18,
    .rxtx = LMIC_UNUSED_PIN,
    .rst = 14,
    .dio = {26, 35, 34},
};
#endif

This is the code that maps the pins on the LoRa device to the driver software. And it is different for Version 2 of the Heltec device. Just in the “.dio” element. These are the numbers that map the indicator pins on the LoRa chip to the software expecting to be told things like “the last packet has been sent” or “a new packet has just arrived”. With the wrong pins assigned my driver was getting stuck waiting for messages that would never arrive. I fixed the numbers and all is now well.

These issues haven’t dimmed my enthusiasm for the device, I still think it is rather neat. However, I’m going to compile a little document that sets out all the differences I’ve discovered between the two versions of the Heltec device. For myself, if nobody else.

Laser Cutting at Hull Makerspace

lasercutting.PNG

I spent a very pleasant afternoon at Hull Makerspace laser cutting last week while the car was being MOT’d. I wanted to cut some chassis parts for the air quality sensor. I turned up with some files and my lovely Surface Go and set to it. By the end of the day I’d got exactly what I want and even been able to use the cutter myself.

Laser cutting panels is much, much faster than 3D printing them, and I think that the new design (you can see it on the right, looks really classy in smoked perspex. It will end up hidden in a box on a lamppost somewhere, but at least I’ll know the insides look nice.

They were busy giving help on programming and making stuff and there was a lovely buzz about the place. If you are interested in making stuff you should get down there and take a look around.