Friday 27 February 2015

What has punk rock got to do with hosepipes?

I was having a discussion on Facebook about recording punk rock vocals. I'm not a punk rock vocalist myself, but I was trying to work out where to record some demos for a thing I'm working on. My dilemma was that if I recorded them in my bedroom, the neighbours would call the police; but I can't hire a recording studio, coz that wouldn't be very punk.

“Stop!” said Drew, a Haiku expert. When I say said, of course, I mean commented. “What does this have to do with connecting a hosepipe to the internet?” Drew thinks I am obsessed with hosepipes.

“Dan's going to shout down the hosepipe until the internet starts listening,” said Nicola, a Facebook enthusiast.

“Oh,” said Drew. “Like Katie Hopkins?”

Pure guff, of course. The internet never listens to anyone, least of all Katie Hopkins.


This terrifying circuitry is what I hope will be the brains of my internet-enabled hosepipe. It's an Arduino with a wifi shield. It does similar things to a Raspberry Pi, but while the Raspberry Pi is blisteringly powerful, this is a bit more like a BBC Micro, but with an eccentric programming language similar to Java.

In a nod to anti-capitalism, the design is completely open-source. Massimo Banzi, one of the team who invented the Arduino, wrote the book Getting Started with Arduino, which encourages you to stick transistors in circuit boards and invent things. In the stirring chapter “The Arduino Way”, he compares electronic prototyping to running a punk rock band:


In other words, I don't actually have to know how to use the thing, so long as I can get it to work. This is encouraging, and I'll go back to that thought when it catches fire. Then I can smash it.

Like all punks nowadays, Massimo has given a TED talk. The best bit is 9:14-10:05. First he shows how an Arduino can graffiti far-left slogans onto walls, and straight after that, he demonstrates a plant that has been connected to Twitter.



Down with the government! Smash the system!

Build tiny robots!

Thursday 19 February 2015

Preparing Hosepipe Programs


At some point in the project I’m going to have to make a web server do something, and I’ve discovered I’ll need to learn PHP. According to a jocular Wikipedia editor, PHP stands for “Programmers Hate PHP”. I expect this is some kind of programmers' in-joke.

I’ve signed up to the charming Codecademy site. It seems to be run by an aggressively motivational fitness instructor. Every time you do something right it says “Way to go!” and every ten minutes sends you an email to say “Great job!”

PHP is the sort of thing people put on their CVs, and Codecademy promises I can learn it in four hours. That doesn’t sound like very long, but in four hours I could water my tomatoes 48 times.

Wednesday 18 February 2015

Can anyone lend me a charger?


 "We will make electricity so cheap that only the rich will burn candles." - Thomas Edison

Derrick's advice to get a Raspberry Pi was inspired. Or, depending on your level of technical knowledge, utterly obvious. I could attach the Pi's output pins to some sort of valve, set the thing up as a web client or server, and put it outside in a waterproof box.

To start off with I needed power. As I can't run any cables from the house to the garden, I expect it will have to run on batteries, or some sort of battery/solar combination.

I did some back-of-the-envelope calculations. The most efficient Raspberry Pi, the model A+, uses 1 watt. Let's assume a wi-fi dongle uses 200mW (I have no idea what it actually uses). So the whole setup would draw 1.2W. That's 28.8Wh per day.
  • 4 x AA NiMH (2000 mAH) batteries = 10Wh
    Life: 8h 20 minutes
  • 4 x D NiMH (10,000 mAh) batteries = 50Wh
    Life: 1 day 17h 40 minutes
  • 1 x lead acid golf battery (12V / 22Ah) = 264Wh
    Life: 9 days 4 hours
  • Massive lead acid battery (12V / 220Ah) = 2640Wh
    Life: 3 months 1 day 16 hours
  • Solar power (summer's day = 4h sunshine equivalent average). Need at least a 7.2W solar panel, ideally much more. This costs £30-£70. I'd also need a large amount of battery storage for nights and cloudy days.
Conclusion: a Raspberry Pi uses too much power. Even more than an iPhone, which hitherto I had believed impossible.

How, then, can I use less? This article describes a system called the “sleepy pi”. It uses a second device, an Arduino, to periodically wake up the Pi to perform a task, and then put it back to sleep. The Arduino uses less power to begin with, and unlike the Pi, has its own sleep mode.

So the Pi could wake up, poll a web server for instructions, and then decide whether to turn on the hose, and for how long. Perhaps it only needs to wake up every hour. You don't need hair-trigger response times on a hosepipe, except to spray an enemy cat.

Monday 16 February 2015

How not to connect a hosepipe to the internet


 “Fill the hose with cables and plug it in”, said a helpful Facebook commenter. I thanked him, and laughed, but mostly out of fear he was trying to kill me.

“What you need,” said another friend, “is an app.”

“An app?”

“An app.”

I considered this. I don't know a lot about apps. The only one I've tried is the iPint. It's impressive but ultimately leaves you thirsty.

“Apps can't interface with anything that actually exists, like water or compost. If I tried, my iPhone would get wet and stop working. Besides, I don't have an iPhone.”

“You can control your central heating with an app. Can't you do the same thing with hosepipes?”

“I can't connect a hosepipe to the central heating,” I protested. “It might boil the plants.”

So I asked Jonathon, who works at a desk and has IT skills.

“Hmm,” said Jonathon, and went for some tea.

Then half an hour later, he had an idea.

“You can buy socket adaptors that can be controlled via wifi. I was thinking of getting one, so I can turn my kettle on without getting out of bed. If you plug a pump into that, and hook it up to your water butt, you could turn on the pump from anywhere in the world.”

I felt we were getting somewhere. That would work. That would come in at under £100, and would definitely work. Yes.

Ah. No! No – wait.

Like a lot of projects, this one comes with constraints, which only really become clear when you run into a problem. One of my constraints rules out a lot of possible systems.

I can't run any wires between the house and the garden.

This really arises because I live in a rental, and I'm reluctant to drill any holes in the walls. It's also because I'm hoping one day to adapt the system to work on my allotment, where there is definitely no power supply available.

I expressed my concerns. "Never mind," said Jonathon. "I'd much rather be talking about hosepipes than doing my actual job." He pointed me in the direction of Derrick, who is some sort of IT expert. (Derrick isn't his real name, but I will have to call him Derrick, because when we were introduced I wasn't paying attention.)

“A Raspberry Pi,” said Derrick, with some authority. “What you need is a Raspberry Pi.”

Saturday 14 February 2015

The man behind the curtain

Wizard of Oz: [speaking in a booming voice into microphone] I am the great and powerful...

[then, realizing that it is useless to continue his masquerade, moves away from microphone, speaks in a normal voice]

Wizard of Oz: ... Wizard of Oz.




I was drinking beer with my neighbours.

“I know how to connect a hosepipe to the internet,” said my next door neighbour.

“Ooh,” I said. “Exciting! How?”

“Whenever your tomatoes need watering, you can send me an email. Then I'll lean over the fence with a watering can.”

I thanked him for the kind offer, but declined.

“We're meant to have robot slaves by now, to tend to our every whim. We were promised it in the 1950s. That was 60 years ago.”

I asked my second neighbour, who is a software engineer for a national newspaper. I thought he would know about this sort of thing.

“One of the first things I did in my job,” he said, “was to build a system for election night. The results would come in from constituencies, and so needed to be fed into the database. But this was tricky to automate. Labour candidates, for instance, are not always actually from the Labour Party – they're often a local party which is affiliated to Labour – but when they win they need to be added to Labour's results.

“I spent three months building this. On election night, I turned it on, and it worked perfectly,” he said proudly. “And it was the worst thing I've ever made.

“It would have been far, far more efficient just to hire a couple of graduates for the night, and when the results came through, they could have keyed in the data. It would have done exactly the same thing.”

The Wizard of Oz technique


My neighbour explained that there are many systems where we think we are interacting with computers, but there's actually a human behind the scenes pressing the buttons and pulling the levers. This is less expensive than making an equivalent system which is genuinely automatic.

Are humans are cheaper than robots?

A prediction of futurologists has always been that machines would replace human labour, and we'd end up with oodles of leisure time to spend smiling in sunny fields. This has at least partly happened, though I sometimes feel it manifests itself as unemployment rather than leisure.

But when technology replaces human labour, does this not create a surplus of labour, thus pulling down wages? As things become harder to automate, do we hit an equillibrium, where labour is cheap or free, and automation inefficient? Can it ever be worth creating robots in a free market economy? Should I, in other words, accept my neighbour's emailable gardening services, and abandon my quest?

“No,” I tell my next door neighbour, coldly. “This is the future. I will not take advantage of you. And frankly, if you water my garden, I will feel obliged to water yours, and I'll end up with more work than I had in the first place. And I'm not doing that.”

The next day I posted the problem to Facebook. A friend commented.

"Can't you just ask your wife to change the settings?"

I fear the 1950s will be hard to leave.

Thursday 12 February 2015

A what?

Hi. I'm Dan, and I want to connect a hose to the internet.

This summer I'm planning to plant some tomatoes in my garden. I'm pretty good at growing the things, but generally too distracted to water them every day, or every other day, or twice a day, depending on who you listen to.

I've had some success using drip irrigation and a timer. But British summers can be blazing hot one day, and miserably wet the next, and I won't always be at home to adjust the timings. Hey – it's summer, and I want to be on the beach. Not twiddling with plumbing.

I suppose I could get hold of a soil moisture sensor, and somehow use that to automate a watering system. But I know what will happen then. The system will sense the soil is dry, and deliver the perfect amount of water to the roots. Half an hour later, the British skies will open, and drown the poor things. For a soil moisture sensor doesn't know if it's going to rain. Only the internet knows if it's going to rain.

So I want to connect a hosepipe to the internet.

It's 2015. We're living in the future. There's no wi-fi enabled watering robot in the shops. Let's fix this.