Starting with the Azure IoT DevKit

31326585068_8e0b2552ad_k.jpg

Today I thought I’d have a proper play with the Azure IoT Devkit. There’s a ton of content out there about getting started. It’s actually quite simple to follow. In it’s simplest form you just follow the instructions here, but since the device has a proper security chip I though I’d veer off and see about using the Azure IOT device provisioning service and an X-500 certificate to create a very secure device. It’s another of the built-in examples that are provisioned when you add the Azure IoT Workbench to Visual Studio Code.

Rather pleasingly, I got it working. I’m now looking at making the device into an air quality sensor, just as soon as I can figure out how to get the serial port on the IoT board working.

There’s also an example where you can speak to the board in english and have it display the translation in a language of your choice. Great fun.

Cloud Connected Camping Lights

20180728_125007748_iOS.jpg

I was in the Pound Shop over the weekend looking for camping lights. What with we me going camping in a month or so. I'm going to the Electromagnetic Field event at the end of August, and I've been buying sleeping bags and contemplating life under canvas for a few days. 

I found a likely looking light in a camping shop for a fiver but being from Yorkshire I thought I'd take a look at cheaper solutions. I found the lights above, packed in a nice little box, for a pound a pop. Astonishing value, so I bought four. 

Then I got to thinking about making the light more interesting. I've done this kind of thing before and I had some pixel rings and Wemos devices lying around, so I thought I'd have a go. Worst case I'd break a light that cost me a pound. 

20180728_125201067_iOS.jpg

This is the light dismantled. I undid the screws that held the base on popped the top off and then slid the transparent cover down and off the bottom of the light. Then I used a knife blade to pop the plastic reflector off the top to reveal the pcb that holds the 11 white leds. I'm going to replace this with a 16 led neopixel ring which just fits. You can get these rings for around 8 pounds, or much less if you're prepared to wait for them to arrive from China. 

20180728_125233162_iOS.jpg

The plan is to fit the led ring a shown above, drill some holes in the plastic support and run the wires behind through them, providing a connection and also holding the ring in position. I can bring in the hot glue later if I want to make things even more secure. 

20180728_125925209_iOS.jpg

I held the led ring in position, scratched marks on the reflector and then drilled the holes. I'm not very pleased with the bottom hole, but I don't think anyone will see it. I'm only using three of the connections, but I drilled four holes so I didn't have to remember which was the one I don't need. 

20180728_130354241_iOS.jpg

These are the wires that I made up for the connections to the led ring. I used solid core wire. I'm connecting to the ground, 5Volt and Data input lines using black, red and white wires. The colour of the wires doesn't matter much, as electricity doesn't seem to care about wire colour.

If you read the Adafruit help pages for the Neopixel ring they talk sensible things about series resistors and capacitors that you can add to improve the signal to the led ring and reduce the chances of damage. I'm leaving those out because I like to "live on the edge", but you might want to add them if you build a light like mine. 

20180728_131000274_iOS.jpg

This is the led ring after I fitted it to the reflector with the wires pushed through the appropriate holes. Looks quite tidy to me. Next up we have to take a look at fitting the processor board to the light. 

20180728_131654449_iOS.jpg

This is how the lamps are made. They have a slide switch which controls power to the led ring. It's a bit hard to see, but there's a series resistor on the positive side which is wired from the battery terminal to the switch. I'll use the switch to turn the device on and off. 

I'm going to add an ESP8266 device on the Wemos platform. I love this device and configuration, and it just fits. It will give me WiFi for connectivity and my plan is to port my wedding light software onto the Wemos platform. 

20180728_134728884_iOS.jpg

This is the device with the signal and power wires soldered in. For some reason I was nervous about soldering solid core wires onto the Wemos PCB and so I soldered in some jumper cables instead. I've done this before and it's a good trick. Rather than soldering a socket and then plugging into it (and having the worry that the plug might come out) instead I just solder the plug straight in. I'll cut the plugs off the other end and wire things up by twisting wires together, soldering them and covering with heatshrink tubing. Probably not as posh as using proper connectors, but much cheaper and at least as reliable.

I'm using one data pin to control the lights. Just because I'm moody, I decided to solder this wire in directly. I stuck the Wemos device onto the back of the reflector using some sticky velcro tape that I got from Maplin. I'm really going to miss that shop.

20180728_140214682_iOS.jpg

This is the completed processor fitted to the reflector. I've done the wiring and so I now just have to power up the device to get it going. This is also a useful stage to reach because now that I've connected the power lines for the leds and the processor together I can plug the Wemos device into the PC using a USB cable and test that the lights work. So I did this. There will now be a short break while I get the software together. 

20180729_153303529_iOS.jpg

Writing the software took longer than I expected because I found a bug. However, once I'd fixed that I turned my attention to the base of the light. I soldered some new wires to the switch and onto the battery terminals. Now I just have to connect the red and black cables to the ones on the processor and I'm good to go. 

20180729_154325889_iOS.jpg

This is the lights and the power all soldered together. I've made the wires much longer than they need to be, this is so that it will be easy to pop out the reflector and re-program the Wemos when I find another bug.

20180729_155119003_iOS.jpg

This is the light in action, just after I'd asked it to turn green.

I'm presently using MQTT to connect to the Azure IOT hub and sending text commands to configure the light. The commands are a subset of the HullOS language that I've been using on the Hull Pixelbot. Next I want to make a controller device that pushes commands up into the cloud to tell the light what to do. 

If you're looking for something to play with I can strongly recommend this light. There's a reasonable amount of space to play with - I'm thinking of adding a temperature sensor so that the light can change colour depending on how warm it is. I've discovered that I can perform my light flickering at the same time as wait for MQTT server commands and it all seems to work splendidly. I'll put the code up on GitHub when I've tidied it up a bit. 

 

With a bit of care you could  take the original 11 pixel ring and cut the tracks on the pcb so that each led could be controlled individually, perhaps by an Arduino Pro-Mini to get a really cheap controllable light device. 

HullPixelbots at AzureCraft

 HullPixelbots on parade

HullPixelbots on parade

Well, that was fun. It was the first proper outing for my robot army. We were all at AzureCraft in London. It was an absolutely great event, kids getting together to make things in MInecraft. And learn to program along the way.

I'd set up my Robot Arena in one of the board rooms at the fantastic venue. Over the day groups of kids and parents came to take up the challenge of controlling their robots and getting them to line up in the arena with no collisions. Harder than it looked, but everyone who came along was up for the task. Quite a few folks came back for another go, which was nice. 

Great fun. Thanks to the folks at the UK Azure User Group for setting up the event and inviting me along. 

 A tense moment as the pixels line up...

A tense moment as the pixels line up...

Surface Dial controlling a Hull Pixelbot

I've managed to get my hands on a Surface Dial. It's a spiffy new PC control that acts like an, er, dial. You can use it to manipulate value in programs in a very precise and controlled way. The dial works best with the Surface Studio (which I've not been able to get my hands on) but you can use it on any PC which has Bluetooth. It appears as a Human Interface Device and has a really simple API that you can use to make any of your programs dial controlled. 

I wanted to use it to control the movement of my Hull Pixelbot and, after only half an hour or so of coding I had it working. 

It's not a particularly direct form of control just yet, but that is because of the way I'm sending control messages via the Azure Internet of Things hub, which is not really created for such rapid messaging, but it does work, which is rather nice.  I made a "hotel vision" video of the program working. I'm going change the code to make a more direct connection to the robot. 

Of course, what I really want is two dials on the PC, one for speed and the other for direction, but just at the moment you can't connect two Surface Dial devices to a single PC. 

Martyn Talks Azure at C4DI

I like going to the C4DI developer meetups. If you are a programmer and you are based in Hull, you should go along too. You can sign up for developer and also the hardware meetups here

Anyhoo, this month we had Martyn Coupland talking about Azure. Martyn works for Inframon as a "Senior Cloud Architect". As he said his job title I had this vision of a meeting full of serious faced engineers saying things like "And this is our new Cumulonimbus 5000, with extra fluffy light bits...". But that would be silly.

What Martyn actually does is map business process onto platforms based in the "cloud". The cloud is basically a bunch of computers on the end of a high performance network connection. It is how you turn computing into a service, rather like water or power, which you can buy based on your needs.

If you have a thing you want to do, for example host a web site, provide the back-end for an application or even run a business, the first thing you do isn't buy a big rack of computers. What you do is talk to someone like Martyn who will design you a system that lives in the cloud.

If your idea takes off big time you don't have a problem, you just crack open the champagne and turn on more cloud based processing power. If your idea sinks without trace you put the champagne back in the fridge, chalk it up to experience and work on the next project, reflecting that at least you haven't got a room full of expensive hardware to get rid of.

Martyn gave a very good rundown of how Microsoft Azure works and how good it is. I knew a bit of this from the Rather Useful Seminar by Caitlin and Peter but it was very interesting to hear how it has progressed even in this short time. Most amazing fact for me was that the majority of Azure installations don't run Windows software. I forget the figure (forgot to write it down) but there are a huge number of open source solutions sitting out there on Microsoft infrastructure. It turns out that you can build an image using your favourite operating system, whatever that is, and then deploy it into the cloud very easily. 

At the end of the talk I was chatting with Martyn about Hull Pixel Bot and mentioned that I plan to make the robots all clients of an Azure based location and communication service. He reckoned that it was eminently doable, which was good to know.  He'll be coming back to Hull to do some more, implementation focused, sessions later in the year. He's also an MVP, which is nice.

Azure Rather Useful Seminar from Caitlin and Peter

 Caitlin and Peter looking relaxed at the start

Caitlin and Peter looking relaxed at the start

Caitlin and Peter, two of our students,  gave a Rather Useful Seminar today all about Azure. I like it when students give seminars. There are a few good reasons for this:

  • students tend to know what is relevant to other students and can pitch the material accordingly
  • It's a great experience for the students to actually give a presentation to an audience
  • I don't have to do any talking, I can just sit and watch

Anyhoo, they showed us how easy it is to build a cloud based service that your program can then use, and that all this cloudy goodness is available for free via Microsoft DreamSpark

At the end of their talk I asked for a show of hands for anyone interested in learning more, and perhaps taking part in an Azure jam session in one of our labs. Pretty much every hand in the room went up. Including mine. 

So, in the next week or so we'll see about booking one of our labs for an hour or so and having a go at building a web application from scratch. Should be fun.

Thanks to Caitlin and Peter for putting Azure into context so nicely.