Guy Martin vs The Robot Car

The most ridiculous tea maker in the world.

The show Guy Martin vs the Robot Car aired on Sunday 26th December 2017 at 9pm. For our small part in it we were asked to make an AI teasmade in an attempt to show people that AI technologies and simple robotic electronics are more approachable than they may first appear.

entiremachine2

Guy Martin vs the Robot Car - The most ridiculous tea making machine in the world.

We were asked by the lovely people at North One to create an artificially intelligent tea maker that would make Guy Martin the perfect cup of tea based on how he was feeling on that day.

No small task, but we suggested the idea of Guy using his famously old school Nokia to text an intelligent chat bot that would then figure out what type of tea to make him based on their conversation. The system could also gather information from the day such as the weather or the amount of distance travelled by Guy to try to figure out what type of tea would best suit him.

Of course we would also need a machine to automatically make that perfect cup for him!

The starting point

The first thing we had to figure out were the variables of tea making - what decision making process does the average person go through when making a cup of tea, and therefore what type of questions could lead to us getting these variables?

Alison’s tea technique
I select my cup first (preferable the china one with the birds on it) then I select and add my tea bag - I give it a bit of a shake to get any tea dust off it first. Then add two sugars (always) and when the water is boiled I fill the cup and wait for a few seconds. I then stir and squeeze the bag in the water and finally remove it. Only once the bag is out do I add the milk - just the right amount for me - I then stir again and that’s it.

Sam’s tea Technique
I’m more of a coffee drinker, but when I do have a tea… I select a medium sized cup, throw in a strong type of tea and fill it almost all the way to the top with boiled water. After brewing for a couple of minutes I’ll remove the bag and add a small amount of unsweetened almond milk (I’m not a hipster or anything) and stir.

Evidently tea brewing is a very personal thing!

We found out very early that neither of these techniques are to Guy’s taste! He’s a ‘milk first’ chap.
Taking into account Guy’s… controversial… tea brewing method the variables we ended up with were as follows:

Cup selection
Milk amount
Tea bag selection
Brewing time

This gave us a good starting point to begin thinking about how to get this information out of a conversation and how these elements might go together in a physical machine.

phone2

The Chatbot

To create the chatbot we had to find an SMS service provider with an API that would allow us to send text messages from the tea maker machine. The service also needed support for custom webhooks for use when text messages would be received. We settled on Twilio as it had both an API and webhook support but most importantly had great documentation and support for many different languages.

The next step was to create a basic application that would be running on the tea maker machine to handle incoming and outgoing text messages. We chose to write this application using Python - a great language for general purpose programming that has an emphasis on code readability. The latter part was important as we knew that part of filming sequence would be based around talking Guy through how the code works. A good starter language if you like. We also needed a language that we could run on a Raspberry Pi (further along this article you will find out why we had to use this type of small computer!).

The role of this application was to receive incoming text messages that were sent to the tea maker machine (which had it’s own phone number), analyse the content of the message and then send an appropriate reply with either a further question or a general response. To understand the conversation between Guy and tea maker machine we used a Google service called DialogFlow (formerly API.AI) that would guide Guy through a series of questions and collect all of his answers so that the end result was a list of requirements for the type of tea that would be brewed. For example, one question that the machine asked Guy was “How’s it going?”. If Guy responded with “knackered” we’d know that he’s probably feeling quite stressed. If he replied with “not bad” we’d know that he was probably neither stressed or relaxed. DialogFlow allowed us to create loose outlines for each of Guy’s answers and look out for certain keywords that we could then map to a particular method of tea brewing.

After four questions had been asked we might know the following information:

Guy is not stressed - therefore he’d like a normal type of tea
Guy is going to be working in his garage all afternoon - therefore he requires a rugged cup that can withstand a knock
Guy has been travelling lots today - therefore he requires a strong tea, not much milk!
Guy is in a rush - therefore let’s not leave it brewing too long!

When all of that information had been gathered the details were sent off to the tea maker machine for the creation to begin!

code2

The Machine

We knew there were two main types of technology that could be used to make our machine; Arduinos and Raspberry Pis. We knew the Raspberry Pi ultimately had more going for it as it is a fully functioning computer and could in theory support more electronics in one go (than a single Arduino could).

We decided initially to try a simple circuit on both the Raspberry Pi and Arduino just to see if there was a reason to use the two technologies together.

It was clear even from this simple test that the Raspberry Pi alone was going to be the best option for the machine due to a number of factors.

As a microcontroller the Arduino requires the code to be compiled and uploaded to the board. Making it in essence a closed system, this would likely make synchronising numerous devices a more difficult task. The Raspberry Pi can not only control and run the machine but also the AI code and server communication as it’s a fully functioning computer. Additionally we can plug in a hell of a lot more things to the Pi simply because there’s more pins.

We already had a lot of electronics around but a little voice was telling us that much of what we had was broken (especially the servos). So we set about cataloguing and testing anything and everything we thought might be useful. It turned out we had 11 servos around the office, but only 6 of those actually worked properly. Time to start buying some equipment!

Using our sketches we knew what we had to make happen so it was simply a matter of figuring out what parts were needed. For example we had to get the water out of the kettle and into a cup, some sort of pump would do that - a pump that was safe for food stuffs. Using that sort of logic we managed to buy all the key items required -

A pump - for the boiling water
A stepper motor - for the conveyor
A valve - to let out the milk
A temperature gauge - to check the water is ready
At least 5 more servos - for a tea selecting arm and a cup dispensing system and a way to turn the kettle on

Once we had all the right stuff it was time to research and create the circuits. There is an excellent community of makers online, and as such there were plenty of places for us to go if we ran into any problems! Handily though the making of the circuits (while complex) wasn’t as worrisome as expected and with all our breadboards we were able to mock up all of the key circuits fairly efficiently.

While in the mocking up and testing circuits phase it became clear very early on that none of the wires for use with breadboards were going to be long enough to plug into the RPi comfortably. We would also need long wires in the final construction.

The office here has a lot of tech in it and also a lot of ‘spare’ cables, so we repurposed the for the machine and by attaching female cable ends created a nice way to join the breadboard circuits to the Pi.

The only problem we now had is that we’d cut the wires long so we could potentially use them in the final machine, and not knowing any of the final dimensions we cut them extra long… so now we had wires everywhere!

There are so many parts to the machine that we could write an article about each of them. The conveyor for example is made from a stepper motor, shelving brackets, nuts, bolts, bearings, plastic plumbing pipes, and a wipe clean material we found in Dunelm mill!

instagrammed2
Top
Menu