Hardware fun at C4DI

I could tell you what this is, but then I'd have to kill you....

I could tell you what this is, but then I'd have to kill you....

We had another great hardware meetup at c4di this week. Some new folks who turned up to see what all the fuss was about, quite a few HullPixelbot devices wandering around and some very enjoyable technical chats about this and that. 

The next meeting is at the start of November. You can find all the Hardware Group meetings, along with other c4di meetups, here:


Programming and DIY


I'm not very good at DIY. But I'm the cheapest labour I know, and so I've had a fair bit of practice over the years. As I was laying down each of the strips of flooring yesterday I got to thinking about how the experience of my decorating efforts maps onto writing code. I think there are some parallels here. 

When I started doing DIY I'd measure everything and then cut to precisely the dimensions that I had measured. Then I'd find that none of the corners in the room were square and that lots of my carefully measured items were the wrong size. I'd also find that, because I'd sometimes misinterpreted the numbers from my careful measurements, I'd make things the wrong size anyway. Unhappy times. 

Nowadays I don't measure anything. I hold up the next piece of flooring against the hole that I'm filling at that time, mark it off and then cut it directly. If the size of the room changes as I move down it (and it does) then my process will automatically take this into consideration. And because I don't write things down there's no chance of any errors creeping in.

You can have exactly the same experience when you write software. If you establish the specification at the start and then just build the thing you can be pretty much sure that it will be wrong. Much better to make something, play with it, and then build on top of that. By iterating and refining as you go you'll end up with a much better product. 

Oh, and one other thing I do is work "with" the job rather than against it. If I cut a piece of flooring a couple of millimetres too small there'll be a tiny gap that hardly anyone will see and nobody will care about. If I cut the flooring two millimetres too big it won't fit, which is much more of a problem.

In a programming situation you need to find out what things about the project are critical and make sure that you get those things right. It's also useful to know where you have some flexibility in the specification. Remember that there is no such thing as a perfect solution, just ones that make the user happy and ones that don't. 

At the moment (i.e. nothing has fallen off) the results of my job make me quite happy. 

A break in Bristol


I've got the painting finished and the next step is to sort out the laminate I'm fitting in place of carpet. I always new there'd be a floor in the plan....

Anyhoo, bad jokes aside, we've headed to Bristol for a few days of being in a house that doesn't smell strongly of paint. As you do, we went for a walk around town and managed to climb Cabot Tower. It has a tiny spiral staircase to the top which gets quite exciting when you meet someone coming the other way. 

However, the view from the top is worth the tricky climb.  You can click through the picture to see the whole panorama in its glory.

Mending a Pinball Machine with a Toothbrush

I fired up the pinball machine yesterday. First time in a while that I've used it. Everything was fine. Except one thing. The menu button was not working. This is kind of important; it's how you select all the various options to set the machine up. With that broken I'm kind of stuck with the default settings, and I can't set the date and time (which the clock has forgotten because the battery backup has gone flat). 

Oh well, nine times out of ten this means that either the switch is broken or a wire has come loose. Unfortunately, after a few minutes of investigation I discovered that the switch, and the wiring to the CPU board were fine. It got worse when I looked even more closely at the board itself. The batteries, which to be honest are rather stupidly located, had dumped their alkaline contents over the circuitry and left a trail of corrosion and damage. Not good. 

So today (after discovering that replacement bards are available but cost around 150 pounds) I popped the CPU board out and took a look. Step one was to get rid of all the alkaline deposit. I used a toothbrush and some diluted white vinegar to sort that out and then washed the board liberally with isopropyl alcohol to clean things up. 

Then I spent a very happy (and I actually mean this) hour or so tracing the faulty signal from the input pin through the circuit board on its way to the processor. Pro tip: Print out a picture of the pcb so that you can draw the trace on the top, like I did above.

Anyhoo, the signal went past all the dirty bits of the board, so I made ultra sure that they were all squeaky clean and there were no deposits bridging any of the connections. I also used my meter to ensure that all the signal paths were OK. After I'd popped the board back in I fired things up and I had my enter button back. Yay.

I'm going to keep an eye on the batteries from now on. I'm going to play more pinball. And I'm going to get another toothbrush.  

Visual Micro Still Rocks

I bought Visual Micro a while back. Not that I really needed to. The free version is actually plenty powerful enough for day-to-day use. It was just that I thought the product was so good that I really should support it.

For a registration you get a key that works on three machines. I've been through a few machines over the years (as you do) and last week I found that my key didn't work for my desktop. I emailed them, they cleared the key and I'm back in business again. Thanks folks. 

If you are in any way serious about embedded development you should get this tool. The free Arduino SDK is OK for a while, but you'll fairly quickly hit limitations that will grate, and with Visual Micro you get all the lovely intellisense support and general niceness that comes with developing code in Visual Studio.

Visual Micro now works with all the esp devices and pretty much anything Arduino shaped as well. It's got some very interesting debugging support too, but I tend to rely on code instrumentation (print statements) when I'm writing embedded code, so I don't use it very much. Go get it. 

Hull Photography Festival

If you are in Hull I strongly, strongly, STRONGLY urge you to get down to the ground floor of Princess Quay Shopping Centre in the middle of town and take a look at the awesome photographs there.

I knew that there's a photography festival in Hull around this time of year but I'd no idea just how great it is. There are loads of exhibitions and also a whole bunch of special events over October which are worth taking part in if you're any kind of photographer, or just like looking at a lovely pictures. 

If you head to Princes Quay you can pick up a beautifully produced programme for the month. Alternatively you can get a look at the program here

HullPixelbots racing at Techdays NL

We had an amazing session today at TechDays NL. I was talking about the use of the Microsoft Bot framework to control physical robots via the Azure IoT Hub. I had a couple of robots linked via MQTT to the cloud and delegates could use a web interface to a chatbot to try to drive them around the room.

This was the web interface we were using. Half of the room was controlling the red robot and the other half were driving the white one. It was quite fun to watch as the robots inched towards the finish line. Eventually the white robot managed to win and one of the white team was awarded the big prize of a HullPixelbot platform.

The slides for the presentations will be available via the TechDays NL site soon. I'm also going to post all the source code (minus all the keys and passwords) next week. 

A tense moment in the race

A tense moment in the race

Would you buy a used HullPixelbot from this man?

Would you buy a used HullPixelbot from this man?



Using a Raspberry Pi as an Access Point with Windows 10

I've got a few things running for my TechDays sessions next week. They are working fine on my home network. Now, I know that the conference will have WiFi, but in my experience this can be problematic. Sometimes they use browser based authentication steps which are hard to replicate on a device with no screen, keyboard or mouse. 

But I have a plan. I've got a portable access point that I use on occasions just like this. I know exactly which shelf it is stored on, in a nice little case and everything. So I go and grab it. Of course it's not there. It's not anywhere. Blarst.  

However, I do have a Raspberry Pi 3 which I was planning to take along as well. And it turns out that it will work as an access point too. And setting it up is a dead doddle. I started with the howto here. That got me the Windows 10 IoT Core Dashboard which is an awesome little program that will create an SD card to use to boot your Pi and then take you through connecting and configuring it. The great thing for me is that it lets you use a "naked" Pi, with no keyboard, mouse or screen. All the configuration can be done via the browser based control center. 

If you want to turn your Pi into an access point just head for the IoT Onboarding page you can see above, select a suitably obscure SSID and password and then save them. (I'd advise against the defaults). After a reboot you should have an access point which clients can connect to. 

If you want to share the wired network connection from your Pi you have to actually turn this on. The user interface here is a bit rubbish to be honest. There's nothing I could see that indicates if the sharing is on or off, and you have to make sure that you connect the right adaptors at each end. Which is why you might find the screenshot useful. Just select the items that you can see in the "Access point adaptor" and "Shared network adaptor" and then click the "start shared access" button. And then it all just works. Awesome. 

One tiny gotcha. On my Pi the SSID gets a bunch of hex characters added to it.  HullSSID would probably change to XY_HullSSID_ED50. Browse for the WiFi connection with another device before you put the text into a client program.

Building a Joke Alarm for Techdays

I'm doing a couple of sessions at TechDays next week. I'll be showing off a few HullPixelbots and a "Joke Alarm Button" device. The idea is that if I every say anything funny I can press the button and tell the world via Azure. I've no idea how I'm going to test it. 

I've fiddled with the software and now it's time to build the hardware. I've had the box for ages. It is large, yellow and has a big red button on the top. Today I thought I'd put something behind the button. The active component is my favourite device of the moment, the Wemos D1 mini. So I got one, programmed it up and connected it to the light in the button, expecting a light to brightly illuminate the button in an "impress the audience" kind of way. 

It was rubbish. A weedy little led that I could hardly see.

By now I was coming to the conclusion that today was going to be one of those "hard fought" days. By that I mean that everything I try to do will be difficult. Pin numbers will be wrong, leds will be wired the wrong way, some things won't work. And I'll probably burn my fingers at some point. 

First thing I tried was to add a little amplification to the led. The esp8266 is a wonderful device, but it doesn't put out much power. So I popped in a transistor to add some amplification and waited to be blinded. I wasn't. So next I found a larger led. Still rubbish. By now I'm getting worried. There's no point in turning up with hardware if it's not going to impress. 

So I fell back on technology that's served me well in the past. I dug out one of my neopixel rings and dropped it inside the button as you see above. Of course this was difficult. I had to dismantle the button. Then I had to fit the ring. The screws that I used fouled the button movement so I had to resort to the glue gun to fix the ring in place. And of course I burnt my fingers. Then I assembled it the wrong way round, wired it to the wrong pins and generally failed all over the place. But eventually I got a happy ending. 

The neopixels can display lots of colours, but of course the thick red plastic button means that only red works well. Never mind. I can do fancy animations and you can definitely tell when it's lit. 

The button switch itself was easy to wire up, although at one point my test software convinced me that it wasn't wired correctly. Anyhoo, I'll get the software hooked up tomorrow. 

I just hope things won't be quite so difficult. 

Old Tapes and Tidy Code

Did some tidying up today. The experience with my office has taught me a valuable lesson. 

"If you don't know you've got something, you might as well not have it"

I've been looking for things I didn't know I had, and then chucking them out. It's going quite well, what with two trips to the tip so far. 

This is one thing that I definitely know I have, and so I'll be keeping forever. It's my prized Sony TC-270 tape recorder. It might not look much, but thanks to its snap on speakers and ability to play music for several hours non stop (and quite loudly) it made me, if not a god amongst men, at least someone who could get the party started in my younger days. 

Apparently it was made at a time when all silicon transistors was something to brag about. It contains about twenty or so. 

Update: Done some digging. Just 18 transistors and 4 diodes. Your phone probably has several million. And they're silicon too.