Raspberry Pi Waters Your Lawn, Serves HTML

It is easy to take a Raspberry Pi and treat it like a cheap Linux PC or server. Running an ad blocker or a VPN gateway is simple and doesn’t require any real interfacing. However, it is a big leap to actually use the Pi to control something and a good example can go a long way to helping you develop your own projects. [Joeseph Luccisano] posted a tutorial with just that aim. The goal: build a low-cost lawn watering system.

It is an interesting project since it has hardware and software components, of course. But it also has a hydraulic part, so you have to deal with all three domains coming together.

Of course, your yard will be different, so some of the design will change if you decide to implement this yourself. However, there is plenty of information about how he placed the zones and why he made the choices he did. That should be a good basis for your own design.

It looks like the software section of the tutorial is a work in progress. But the basic idea is to create an HTTP server using Flask for Python and exposing a basic Web API. An iPhone app called Curler creates a good-looking use interface to call the API. We think you could do the same basic thing with HTTP Request Shortcuts,  on Android, or any of many other similar apps.

Of course, we can’t think about sprinklers without thinking about those poor cats. Once you’ve watered your lawn into overgrowing, you’ll want to cut the grass back.

18 thoughts on “Raspberry Pi Waters Your Lawn, Serves HTML

  1. Nice project to learn how to make it.
    If you are looking for a cool option to water your lawn take a look at OpenSprinkler or OpenSprinklerPi.
    Same idea, ready to use tested and mantained software. For those who can’t build it theirself there is ready to use hardware (specialised controller or pi hat).
    My learned lesson after using the software + cheap relay hat for my pi: you need to have a special look at the relay switches valves. The spark in the relay at the moment when cutting the power for the valve isn’t too small. First I had interferences and later one of the relays had the contacts burned together (although a snubber was installed).

    1. Selecting the right relay for an application can really make a difference. For high spark uses, you want a contact material that is tough. Why not use a tough material all the time? Because they tend to oxidize more. The spark cleans it off. Whereas a softer material, the spark will erode it, but it probably has better contact resistance so you’d use those for non sparking application (e.g., low power or dry switching).

      There are also ways to suppress the arc that eats your contacts including putting a magnet nearby to reduce the effect (no kidding). See https://www.te.com/commerce/DocumentDelivery/DDEController?Action=srchrtrv&DocNm=13C3236_AppNote&DocType=CS&DocLang=EN

      One of the reasons relays have a bad rep is because we tend to think of them as all interchangeable. High reliability relays are all over old aircraft and missiles but they were selected for their intended service. Not that they are perfect, of course. Just not as bad as people think because of their experiences with random relay selection.

      1. If you want to switch DC, automotive relays are worth considering, usually intended to have 5 year plus lifespan switching dozens of times a day.

        I wonder though, how soon we’ll notice our home light switches “not lasting” due to getting gunked up switching low power LEDs etc. Have to plan a service procedure maybe, get a 500W halogen bulb and put it in one fitting at a time and flick the switch on and off a few times to clean up the contacts :-D

        1. Come to think of it, I’ve always been disappointed by how quickly “good” microswitches go glitchy or subjectively “bad” in game controller or input situations. They’re only using 5V! I maybe need to figure a way to shock ’em back to life periodically (Without damaging anything in circuit like an autofire 555)

          1. Actually it is a matter of quality.
            There definitely is a difference between older mouse switches and the newer ones.
            Some have a larger body, where the contact is partially moving sideways, cleaning itself.
            Others (I opened quite a few), have more like those quadratic microswitches, with a small dome shaped membrane. And those aren’t very good at keeping dirt out. Just cleaning the contact and they are good to go.

            I have projects with a high requirement of actuations (>1 millions). The problem is the product of switch force and the number of actuations. The higher the force, the harder it is to achieve this requirement.
            But they definitely are a different class than the ones you’d find in consumer products!

            It is not a problem of too little cleaning current.

            Have a look at these switches:
            https://tech.alpsalpine.com/prod/e/pdf/tact/surfacemount/skra/skra.pdf
            This is really high quality, and are specified from 10uA and 1V and dustproof

  2. I did a project like this a few years back based upon Arduino. One thing that helps keep everything neat is to mount the boards on the cover. That way it is easier to service and make changes. You can also take it away to make changes.

  3. Transformer – For North America, must be Class 2 or Class 3 wet (arabic, not roman numeral) per ANSI 5085-3/CSA No66.3. For most others, must be per IEC61558-6, probably Class II (roman number) and inherently limited.

    Relays – this model is should not be used for this application.

    I knew some Sierra Wireless compliance engineers – they knew their stuff. So the author might want to talk to his internal subject matter experts.

  4. There are a couple of things I don’t understand, and this seems like as good a place as any to ask about them. First of all, why is the Raspberry Pi specifically in the headlines? If I’d hadn’t had health and other problems, this is the sort of thing I would have been doing with my 8-bit computers when I was a kid. Every 8-bit and most 16-bit computers had expansion ports you could use for home automation or robots or whatever with only a little bit of external logic. That included the PC with its ISA bus, and the ISA bus was still around when the Pi was launched. Microcontrollers became available to hobbyists at the end of the 8-bit era, and never went away. The Pi counts as one, in a way, but it’s just one of thousands. It’s never even been the most open 32-bit board, as far as I know. Parallel printer ports never went away either, being available as USB add-ons, and they’re configurable as a sort of GPIO. The one really solid thing I’m aware of in the Pi’s favour is that it’s available in so many countries. I suppose that’s a big plus point. The thing that really bothers me is all the hype. If you think about my background – all that knowledge of how to do this stuff and all the frustration of not being able to use it – you’ll see how offensive it was when hordes of capable, healthy people declared the rubbish that was the Pi 1 to be a miracle!

    The other thing is HTTP making the headlines. I suppose it’s more understandable on a hardware site, but there’s just nothing to serving basic HTTP. I have severe fatigue issues and I get confused over nothing, so nearly all my attempts at programming have failed, but 11 years ago I wrote a relatively full-featured HTTP server in a few weeks. It’s not particularly quick, but it has no problem with virtual hosts or dynamic file generation. Everything I want is easy with it. The whole thing with all its structure and CGI support took about a month, but the server test page – the part of it which serves one page of specialist content – was completed and running within about 3 days of me first starting to learn about HTTP! If you don’t do keep-alive, there’s nothing complicated about HTTP at all. Perhaps even keep-alive would be easy if it was structured a little differently.

    Perhaps the secret is I wrote it in the simplest useful language I ever found: Plan 9 shell. It’s simpler and, in a way, more powerful than Bourne shell. The shell utilities around it are also much simpler than their modern equivalents. There’s only one regexp syntax for grep sed and awk, and far fewer options to look through for everything else. The unfortunate corrolary to this is you have to use a lot of different commands, each with its own little syntax, to get anything done. Here’s the manual page for the shell itself:
    http://man.cat-v.org/plan_9/1/rc
    That page is served by the server I wrote, although I don’t maintain it any more. It seems slow now, but it was fine before everyone got stuck indoors. I wrote it with plan9port on a Mac, actually. It runs best under plan9port on Linux, but also runs well on Plan 9 itself, as that server is. Funnily enough, it benefits hugely from multicore.

  5. I’m from Canada and my cost for parts is about 4 times what is listed so his $674.42 (38.81+164.25+356.30+115.05) project would cost me (including shipping) about $C3000 for the “hydraulic” part. Perhaps someone can identify his sources.

    1. Are you looking at home depot? Their fittings, small quantities of screws etc, they like to bubble pack on a glossy card for 4x the price of a real hardware store. Shame Lowes got bought out. Anyway, if you look at Home Hardware, and the Rona, Lowes etc that still are stocking their old stuff you could ind deals. However, pricing in general on anything may be a bit off “normal” at the moment.

  6. I think that the absence of a hardware watchdog time in this design is asking for trouble. You have a risk that – in the event of a software glitch – one or more relays will be left on, and you will flood your garden and waste money on water. Solutions that work in the real world need to consider failure scenarios.

  7. The irony are the aluminium cooling pads on the pi. A system that turns on the water for the garden.
    A typical domain for the cheapest of controllers :-D
    But the first step is to get it running anyhow, no matter what’s keeping track of the control! Great!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.