Thursday, 9 April 2015
Bad wifi. Bad news.
Sad times. The hosepipe test is cancelled today due to lousy wifi signal. I'll try again tomorrow.
Wednesday, 8 April 2015
Proof of concept (verison 0.1)
I've connected a hosepipe to the internet. I'm doing a live test tomorrow morning at danshose.co.uk. Join in, and water my neglected lawn.
A potential problem is that my landlord will turn up at some point to fix a broken wall in the garden. If you turn the hose on at the wrong time, he might get covered in water. Perhaps this could be a live art project.
A potential problem is that my landlord will turn up at some point to fix a broken wall in the garden. If you turn the hose on at the wrong time, he might get covered in water. Perhaps this could be a live art project.
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.
Can anybody design a better hose for me? Mine is a bit Microsoft Paint.
Thursday, 19 March 2015
Land of Hose and Glory
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.
Osborne appears to have decided on support for the internet of things to generate a two-kitchens gag about ed miliband #budget2015
— Robert Peston (@Peston) March 18, 2015
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.
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.
Saturday, 28 February 2015
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.
“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.
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.
[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.
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.
Subscribe to:
Posts (Atom)