Build a digital guardian for your favorite plants! Using an Arduino and a few inexpensive sensors, you can keep your plants extremely happy with the proper amount of moisture, warmth, and light.

The simplest version of Potted Plant Protector senses the brightness of the light, wetness of the soil, and warmth of the air that your plant is exposed to. It outputs these readings over USB, displaying on your computer screen. You’ll start by building this simple monitor, and then move on to intermediate and advanced builds that incorporate LED and LCD displays, learning about Arduino and electronics as we go.

All electronic parts for all three versions are available at Radio Shack in the Make: Ultimate Microcontroller Pack. They can also be purchased separately.


Step #1: Basic build: Light, heat, and moisture sensing.

Potted Plant Protector
  • For the basic build you'll need the Arduino Uno microcontroller, solderless breadboard, three 10kΩ resistors, jumper wires, a thermistor (temperature sensor), a photoresistor (light sensor), and the steel bolts and nuts.
  • You'll also need to make 2 spacers for your soil probes (the bolts). In a scrap of plastic, drill 2 holes 1/2" to fit your bolts. Make a second spacer and thread your bolts through both spacers, to keep them separated at a distance that won't vary.
  • I calibrated a fancier soil sensor by laser-cutting some 1/16” acrylic to serve as a separator between small pieces of 1/16”-diameter stainless steel rod, commonly used for TIG welding. Cut files for the acrylic are available here .

Step #2: Build the 3-sensor circuit.

Potted Plant ProtectorPotted Plant ProtectorPotted Plant ProtectorPotted Plant Protector
  • The 3 different sensors you'll use all operate the same way, by providing electrical resistance that varies depending on the amount of soil moisture, or heat, or light, that's detected. Generally, you can use a simple circuit like the one shown in the first schematic to read a variable resistance on an Arduino.
  • Here we'll use this setup for our 3 sensors — soil moisture, temperature, and light — and put them all together to create the circuit shown in the second schematic.
  • Following the schematic, build the circuit on the breadboard as shown in the third photo. The thermistor and photoresistor are on the breadboard; the soil probe is just 2 long wires, each wrapped around a bolt and secured with a nut. The soil probe is connected to the Arduino's analog pin A0, the thermistor to pin A1, and the photoresistor to pin A2.

Step #3: Program the Arduino.

Potted Plant Protector
  • Generally, we read a variable-resistance sensor attached to an analog input on the Arduino with the following code: sensorValue = analogRead(inputPin); where sensorValue is the reading from the sensor and inputPin is the number of the analog pin to which the sensor is attached
  • To read the 3 sensors, we simply repeat this code for all 3 sensors, add variable declarations, and set up our serial port. Here's the resulting code — download it from this link, open it in the Arduino IDE, and upload it to your Arduino.

Step #4: Place and calibrate sensors.

Potted Plant ProtectorPotted Plant ProtectorPotted Plant Protector
  • Poke the soil sensor into the soil next to your plant, mount the photosensor where it will receive the same amount of light as your plant's leaves, and mount the thermistor next to the photosensor. Power up the Arduino and watch the Serial Monitor on your computer to see the sensor values, updated every second.
  • For the best potted plant protection, you’ll want to calibrate your sensors to the range of conditions desired by your particular plant. Your local Master Gardener is a good resource for asking questions like “Is this how wet the soil should be when it’s watered enough? Is this how dry the soil should be when it’s time to water?” Then take readings with your Potted Plant Protector to quantify those values.
  • You can also borrow a fancier sensor and calibrate your inexpensive ones to it. Here are readings I took with an industrial soil moisture sensor compared to the Arduino values from my DIY welding-rod soil probe:
    • In open air: both sensors read 0
    • Very dry soil: 2% Vegetronix, 5 DIY
    • Slightly moist: 7%, 150
    • Slightly moister: 8%, 250
    • Wet soil: 28%, 370
    • Very wet soil: 51%, 385
    • Probe immersed in water: 85%, 480
    So if I want to water my soil to about 28% moisture, I should watch for a sensor reading of about 385 as my cutoff point.

Step #5: Intermediate build: Add an RGB LED indicator.

Potted Plant Protector
  • Now, you’ll add an LED to indicate how happy your plants are. I’m using blue to indicate water neediness, green for sunlight, and red for temperature, all displayed by a single RGB LED. (Of course, you have plenty of other options!) Grab the RGB LED and three 330Ω resistors.
  • Generally, you can connect an LED to an Arduino with the circuit shown in the first diagram here. On the schematic symbol for an LED, the triangle points to the anode (negative side). On an actual LED, the longer lead is the one you’ll connect to ground. (I’ve broken some expensive LEDs by hooking them up backward!)
  • The resistor regulates current to the LED: too much current, and our LED will burn out after a couple of seconds rather than lasting the 10,000-odd hours that it should.

Step #6: Connect the LED into your circuit.

Potted Plant ProtectorPotted Plant ProtectorPotted Plant ProtectorPotted Plant Protector
  • With an RGB LED, it’s common for the red, green, and blue elements to have a common cathode or common anode, resulting in 4 pins (check your datasheet to determine if a specific RGB LED is shared anode or shared cathode). The RGB LED in the Make: Ultimate Microcontroller Pack is common anode, so we’ll connect it as shown in the schematic here.
  • Following the schematic, connect the LED to +5V power and to the Arduino's digital input/output (I/O) pins D9, D10, and D11.

Step #7: Reprogram the Arduino.

Potted Plant Protector
  • The big new concept here is calling functions: instead of typing the same code over and over again, we can put it in a function and just call that function. For example, here’s how we turn all 3 colors off for the LED: digitalWrite(redPin, HIGH); digitalWrite(greenPin, HIGH); digitalWrite(bluePin, HIGH); Instead of typing this every time we want our LED to go off, we can put it in a function: void off() { digitalWrite(redPin, HIGH); digitalWrite(greenPin, HIGH); digitalWrite(bluePin, HIGH); }
  • Now, we can run this code whenever we want by calling the function off();. This is the simplest use of functions. As you learn more about programming, you’ll do all kinds of cooler, more complex things with them.
  • Here's the resulting code — download it from this link, open it in the Arduino IDE, and upload it to your Arduino.
  • This will cycle our LED through its different colors over the course of 5 seconds, depending on our plant’s conditions:
    • The LED will flash blue for 1 second if the soil is moist
    • The LED will flash red if our plants are warm
    • The LED will flash green if our plants are getting sun

Step #8: Advanced: Display readings on an LCD screen.

Potted Plant ProtectorPotted Plant ProtectorPotted Plant ProtectorPotted Plant Protector
  • Now, you’ll add an LCD text display to cycle through the 3 sensor readings, displaying each reading for 4 seconds (while still lighting the LED with the appropriate color when conditions match those that we set in the intermediate example). Grab the 16-pin LCD display and the 10kΩ potentiometer from the Make: Ultimate Microcontroller Pack.
  • You'll need to do some soldering to wire up the LCD screen. If you've never soldered before, don't worry! It's easy if you use good tools and proper technique. Our celebrity soldering tutorial is a great place to start learning.

Step #9: Connect the LCD display and test it.

Potted Plant ProtectorPotted Plant ProtectorPotted Plant ProtectorPotted Plant Protector
  • You'll connect the display slightly differently than you would if you only had the LCD connected. Do not worry, we will just give you what you need to know for the project! For the curious, check out
  • Following the schematic, connect the LCD into your circuit:
    • LCD pin #1 to Ground on your breadboard
    • LCD pin #2 to 5V and also the potentiometer outer pin --does not matter which outer pin, just pick one.
    • LCD pin #3 to the potentiometer wiper --that is the middle pin.
    • LCD pin #4 to the Arduino digital pin #7 --this is different from the stock LCD Library.
    • LCD pin #5 to GND and also the potentiometer´s other outer pin.
    • LCD pin #6 to the Arduino digital pin #6 --this is different from the stock LCD Library.
    • LCD pins #7 - #10 do not connect to anything.
    • LCD pin #11 to the Arduino digital pin #5
    • LCD pin #12 to the Arduino digital pin #4
    • LCD pin #13 to the Arduino digital pin #3
    • LCD pin #14 to the Arduino digital pin #2
    • LCD pins #14 and #15 do not connect to anything.
  • The Arduino tutorial referenced above provides everything you need to drive the LCD. To test your LCD, here’s their sample code, adapted for our pins. Download it from this link and upload it to the Arduino, then be sure to turn the potentiometer until you can see “hello world” displayed on the screen. If your LCD is connected correctly, this should blink on and off every second.

Step #10: Reprogram the Arduino.

Potted Plant Protector

Now, here’s the complete Potted Plant Protector code with the LCD added. Once you're satisfied your LCD is working, download the code from this link and upload it to the Arduino.

Step #11: Growing Further

Potted Plant ProtectorPotted Plant ProtectorPotted Plant ProtectorPotted Plant Protector
  • That's it! Now your plants can tell you exactly what they need, exactly when they need it. Here are some advanced options for really making your Potted Plant Protector bloom:
  • Controls: Add a relay shield (RadioShack #277-067) to control water pumps, heaters, or lights for your plants. You’ll want to explore the Arduino time library ( for tasks like “turn on lights so that sunlight + supplemental lights add up to 16 hours per day.”
  • Power management: Make your Arduino go to sleep and only wake up for readings every few minutes to drastically extend battery life. Simple ( ) and advanced ( ) guides are available; this will also drastically extend the life of your soil probes before they start to corrode.
  • Solar power: Add a solar panel and battery to power your plant protector off-grid (
  • Connectivity: Share your data with others and access it remotely with an Ethernet shield (RadioShack #276-241), Wi-Fi shield (, or even a cellular shield.
  • Better sensors: Explore the many sensor options, including pH, light spectrum, and humidity, to graduate your Potted Plant Protector to the next level of science!
Luke Iseman

Luke Iseman

Luke Iseman makes stuff, some of which works. He invites you to drive a bike for a living (, stop killing your garden (, and live in an off-grid shipping container (


  • Jim

    If you plot your DIY results against the Vegetronix, you can do an exponential regression for the equation. If x=analogRead value, the equation is %moisture=1.7772e^(0.0079x). The R^2 for your data is 0.96, so the fit is very good. The Veg probably has this same equation built in. Regards.

    • Luke Iseman

      Thanks Jim; great work!

  • problem with the description in Step 5. You write: “On an actual LED, the longer lead is the one you’ll connect to ground. ” but 1) the schematic of the RGB LED itself shows otherwise, and 2) the schematic of the RGB LED shows a different polarity that the schematic right next to it with the LED in series.

    • what about tungsten for the moisture sensor? What do the numbers that are being returned to the arduino relate to-how would they translate to actual temperature, humidity percentages and light intensity?

    • Hi Justin,

      The circuit is correct: rgb leds are sometimes common-anode and sometimes common-cathode.

  • Pieter Pieterse

    Hi, I’m having problems with getting the thermistor to work. In absence of the parts list specifying a thermistor size, or resistance, I tried a “TDC150” thermistor, but it just sits on one value all the time, when connected as above. When I remove the resistor, it reads higher, but again it just always reads the same?

    • Hi, Just realized that I mistakenly assumed that the temperature was measured across the soil probe also, which is why I wasn’t seeing fluctuations when I moved the probe between hot and cold matter. It is working. But it would be good to have the specs of things like this in the plans, so noobs would know what to buy. Thanks for a great project.

  • Zain

    Hi I really liked your work ,I have few Questions for you
    Can we use an Arduino MintDuino instead of Arduino UNO , will there be any changes in programming for Mintduino. And How a soil probe works as a moisture sensor.

    • Tom T.

      It is done by measuring the resistance of the soil, which conductivity gets better as it’s wetter.

  • Dennis

    awesome! thanks for contributing

  • Aravind Ravi

    hey, nothing’s appearing on the screen when I power it up. Help!

    • Aravind Ravi

      The serial monitor is blank!

      • Pieter Pieterse

        Hi, You need to set the baud rate of your serial monitor to the same number as the command in the code.

        • Sorry, I meant serial.begin. It’s set the 9600 in this tutorial’s code. In the monitor there’s a dropdown box with all the serial baud rates.

  • Frank August Abraham

    help with the design and configuration of a much simpler idea would be greatly appreciated.
    just a small 110 AC irrigation pump that would be controlled by a moisture meter.

  • Pat

    How can I convert the temperature to degrees Celsius?

  • Khulood Khaled

    I loved the project and wanted to implement it but faced a problem in understanding last two bullet points in step #1. Could you provide a clearer explanation? Or some photos clarifying the process of preparing the soil probes. Please reply to me as soon as possible. Thank you.

  • Matt Moore

    Are these 1/4 watt or 1/6 watt resistor? Does it matter which is used?

  • Murilo Picanço

    Hi there. I have put together a similar project with an Xbee S1 module sampling soil temperature, soil humidity and ambient light. It is 100% solar powered and it includes a battery that keeps it working over night. Several similar modules can be placed in different parts of the house / garden to monitor different plants. All modules send the radio signals to a Coordinator Xbee + Arduino connected to the home network, which runs the code that converts 0-255 analog signals to actual meaningful sensor data. It also uploads it to an IoT website to allow data storing / tracking. I’d love to share it on your forum somewhere if that’s ok.

    • RoseZetta Cummings

      Hello! I am a teacher in Anaheim, CA and my students are doing something like this for the OC Maker Challenge. Are you a local?

  • april rose moreno

    can you provide pdf..?

  • Rose

    Hi there! Has anyone made a sensor that automatically waters plants once they are unhappy? I am hoping to do this and wasn’t sure if there was a head start!

  • Advik Singhania

    Hello Sir,
    I like this project very much…it is a very fascinating and excellent project but the problem is that I am unable to get the code because of some error.
    Therefore I would request you to email me the arduino source code for this project on my gmail account :- [email protected].
    Please send me the code as soon as possible as I am eager to make this project.
    I would be very much obliged.
    Thank You !!

  • Natalie Williams

    Hello, I don’t have the Ultimate Micro-controller pack, but I do have the majority of the components, all I’m missing is the thermistor, can you tell me which one you use so i can get one? Thanks

  • Ymar Moura

    I also found some difficulties in step 1 in the last two points , could you please provide us with some pdf explaining it in a better way ? Thank you.

  • Eliu Anderson

    I tried to upload the PPPBasic and it did not work because I need more storage space, how can I make it work?

  • Sravan Kumar Reddy

    RGB common should be to ground and the program needs lots of correction , especially RGB lighting to different parameters , like moisture blue for temp.

  • Sravan Kumar Reddy

    Hello folks
    The concept is good but this designing ,programming needs correction
    1. Common of RGB is to ground not 5v
    2 In program for led off its all low
    And where u need to want blue to light put HIGH there rest LOW
    Similarly for red and green