Cooking with Rob

I've started doing more cooking. As you do. Particularly when you are hungry. I'll be posting some of my favourite recipes over the next few weeks, when I can't think of anything else to write.

Today: Bananas and Custard

Ingredients: Two bananas. Tin of custard.

  1. Peel bananas (very important). Don't leave the skins lying on the floor, unless you are after some comedy gold when the next person walks into the kitchen.
  2. Slice bananas into two dishes.
  3. Open tin of custard and share mostly equally in the two dishes.
  4. Give number one wife the dish that you think has the least custard in it.

Tastes even better if the custard was half price.

Important: If you have any kind of custard or banana allergy then you probably shouldn't eat this. Or anything else with the words "custard" or "banana" in its name.

Getting Started at the Hardware Meetup

Too busy to take any snaps at the meetup, here's a picture of some fireworks

I went to the Hardware Meetup with a bunch of things to do. Didn't get to do any of them because there was too much interesting chat. Which was great.

A few new folks turned up too and they were asking what to do to get started. Here's "Rob's Handy List of Hardware Fun Things to Do"

Get a bit of hardware to play with

The clue's in the name. We play with bits of hardware. This doesn't mean that you need to spend a lot of cash though. You can start with just an Arduino and a few leds and switches.  The Arduino is the embedded device that we like to start with. It's easy to program and cheap to buy.

The best place to buy an Arduino is probably eBay. The one you want to gets started is an Arduino Uno (or compatible). Search for "Arduino Uno". You should be able to pick one up for less than a fiver. 

An Arduino on it's own can't do much (although you can flash a light on it) so you might want to take a look at one of the kits that are available. You could start with one that contains a bunch of lights and switches and a few more advanced components. These are also on eBay; I quite like the ones branded Sintron, although others are quite good.

Download the Software

You program your Adruino using a PC, Mac or Linux device. The Arduino software is a free download from here.

Make something work

There are some getting started tutorials here that you might find useful. You can also search YouTube for Arduino videos; these are especially useful if you want to know how to use some of the more exotic devices in the kits.

Once you've got the examples working, have a go at something of your own.

Come to meetups

If you end up making something impressive, bring it along and show us. If you try to make something and get stuck, bring it along and we'll try to help out. We meet up approximately every two weeks at c4di in Hull. You can find the agenda for the meetups (and lots of other things) 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.

I'm an Idiot

I'm an idiot. Spent half a day chasing a bug that isn't really there. I've been writing the code that lets you download new programs into the HullPixelbot over the network. It worked fine for tiny programs, and then failed for larger ones.

I can hear you thinking "Buffer overrun". Except that I'm not that kind of idiot, and my code is carefully protected against too much data arriving when it shouldn't. And the fault didn't appear at a consistent point in the conversation, which it would if the program was hitting a hard limit somewhere. The failure threshold moved about a bit. Sometimes the program failed with a ten line program, other times it failed with an eight line program.

Any ideas? Took me a little while to figure it out. And of course it was my own stupidity.

It turned out that my over enthusiasm for code instrumentation was my undoing. When you are writing embedded programs you need code instrumentation to stay sane. In simple terms code instrumentation is "putting in print statements to see what is happening". My little program was notifying me each time a data byte arrived so I could convince myself that all was well.

And therein lies the stupidity. It was sending out three bytes of diagnostic information for each incoming byte. Since the send and receive rates are the same, this meant that after a while the program became unable to deal with incoming data because it was taking too long to send out the debug information.

The Arduino will do some buffering of data in and out of the device, but at some point this will fill up, at which point bad things happen. It's not going to happen at a consistent point in the program because the serial timings will vary slightly as other events occur on the processor.

So, I took out the debug code and the program worked perfectly. Strange but true.

And I'm an idiot.

Dirty Lens Blues

I took a good look at some of the photographs that I took yesterday and I noticed that parts of the image are a bit blurred. So I checked the lens surface and I was shocked by the amount of gunk on the glass. I don't remember wiping my nose on the lens (ugh) but It sure looked as if that was what I'd been doing. The lens was filthy and it was only after a bunch of wiping that I managed to rid of the muck.

I'm not a big fan of lens caps, it seems to me that they are a great way to transfer dust from the inside of your pocket to the surface of the lens, but I'm going to have to be a bit more careful in future. Although the pictures haven't turned out too badly.

Proper Blade Pictures

We went up town today and I thought I'd get some pictures of the "blade" once it had been installed. And here it is. To me it looks like it has been Photoshopped into the image. It's such an unlikely thing to find in the middle of a city square that it's rather hard to take in the fact that it is actually real.

I'm quite pleased with this shot from right underneath the blade. Next time I'll have the nerve to lie down on the floor to get an even better viewpoint.

Apollo 11 VR Experience is Awesome

One of the great things about virtual reality is that it can take you places there's no way you'd ever be able to go in real life. For example, the moon.

Apollo 11 VR is an application about the first moon landing. You start off watching President Kennedy's famous speech about choosing to do things like space travel "because they are hard". You're in a very sixties themed briefing room with a flickering projector, a stylish TV and even a lava lamp (you had to be there).

Then, after a tour around your rocket, you're in the command module and blasting off into orbit where you have to dock with the lunar module before heading out into space. Apparently actually landing on the surface of the moon is a bit tricky, but we haven't got that far yet.

Everything is rendered extremely well, your fellow astronauts do look a tiny bit "uncanny valley" but the space scenes are lovely. And there are interactive elements which require more than a little thought and coordination.

It's being sold as a "documentary" and I think that's very fair. It's probably not a thing that you'd go back to time and again (although I think I probably will). The price of seven pounds fifty pence seems reasonable for something like this, I reckon you get an awful lot for your money. And it's a great way to show off the platform.

In fact I think that if you have a VR system, you should get this.

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.

Working at c4di

Getting started

The c4di is a great place to work.  I can say that with confidence because this week I've started working there. My home office is great, but there is nothing quite like "going out to work" to get things done. I've been given some space at c4di for a while to just "do interesting things" and I'm going to try and do just that.

I've made some progress with the next version of the HullPixelbot. Up until now the robots have been remote controlled, which is nice, but I really want them to be autonomous, i.e. able to look after themselves.

"That's easy" you say, "Just put a program into the robot.". Well yes, I could do that. The Arduino that I'm using is very easy to write code for. But you can only change the program by plugging the Arduino into the computer again, and I don't want to do that. Worse still, I want to be able to send the same program to many (perhaps even 100) robots at once.

So I've done what any self respecting Computer Scientist would do at this point. I've invented my own programming language, especially for HullPixelbots. It's not a very complicated language, but that's OK. It's a bit hard to understand, but that's OK too, since I'm going to write a little program that will generate robot programs and distribute them.

Today I got HullPixelbot Code working and added the ability to download programs via the serial port. I'd thought it would take a few days to get this working, but I had most of it working by lunchtime. Like I said, a cracking place to work.

I'm going to be setting up some events and whatnot over the next few weeks, but if you happen to be in the c4di please come and say hello. Just walk towards the coloured lights......

On the way out I noticed that they were preparing the tidal barrier.

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.

"The Blade" in Hull

I would love to have been at the meeting where someone said "Lets get an enormous wind turbine blade and install it in the middle of Hull". Cue raised eyebrows.

But someone must also have said "Why not?"

And it's awesome. I went up town today to see it being lowered carefully into place. This thing is properly big. At one end they are driving double decker busses underneat it. It's part of the Hull UK City of Culture celebrations and you've got until March this year to come and take a look.

I wonder what they'll replace it with.

 

Forza 3 Three-Wheeler Fun

Yay!

Ever since number one son found the Reliant Regal in Forza 3 I've wanted one of my own. And now I've got one. I managed to track down the barn and get the car safely installed in my garage. 

The car does float, but it was so under powered that it actually stopped in the middle of a the river

I promptly upgraded everything to do with the engine and I now have something which will kind of go like a rocket in a straight line but then falls over if you try to turn a corner. Which as I recall is pretty realistic.

However, the thing I find astonishing is the attention to detail in the model. You can visit your cars in the garage, open doors, try the seats for size and look at all the controls. You can even open the bonnet (hood) and take a look at the engine. In the case of the Reliant this has triggered lots of memories of my first ever car. It had a habit of lifting the inside wheel when I was cornering, which passengers found rather disquieting. 

I really, really, love Forza 3. It isn't a game you play, it's a place you visit. I'm running it on my PC and on my Xbox. The PC experience is very, very, good. It seems strange to be able to ALT-TAB from an triple A video game into Visual Studio and back, but you can do just that. Strongly recommended. 

Comedy Pig Palace Building

Yesterday the vet said that the best way to get rid of any nasty pig-mites was to "wash the hutch out with boiling water". At the time this seemed to make sense, as least from a mite-killing point of view. But today it occurred to me that this would leave me with a very wet pig house. In the middle of winter. Not healthy.

Fortunately I'd just come into some money, in the form of the travelling expenses for TechDays, and so I was in a position to zoom down to PetsAtHome and purchase a new "Pig Palace", along with clean sawdust and hay. If you have ever asked yourself the question "Is it possible to get a 160cm long flat pack hutch in the back of a BMW i3?" the answer turns out to be yes, because the front seats tilt forwards in a rather useful way. 

Anyhoo, I got the palace home, ignoring all the "needs two people to carry" instructions and all I had to do now was build the thing. I'd had this mental picture of me laying out all the pieces in the garden, and then leveraging all my Ikea experience to quickly fit them together. And then it started raining. Proper rain. Lots of it. 

So instead I had to assemble the hutch in the summer house (i.e. shed with windows) where the pigs live in winter. That is, in a space only about 18 inches all round larger than the hutch itself. This was a true comedy affair. At numerous occasions during the build I discovered that thanks to my construction skills I'd managed to build myself into a corner from which there was no way out. And I put the front on upside down in one Australian moment of madness, which meant I got to take it all apart again half way through.

Anyhoo, the new pig palace is now complete and the pigs are installed and seem happy enough (at least I hope so). The old hutch has served as very well over a long time (and it wasn't even new when we got it) but I think it is time to move on. I just hope I can get the new hatch out of the summer house when we have to move the pigs outdoors. That will be another comedy moment.....

Poorly Pigs

One of the patients catching up on the news

Having pets is something of a double edged sword. On one hand they are great fun. On another they are something else to worry about. Recently we noticed that the hair on our pigs wasn't as shiny and clear as usual, so it was down to the vets for a check-up. The diagnosis was that they had mites, which they probably picked up from the hay. Some treatment was applied and we thought that was that.

Tonight I took them down for a follow-up appointment and it turns out that they are not much better, which is a pity. They've just had a follow up treatment and we've got some ointment (should that be oinkment for a pig?) to apply as well. They seem happy enough and all the food is disappearing each morning, so I think they'll be fine.

Schools App Challenge

I've spent a bit of time over the last few days going through entries for the Schools App Challenge, helping with the judging. Such fun.

The challenge is a fantastic enterprise. It is a kind of "magic bullet" that hits a whole bunch of great targets all at once. It gives kids confidence in presenting and discussing their ideas. It helps them learn to work as a team. It engages them with technology. And it gets them thinking about how you can do things to improve the lot of other people.

You can find the entries on the web site and you might like to take a look at them. I found it very cheering.

Home Alone Rob

I'm having some time "Home Alone" as number one wife is away for a few days. This is rather interesting, as it doesn't happen very often. I've been going round the kitchen to see what happens in there and taking a look in the cupboards. Most of them seem quite sensible, with some things in them that I recognise. Cups, plates, breakfast cereal etc. Others are rather strange.

Apparently there's a "magic cold cupboard" that holds the milk and whatnot, and a magic warm cupboard which is where I can put things if I want to heat them up. Although I'm not completely sure about why I would want to do this. Perhaps it is something to do with this "cooking" thing I see so much of on the telly.

There's another magic cupboard with a round opening that I can't quite figure out. I put some crockery in there and turned it on, and all that happened was a horrendous noise and a lot of broken bits. So it's not for washing dishes.

I've been shown a bunch of things in the "magic cold cupboard" that I can transfer to the "magic buzzing cupboard" to make them warm enough to eat. I've even been planning my menus for the next few days.

In my opinion the way that we eat today is boring. Just because something has worked fine for many years is no reason to keep doing it (at least that is what seems to be driving the world these days). What we need is some novel approaches to eating. Heaven knows, we've had enough of experts telling us how to eat over the years. It's time for some radical thinking. I've come up with the following possible plans.

  1. Eat nothing. This might serve as a handy weight reduction plan and definitely save some money. However, the long term prospects may not be great.
  2. Eat nothing but food that I really like. After millions of years of evolution and adaption it seems stupid that things that are supposedly "good" for me don't taste very nice. My body knows what it's doing. If it wants nothing but honey roasted peanuts and Kellogg's Cocoa Pops then perhaps that's nature's way of saying that's all I should eat. There may be a downside to this, but I'm struggling to think of one.
  3. Eat everything on the first day. Number one wife is back on Sunday. I could eat a whole four day's worth of food today and then nothing for the rest of the week. I'm struggling to understand why we don't already do this. It would be so much more efficient. On the other hand, I may discover why about half way through my third lasagna.
  4. We normally have breakfast, lunch and tea each day. Why? I could have all my breakfasts on Wednesday, lunches on Thursday and so on through the week. If I run out of meals I can start at breakfast again, or even invent new ones. This would add a bit of novelty to my life and bring back memories of my time in a bedsit when I actually did this, for the simple reason that the only food I had to hand was Kellogg's Cocoa Pops.

Made in Hull

As well as an awesome firework display, the start of Hull's reign as UK City of Culture was also marked by artwork projected onto the major buildings in the city. There are a number of different installations, the most impressive are the one in Victoria Square and the one projected onto the side of The Deep.

If you live in or around Hull you ust go and see these. If you don't live in or around Hull you must move to Hull and then go and see them.

They are on until the end of the week.

In with a Bang in 2017

Happy New Year everyone.

Hull is UK City of Culture 2017. Yay!

To celebrate this we had an amazing firework display tonight. Around 25,000 people came along to see, including us. It was very cold, but we were lucky enough to find a space in the only pub in the neighbourhood and have a quiet drink until the display started.

It was awesome. Two barges loaded with fireworks had been parked in the river over 15 minutes or so they set them all off.

You can get a flavour of the event from this video, which is better than any pictures that I could take and includes some lovely shots taken from the air.

I was a bit worried about the size of the crowds and getting home, but after a brisk walk across town we were soon on our way back. It was a wonderful evening and a real credit to the wonderful city where I live.