Small app to monitor and water my plant with a Raspberry Pi
Branch: master
Clone or download
rringler Adds Bill of Materials to README
Adds a Bill of Materials to the README.
Latest commit 17a568a Dec 30, 2015
Type Name Latest commit message Commit time
Failed to load latest commit information.
Custom PCB Adds Kicad PCB Layout for MCP3002 A/D Converter Dec 30, 2015


pi_plant screenshot


(Long) weekend project to monitor and water my plant with a Raspberry Pi. The app was developed for Raspbian Wheezy with an arduino two-prong soil moisture sensor via a MCP3002 analog-to-digital converter, and an arduino relay board to control a 110 VAC water pump.

It makes a couple of assumptions:

Moisture Sensor:

  • Now includes a Kicad PCB design for interfacing with a MCP3002 10-bit SPI Analog-to-Digital Converter. The Pi talks to the ADC via its SPI interface. Includes all the manufacturing files required to fab the board (which I had OSH Park make for me for $7.85 shipped, which required about $15 in components from Digi-key.)

    Custom PCB Layout

  • Includes three 2N3904 transistors to allow the Pi to control the power provided to the MCP3002 & the two analog sensors:

    NPN-Transistor Network

(Leaving these two-prong type of sensors powered on 24/7 can lead to galvanic corrosion, so it's probably better to turn them on when needed.)

  • Provides two analog measurement channels. Also supplies VCC & GND (in case the moisture sensor requires it) for each.

Water Pump:

  • Assumes there is a power pin to activate the pump. My Pi's 3.3V GPIO was able to activate/deactivate my relay board directly, but if you're having issues you could always use a NPN-transistor network as shown above.


pi_plant was developed on Ruby v2.1 and Rails v4.0. Several gems were utilized to make development easier:

gem 'bootstrap-sass', github: 'thomas-mcdonald/bootstrap-sass'
gem 'figaro'
gem 'draper'
gem 'lazy_high_charts'


  1. Clone the repository.

  2. Create a /config/application.yml file with environmental variables holding all your secret keys (see figaro's documentation for more details) and add it to your .gitignore file.

    RAILS_SECRET_KEY_BASE: '<rails secret key>'
  3. Schedule the sample rake task to take periodic soil measurements.

    crontab -e
    00 00, 12, * * * * rvmsudo rake RAILS_ENV=production sample

    Note: the Pi requires root access to interact with hardware

  4. Start the webserver

  5. Create a plant with the GPIO pins used in your circuit.

Bill of Materials

Find No. Qty Part Number Description Approx. Extended Cost
1 1 756-8308 Raspberry Pi v2 $40
2 1 SDC10/8GBET Kingston 8GB microSD Card $8
3 1 EW-7811Un Edimax 802.11n USB Adapter $10
4 1 B00E0NTPP4 SunFounder 2 Channel 5V Relay Shield for Arduino $7
5 1 B00AYCNEKW sunkee Soil Moisture Sensor $3
6 1 B001BOD9JI TOM 3.5gph Aquarium Pump $16
7 1 kTJJCOss OSH Park Custom PCB $8
8 1 MCP3002-I/P MCP3002 2-Channel 10-bit ADC $2
9 3 2N3904BU 40V NPN Transistor $1
10 3 CF14JT1K00 1kOhm 1/4W Carbon Through Hole Resistor $1
11 2 0022288363 Molex 36pos Right-Angle Pin Header $4


  • Custom PCB for interfacing with the MCP3002 (experimenting with Kicad)


  • Raspberry Pi
  • RPi
  • Ruby on Rails
  • Kicad
  • MCP3002
  • Home Automation


pi_plant is the product of Ryan Ringler. It was developed as a (long) weekend project to experiment with the Raspberry Pi, Rails, and Kicad.


pi_plant is licensed under the MIT License. Please see the LICENSE file for additional details.