I'd like to design a system using a Raspberry Pi to control a water valve.

What types of electronic components would I need? Also, how could I control it from an android smartphone.


From hardware side you'll need a relay board (ones for Arduino, e.g. Funduino boards are okay), a solenoid valve, and a power supply capable of driving both RPi and the board - you'll need at least 1500mA). Possibly a power supply to drive the valve too, if it's not powered from mains.

From software point of view, you'll have it easiest by creating the control app as a WWW page - install a WWW server with CGI extensions, and write a simple WWW page to control GPIO pins to which the relay board is connected. That way you skip the whole burden of writing an Android app - you use the web browser on the phone. (just make sure to e.g. password-protect the page to prevent unwanted intruders controlling your irrigation.)

You will also probably need to obtain a static IP address routable from the Internet for your Raspberry (or for your home router, and redirect some port to Raspberry on your LAN) - many ISPs prevent external access to customer computers, or change the address frequently - and your RPi must act a server. Without that your android phone will not know what to connect to.

That would be about the summary of what you need to get started.


If you want to look at just such a project based on Raspberry Pi check out OpenSprinkler Pi. It's an open source board and has both an Arduino and Raspberry Pi implementation. There are several open source SW packages available to run the device that can be accessed via web interfaces so it will work with whatever device you have on your local network. By reviewing this project you can get a good idea of what is required to build your own project of this type.

I have the Raspberry Pi version installed and it's working great.

Regarding comments from @SF on the static IP, if you're OK with having only access on your LAN, setting up mDNS support on your Pi will take care of name to IP mapping issues in your local LAN. See the avahi setup instructions at http://elinux.org/RPi_Advanced_Setup. You can also open up external access using port forwarding on your firewall (how depends on the HW you use) and use additional services like dyndns.com to help provide dynamic mapping from a fixed host name to your dynamic IP address.

  • hi i am new to rasp pi project and i don't no from where i will start,if possible please help me to accomplish task and your first paragraph definitely i will check these OpenSprinkler Pi project bt i don't understand second paragraph and last thing whether it is possible to develop android application for same....
    – Ketan
    Dec 7 '13 at 6:19
  • Sure, it's possible to develop an Android app. Or you can develop a browser based app that is served by the RaspPi. That's what has been done in OpenSprinkler Pi. There are two or three options that are all web based so you just use the browser on Android, your desktop, etc.
    – KenB
    Dec 7 '13 at 15:49
  • Welcome to the Raspberry Pi Stack Exchange site! This is a great first answer, despite the question being bad (+1). Please stick around, we need more people like you and answers like this!
    – syb0rg
    Dec 7 '13 at 19:59
  • @syb0rg Thank you! By no means an expert with the HW side, looking forward to learning more!
    – KenB
    Dec 9 '13 at 5:56

For another raspberry pi based project you could take a look at https://jtdaling.github.io/OpenIrrigation/

The system collects weather data from wunderground, extra sensors are not needed. The system safes water by calculating the amount of water required based on selected plant variety and daily average temperature.

At this moment the system is limited to 4 zones per raspberry.

Settings and management are done via a web interface.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.