Friday 20 March 2015

Web hosing

I have bought the domain name www.danshose.co.uk.

Can anybody design a better hose for me? Mine is a bit Microsoft Paint.


Thursday 19 March 2015

Land of Hose and Glory


I've just bought a Raspberry Pi. I got it straight out of the box and tried to connect it to a hosepipe.

Martyn Currey wrote a very helpful article on how to run a solenoid from an Arduino, and I used exactly the same circuit to make the Raspberry Pi control a 12v solenoid valve.


Classic GCSE electronics. (I've just noticed the diode seems to be wired up wrong, but it didn't seem to matter.)

The Raspberry Pi encourages you to use a programming language called Python. It's an easy-to-use language based entirely on Monty Python's Flying Circus, and so everybody loves it.

Here's the code:

import RPi.GPIO as GPIO    # the GPIO library allows us to control the pins
import time                # the time library lets us pause
import random              # library has random number generator

GPIO.setmode(GPIO.BCM)      # I don't know what this does. I copy + pasted it.
GPIO.setwarnings(False)     # Perhaps I should find out.

hose = 4                    # Sets the GPIO pin the hose is connected to

# Create list with the rhythm of Land of Hope and Glory in quarter notes
pomp = [4,1,1,2,4,4,4,1,1,2,8,4,1,2,1,4,4,4,1,2,1,8,4,1,1,2,4,4,4,1,1,2,8,4,1,2,1,4,4,
4,1,1,2,8,4,1,2,1,4,4,4,4,3,7,4,16]

tempo = 88.34 # tempo in BPM based on conducting of Sir Arthur Bliss

quaver = 60/(2 * tempo) # length of 1 quarter note, in seconds

legato = 0.5 # number from 0 to 1. 1 is full legato but would mean the hose
             # ...was on all the time.

GPIO.setup(hose, GPIO.OUT) # I don't know what this does either.

for x in pomp:                          # Loop through array

    on = x * quaver * legato            # Time in seconds for hose to be on
    off = x * quaver * (1 - legato)     # Time in seconds for hose to be off

    GPIO.output(hose, 1)                # Turn hose on
    time.sleep(on)                      # Wait
    GPIO.output(hose, 0)                # Turn hose off
    time.sleep(off)                     # Wait


GPIO.cleanup()

It works. Huzzah! The video finishes just before the Pi gets covered in water.

Wednesday 18 March 2015

George Osborne supports me



“The Internet of Things!” crowed the Chancellor. “We’ll invest in what is known as the Internet of Things. So should someone have two kitchens, they will be able to control both fridges from the same mobile phone.”

Uproarious laughter filled the House.

“Why is that funny?” I asked. It seemed strange. Nobody would laugh like that if I tried to control two hosepipes with the same phone.

Ed Milliband has two kitchens,” said my friend Chris, who has spent the last few weeks reading about politics. “He was pictured in the smaller one, and someone noticed it didn’t have a toaster. It’s all over the papers.”

Still, I wasn’t sure why the Chancellor is suddenly talking about the Internet of Things. Quite often you read about a concept for a fridge that knows when you’re running out of something and adds it to your Ocado basket. It’s never been produced, because such a fridge would have to be able to identify a carrot, figure out if the carrot is limp or squishy, and predict how many carrots you might fancy eating in the next week. All of this is impossible.

Also, he wants to “control” Ed Miliband's fridges from his phone. Who wants to control a fridge? It needs no control. It keeps food between 3 and 4 degrees celcius. The last thing I want is Russian hackers breaking into my fridge, raising it to 6 degrees and giving me listeria.

Luckily, Robert Peston had an explanation.

The budget document itself gave the confusing detail. The government were giving “£40 million for demonstrator programmes, business incubator space and a research hub to develop applications for Internet of Things technologies in healthcare and social care, and Smart Cities.”

Does a hosepipe count as a smart city? My friend Jo, who is an expert on healthcare and social care, thinks so. “It's definitely a smart city,” she blurted. “This is amazing news. You'll get £35 million.”

She added that if I told George Osborne I was connecting a butler to the internet, I would get £39 million.

Tuesday 10 March 2015

I Speak To Internet, Internet Returns Garbage


I asked my Arduino to connect to the Internet via wifi. Much to my excitement, it found my wireless router and assigned itself an IP address.

But I soon learned that talking to the Internet was the easy part. The difficulty was getting the Internet to listen.

Here is an example:

"Hello, Internet!" the Arduino exclaims. "Could you return me the website of the Guardian newspaper?"

"gÑÿ•ÿ•ÿ£ÿ¹ÿ5jLØ·mÓly-", replied the Internet.

Here is another example:

"Hello, Internet! Could you tell me the weather?"

"HQƒö)3Ì�4ƒ#LXlÙ," said the Internet. "�RÇ«Û7nÃ…S³›7gȾ³Ã˜#´lÚe#F­[6eÀ0�Ö-›nÈ™0Õ#&3gÌškÆ­–Û6nÔ: 166" (I felt encouraged by the 166 at the end.)

I performed much technical fiddleage, but got similar results. I was baffled. Eventually I decided to google it.

“I've got the same problem!” said a forum poster. “I've just spent seven weeks trying to fix it!” He had not fixed it, and he had wasted seven weeks.

Another forum poster had a similar experience. “Currently at wit's end and rapidly losing both hair and what remained of my sanity.”

This was bad news. One rule of this project is that I should finish with the exactly same amount of hair that I started with.

I did some further googling, to no avail. “Why don't you get a Raspberry Pi?” suggested an anonymous. “They're easy to connect to the internet.”

“You should get a Raspberry Pi”, said another.

So I have ordered a Raspberry Pi. I expect it has a similar battery life to an Apple Watch. But can you connect an Apple Watch to a hosepipe? I think I might finally be winning.