Hull Pixelbot Script

I'm not sure if I'll ever get this working, but I am sure that without the language design I'll never get it to go.

I've got a tiny little language running inside the Hull Pixelbot which works rather well. All the commands are two characters and they are interpreted by the Arduino that controls the motors and sensors. And I can store the programs inside the robot EEPROM, as well as deploy them from Azure IOT hub amongst other place.

But the language is a bit of a pain to use to be honest. And there are things I just can't do. So it's time to make a proper language. I'm calling it Hull Pixelbot Script.

I've not done programming language design for a while. I'm a big fan of syntax diagrams (or railroad diagrams). To me they seem a really neat way to express the arrangement of a language. Above you can see the design for the statement element of Hull Pixelbot Script. You can see that the colour (or color) command must be followed by three values which are separated by commas, and an if statement can control a large number of statements (and maybe I could add an else later).

I made the diagrams by using a web site that takes my grammar and makes the nice looking output. It took me a while to remember how EBNF (Extended Backus–Naur form) fits together, but I'm quite pleased with the result.

Of course I've actually achieved very little, what I now have to do is build the actual code that implements the language.

But it's a start.  

Red Nose Day Racing and Rhyming

Well, that was a fun day. Up bright and early to head up town to talk about the Great Robot Race on Radio Humberside, then home to write some poetry, then up to c4di to run the first race (which went rather well as you can see above). Then home for another radio chat, then tea and finally out to the University to deliver a lecture in rhyme. And race some more robots.

This is the winner of the first ever Hull Pixelbot Great Robot Race, who succeeded by using a cunning trick called "taking the race seriously".

 

This is the racing action at the Lecture in Rhyme

..and these are the winners of the rhyming race.

A good time was had by all, I took 149.68 over the two events, which I've generously rounded up to 150 pounds. That'll make my total takings up to over 600 pounds once I pay it all in. Not quite tutu money, but I'm happy with that.

If you want to take me closer to my 1,000 target, you can still give me some cash here.

Red Nose Day Robots

I've got confirmation of the venue for my world famous (in my world) Comic Relief lecture in rhyme for 2017. I've been producing bad poetry in aid of charity for over twenty years. This year I'm breaking one of the immutable laws of showbiz:

Never work with children, animals or robots.

My lecture will be accompanied by a horde of Hull Pixelbot robots, each of which has a mind of its own (and isn't afraid of using it). You'll even be able to control the robots yourself during the lecture. As long as you've sponsored me here.  

I've chosen a crack team of robots to help in the presentation. Above you can see them being put through their paces.

The lecture starts at 7:00 pm in the Large Lecture Theatre in the Applied Science 3 building on the Hull University campus. You can find a map of the campus here.

There is free admission to the lecture but, as always, you'll have to pay to get out. I'll have robots guarding all the doors.

Please come. Bring money. Bring a friend. Bring pies.

"Alloy" wheels for the Hull Pixelbot

OK, they're not really alloy. Although you could cast them out of shiny metal if you wanted. I'm going to have a go with some metallic filament I've got lying around.

Anyhoo, I've spent some time today improving the Hull Pixelbot wheels. They've been simple disks for too long. They now have a specially designed rim which turns a simple elastic band into a workable tyre (and the band doesn't seem to come off) and the rim is actually narrower than the wheel. And, the wheel now has holes in for lower weight, a better 0-60 time and faster printing.

I've just to do one final test on the finished design and then I'll put them on GitHub.

Light Pipes and Off Roading

I've been experimenting with some wheels I found on a different, lessor, robot. They are about the right size, and they give a Hull Pixelbot a nice "off-road" feel. They make turning a bit more difficult though, as the thick tyres are very grippy. 

I've also been playing with printing "light pipes" inside the shade for the pixels. The idea is to give better defined points for a camera to track the position and orientation of the robot. But I think the results are quite artistic too. 

Hull Pixelbot Seminar Fun

I've not taken an audience picture for a while.

And it shows.

Anyhoo, I gave my Hull Pixelbot seminar today. Great fun (at least I enjoyed it). Most everything worked and we had some great discussions about games involving the robots.

You can find the slide deck here.

I'm feverishly writing the howto guides and getting the software ready for the "big upload" on Friday.

It was great to see everyone, they do have lovely audiences at Hull.

HullPixelbot Fridge Magnets

I've spent a chunk of the weekend printing Hull Pixelbot fridge magnets. I just took the logo and fed it into Cura (the slicing program that I use for Una, my 3D printer) and after a bit of fiddling I managed to get a 3D object that works quite well.

Once printed I just have to rub a black marker pen over the 3D text to make the letters stand out. Although I wasn't as careful as I should have been, which has made them a bit smudged. Perhaps I can print a little mask to put over the text when I ink it.

Anyhoo, the magnets will be going on sale soon in aid of Comic Relief. I'm doing a lecture in rhyme again this year all about robots, accompanied by a bunch of dancing Hull Pixelbots.

Oh, and if you are in the university on Wednesday I'm also doing a Hull Pixelbot seminar thee too.

Wheely Nice Elastic Bands

Some people are seekers of the truth, others are on a quest for the meaning of life. Me, my focus has been a bit more down to earth. I want something that I can use for tyres (or tires) for the wheels on the Hull Pixelbot. And, at last, I may have found them.

I've been using skinny elastic bands for a while, but they tend to fall off the wheel really easily. Experiments with hot glue to hold the bands in place were not on the whole successful, in that I managed to stick pretty much everything to everything - fingers to desk, fingers to each other, fingers to wheel, fingers to elastic band etc etc, without actually achieving the holy grail of sticking elastic band to wheel.

My latest purchase, 50mm x 12mm elastic beauties from ebay, that stalwart Hull Pixelbot supplier, show promise though. If they are as hard to get off as they are to get on the wheel, I might actually be on to something here.

If it's broken, just throw it away

I'm doing some major upgrades of the HullPixelbot devices at the moment. They are all getting distance sensors, autonomous behaviours and over the air updates.

Most of which works.  Today I found that one of my distance sensors, and one of my Arduino Pro-Mini devices were faulty. They looked fine, but didn't work some of the time.

In the past I might have kept them, in the forlorn hope that perhaps one day I could fix them and save some money. These days I throw suspect parts as far away as I can. The reason is that, in our house at any rate, broken parts have a habit of finding their way back into the system, so that I have to rediscover that they are broken all over again, which is tiresome and time wasting.

In this case I'm down around two quid. That seems a fairly small price to pay for not having to spend half an hour trying to figure out why my code isn't working, when in fact the hardware is broken.

One reason for all this effort is that I'm giving a seminar at Hull University on the 1st of February all about the Hull Pixelbots. It's at 2:00 pm. I'm not sure where yet, but if you want to come along and find out how you can build a Pixelbot all of your own, then it would be great to see you.

I'll also be taking the new Pixelbots into the c4di hardware meetup tomorrow. You can sign up here.

HullPixelbot Code takes shape

Building on the work yesterday, I've now made a little code editor that can be used to control the HullPixelbot motor controller. You can load and save programs and send them via a serial port into an Arduino. The programs are stored in EEPROM inside the device, so that they run when the robot starts up. Next step is to distribute the programs over MQTT using the esp8266. Then I'll be a lot closer to my dream of autonomous robots that I can easily reprogram.

The program above starts a movement and then tests a conditional branch behaviour that fires when the motor stops running. You can use this to write code that starts the robot moving and then responds to events.

The nice thing about the programs so far is that they are very frugal. I've got everything running on a single Arduino Pro-Mini and it seems to work OK at the moment.

Potential Dividers for Pixelbots

..a divider with potential

I've been working on the HullPixelbot hardware today. I want to use an HC-SR04 distance sensor so that a robot can detect when it is getting close to something. These devices are not perfect, but they are very cheap (less than a pound from China). Snag is they are 5 volt devices (i.e. they are powered by, and produce signals at, a 5 volt level).

The Arduino Pro-Mini that I'm using to control the motors and sensors is a 3.3 volt device. Directly connecting a distance sensor to it would not end well. It might actually break the Arduino. There are special converter chips thatyou can buy to addressthis, but they are expensive and need to be wired up. Fortunately the only signals you need to worry about are those going into the Arduino, and the only input signal is the echo pulse. So I just have to adjust the level of that signal.

The way that the sensor works is that you give it a signal to say "please measure the distance". The sensor then makes an ultrasonic "squeak" and times how long it takes for the squeak to bounce back. It generates a pulse, called the echo signal that represents this time. The longer the echo pulse, the longer it took for the sound to bounce back, and the further away the target is from the sensor.

The echo signal provided by the distance sensor is either at 0 volts or 5 volts. We want to convert the 5 volt value to 3.3. I've used a potential divider to do this. This uses the principle that the voltages in a circuit are distributed according to the resistances in each element. The higher the resistance of one part of the circuit, the more volts are "dropped" across this part. This probably doesn't seem sensible, but it is how a lot of electronic devices work.

In the old days we used to use lots of low voltage bulbs in our Christmas lights. The mains voltage of 240 volts would be spread over, say 20 bulbs, each designed to work with 12 volts. All the bulbs were connected in a chain, so the voltage dropped across each bulb was 12 volts (a twentieth of 240). Bad news, if one of the bulbs fail the whole chain goes out.

Worse news, if a human being (who has a resistance a lot higher than a 12 volt bulb) puts themselves into the circuit trying to fix this they will find that nearly all the voltage is dropped across them, which is how until recently Christmas was always accompanied by grisly stories of people electrocuted when they were fixing the lights on their tree.

Anyhoo, back to the robot circuit. The total resistance of our two resistors is around 3K. The voltage dropped across the 1K resistor will be around the third of the 5 volt input. These are the volts I don't want. The voltage across the 2K resistor will be around two thirds of 5 volts, which is as near 3.3 volts as makes no difference. And it works, which is nice.

If you think about it, what I've made is a machine that can divide by 3 at close to the speed of light. Any signal going into the potential divider will be divided by 3 on the output because physics. The speed of these two resistors massively outperforms even the most powerful of digital computer, and so-called "analogue" computers like this were much used in the past.

HullPixelbots at AzureCraft

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...

The Robots are coming to c4di

Sam drives some robots..

I took my working pixelbots down to c4di and gave a talk tonight about how they worked. Before the talk I set out a small part of my robot arena and we all had a bit of fun steering them around using my chatbot client. 

Thanks to everyone who came along. Some very useful conversations. I left with some good ideas for improving the system. I'll be putting the presentation and the code up soon. Keep watching the blog for details.