Introduction: Smart Plant

Gardening Contest:

I am entering this Instructable in the Gardening Contest. If you read through this and find it informative or cool, please vote for me.

About this Project:

This is my first project with Arduino and I believe that it went pretty well. I finished with an end product that does what I want it to, so that's good!

This is a very late Mothers Day gift for my Mom!

What is It?

If a cat is thirsty, it lets you know. If a plant is thirsty it just dies quietly. The Smart Plant system fixes that. It gives your plant a way to tell you whats wrong with it.

How do you use it?

A status LED and 16x2 LCD Display give you information about your plants health.

The LED is a quick way for you to get information as you walk by. It is easy to notice and quick to look at. When the plant is very happy, the LED is green, when somewhat upset, the LED is yellow and when it is near death (in critical condition), the LED is red.

The LCD screen gives you in depth information about the plants status, telling you if the plant is "dying of thirst", "too cold", "burning up", etc. The bright blue display can be turned of by switch when not in use. You can leave it on all the time or just turn it on when you need to know the status specifics.

How does it work?

A DHT 11 temperature and humidity sensor tells the Arduino temperature information.

A soil moisture sensor (I believe these measure soil conductivity) tells the Arduino how dry/ wet the soil is.

The Arduino interprets these inputs and displays information accordingly.

Step 1: Gather Materials and Tools

Materials

  • Arduino Nano
  • DHT 11 Sensor
  • Soil Moisture Sensor
  • RGB LED
  • 16x2 Serial LCD Module
  • SPST Switch
  • Assorted Wire
  • Assorted Screws/ bolts
  • Assorted Heat shrink
  • Desired 3D Printing material (I used PLA)
  • Wood (approx 8" x 1" x 0.21")
  • Acrylic (approx 10" x 10" x 2mm)

Note on Buying Stuff:

This sensor kit has all of the sensors you need and the LED module. I found that it was cheaper than buying sensors individually...

https://www.amazon.com/gp/product/B00WQY2704/ref=o...

Tools

  • Soldering Equipment
  • Hot Glue Gun
  • Heat Gun
  • Dremel (only if you screw up like I did)
  • Files
  • Knives
  • Plyers
  • Wire Strippers
  • Assorted Screwdrivers
  • Other misc Hand tools

Step 2: Prototyping

I prototyped this with an Arduino Uno clone and a breadboard. I would have rather done this with an Arduino Nano, but did not have 2 and did not want to solder headers onto the one for this project. I found that all my code transferred without any problems.

Note:

  • If you want to recreate my project exactly then this step is not very important. Consider plugging everything in and testing the code before soldering, but that is probably unnecessary.
  • If you want to modify this project then I highly recommend prototyping with a breadboard and jumper wires first.

Purpose of Prototyping:

  • Make sure all electronic components work
  • Make sure code works/ is possible
  • Get everything running with no permanent connections
    • ie it is easy to fix issues

Stuff I Used (first photo):

  • Breadboard
  • Arduino Uno Clone
  • RGB LED Module
  • DHT 11 Temperature and Humidity Sensor
  • Soil Moisture Sensor
  • 16x2 Serial LCD Module
  • Assorted Jumper Wires (male-male, male-female, female-female)

Notes on Code:

  • You may have to change some parameters like screen info, etc
  • All of the places to change info should be labeled pretty well
  • All of the pin assignments should be labeled if you want to change those
  • You will need to have a few libraries installed
    • LiquidCrystal_12C
    • dht
      • These should be included on this page
  • I have included the code in the text and have uploaded my Arduino Sketch File (formatted much better)

Code:

//Smart Plant Code v1
//Author: Jordan Alexander Palka //Date finalized: 21 May 2017

//define libraries to include

#include #include #include

//define pin for Temperature and Humidity Sensor

dht DHT; #define DHT11_PIN 7

//define global variables

int temp; bool count_m = false; bool count_t = false;

//define information for LCD Display

#define I2C_ADDR 0x3F LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);

// define Soil Sensor Values

int soil_sensor = A0; int SoilValue = 0; int SoilVCC = 5; //define led values

int redPin = 11; int greenPin = 10; int bluePin = 9;

#define COMMON_ANODE

void setup() { //led setup

pinMode(redPin, OUTPUT); pinMode(greenPin, OUTPUT); pinMode(bluePin, OUTPUT);

//lcd setup

//soil sensor setup

pinMode(SoilVCC, OUTPUT); }

void loop() { //lcd setup //This needs to be here if we ant to switch lcd on and off by a switch on vcc. Else put it in void setup () area lcd.begin(16, 2); //display temp values.

int chk = DHT.read11(DHT11_PIN); temp = DHT.temperature;

lcd.setCursor(0, 0);

if (temp >= 27 ) { lcd.print("Help me im hot! "); }

if (temp >= 16 && temp <= 26) { lcd.print("Temp is awesome!"); }

if (temp <= 15 ) { lcd.print("Help me im cold "); }

//display moisture values

digitalWrite(SoilVCC, HIGH); delay(100);

SoilValue = analogRead(soil_sensor);

lcd.setCursor(0, 1);

if (analogRead(1) > 701 ) { lcd.print("DYING of thirst!"); }

if (analogRead(1) > 601 && analogRead(1) < 700) { lcd.print("Im thristy! "); }

if (analogRead(1) > 461 && analogRead(1) < 600) { lcd.print("Just enough H2O."); }

if (analogRead(1) > 421 && analogRead(1) < 460) { lcd.print("Too much water! "); }

if (analogRead(1) < 420) { lcd.print("Im drowning!!! "); }

digitalWrite(SoilVCC, LOW);

//led controll-Defining Bool Values

if (temp >= 16 && temp <= 26) { count_t = true; }

else { count_t = false; }

if (analogRead(1) >= 461 && analogRead(1) <= 600) { count_m = true; }

else { count_m = false; }

//led control-Color Selection

if (count_m == true && count_t == true) { setColor(0, 255, 0); // Green Color }

else if (count_m == true || count_t == true) { setColor(255, 255, 0); // Yellow Color }

else { setColor(255, 0, 0); // Red Color } } void setColor(int red, int green, int blue) {

analogWrite(redPin, red); analogWrite(greenPin, green); analogWrite(bluePin, blue);

//final delay //set delay time in the line below. delay(1000*#)where # = desired sceonds of delay delay(1000*8); }

Steps:

  1. Connect components as shown in images 2 and 3
  2. Upload Code to Arduino
  3. Observe and troubleshoot

Step 3: Design a Case

Key Point:

I use MMGS (millimeters, grams and seconds) throughout this Instructable!

Notes:

  • My case design uses 3D Printed and Laser Cut parts. If you can not do either of those, I suggest that you design a new case or modify mine.
  • If you want to recreate my project exactly then this step is not very important. Just go ahead to the '3D Printing' and 'Laser Cutting' steps.
  • If you want to modify this project then I will go into some detail on the design process.
  • The included SOLIDWORKS drawings a pretty rough.... I did not take much time to make the dimensions nice

Design Process:

  1. I began by drawing my rough case shape. I knew I did not want a square. I settled on the prism shape (see the almost isometric drawing on image 1).
  2. Then I drew a rough orthographic drawing and placed all of my features (openings, components, etc)
  3. I took dimensions of my components and used those to create dimensions for my case
  4. I created my case design in SOLIDWORKS

Misc. Notes:

  • I am not going in depth on what I did in SOLIDWORKS.
  • If you need to modify the case, my sldprt file is included.
  • If you do not have SOLIDWORKS, 123D Design is a fairly ok free 3D modeling package. It is the best free software that I have used... It shouldn't be too hard to recreate this case or a similar one in that program.

Step 4: 3D Printing

Important Information About the Case:

My STL file has some issues:

  • The LCD module does not fit in correctly, so I had to grind the case with a dremel
  • Most of the screw holes I made are un-accessible because of the case geometry, so I had to hot glue pretty much everything
  • The wall thickness ended up being the exact length of the shaft for my switch so I had to hot glue that

*These issues were not good, but they were all fixable, so I did not have to re-print my case. I have not modified this file at all, so If you print the attached STL it will have all of the same issues...

Notes:

  • I used an Ultimaker 3 Extended to print this
  • I printed in Ultimaker brand PLA
  • I would have rather printed in ABS, but I was scared of layer separation. Something like Taulmann T-Glass would be ideal....
  • I sliced my model in Cura and printed the file with the top down ( a 180 degree rotation over the xy plane)

Print Information:

  • 17 hr print time on draft quality
  • 100 g of PLA used
  • I printed with raft and support

Steps:

  1. Download model
  2. Slice
    1. I included the g-code that I used. It should be attached to this step.
  3. Print

*The steps vary a lot depending on your printer. Just be aware that this is a long print, so bed adhesion and layer separation are 2 very important things.

Fixing LCD Mounting:

  • Snip off excess header ( see photos)
  • File the sides of the opening to fit
  • Use a dremel to grind away the top wall as shown
    • Take care not to go through the wall!!!

NOTE: The LCD is an incredibly tight fit. I don't have mine screwed or glued. It is just a pressure fit.

Step 5: Removing Support & Finishing the 3D Print

Notes:

  • I listed exactly what I did on the photo comments.
  • I did not have a dental pick, but those are very helpful for removing support material

General Process:

  • Pry support away with a flat head screwdriver
  • Pull on support with pliers
  • Sand any "bad surfaces"

Step 6: Laser Cutting

Notes:

  • All of the included dxf files have added text boxes (these are automatically added by my student version of SOLIDWORKS). Delete those before laser cutting.
  • I do not include text on any of the included dxf files (I think it is easier to add text in a drawing program like Illustrator, Inkskape or Correl Draw)

Laser Cutter Information:

  • I am cutting on a 70 Watt Epilog Laser Cutter
  • I import dxf files into Correl Draw and press File>Print to laser cut them
    • I can then modify my laser settings in the "printer preferences" section

General Steps:

  1. Download dxf files
    • My sldprt files are included on this page if you want to modify my SOLIDWORKS parts
  2. Import dxf files into laser cutter software
  3. Add desired text
  4. Correct Settings
    • Make sure your power settings are good
    • Make sure it is cutting the lines to cut and engraving the lines to engrave (I set this by choosing the correct line thickness)
  5. Laser Cut

*The steps vary a lot depending on your printer

Step 7: Soldering & Attaching Components

For the next few steps, I am going to list the component, talk about soldering it and attaching it to the 3D Printed case. In general, we are just soldering wires per the wiring diagram listed above and putting them in the case where it makes sense.

General Notes on Soldering:

  • I like to tin all of my wires before soldering
  • Use heat shrink/ other insulation liberally
  • The most thorough instructions are on the DHT 11 sensor page. Reference those if you are confused

General Notes on Attaching:

  • Because of my poor case design, I had to hot glue a lot more than I wanted to
  • If you kept the main support material, you can use it as a stand for your case so it stays level while you work on it

Step 8: Arduino Nano

Soldering:

  • Solder wires onto:
    • Ground, 5V, A0, A4, A5, 7, 9, 10, 11

Attaching:

  • Put a few dabs of hot glue onto the "Arduino cavity"
  • Place Arduino in cavity and press for a few seconds
  • NOTE: Make sure the Mini USB is facing out!!!

Step 9: Soil Moisture Sensor Port

Soil Moisture Sensors are known to experience galvanic corrosion and become useless. To combat this, power only runs to the sensor when it is taking a reading. That being said, I still want the ability to change it out easily. To do this, I am using 2 female jumper cables as a "port" for the sensor.

Soldering:

  • We will deal with this later

Attaching:

  • Use a liberal amount of hot glue to secure in place
  • Make sure they are aligned properly

Soil Moisture Sensor Cable:

This cable will run from the case to the soil sensor (which will be in the pot).

  • Heat shrink 2 sets of 2 jumper wires together
    • I used male-male and female-female
    • Make sure you have 1 end with 2 female connectors and 1 end with 2 male connectors

Step 10: LCD

Notes:

  • Sorry for the lack of pictures

Soldering:

  • Wire to Grnd Pin
  • Wire to switch on VCC Pin
  • A4 wire to SDA
  • A5 wire to SLC

Attaching:

  • Press fit into window

Step 11: Switch

Soldering:

  • We are done for now

Attaching:

  • Place in hole
  • Hot glue
    • Make sure it is lined up the way you want it to be

Step 12: DHT 11 Sensor

Notes:

  • If you are at all confused about how to solder stuff on to modules, this step has the most thorough photo documentation.

Soldering:

  • Wire to VCC
  • Wire to Grnd
  • 7 to Data

Attaching:

  • Screw in to the rightmost mounting hole

Step 13: Soil Moisture Sensor Board

Notes:

  • Apparently I did not take pictures of this while I was doing it... Sorry about that

Soldering:

  • A0 to AC
  • Wire to Ground
  • Wire to VCC
  • Solder the two "Sensor Port Connections" to the two top pins. Order does not matter
    • I cut the ends off, stripped the wires and soldered them on
    • You could just plug the jumper cables in

Attaching:

  • Screw in to the leftmost mounting hole

Step 14: RGB LED

Soldering:

  • 11 to Red
  • 10 to Green
  • 9 to Blue
  • Wire to I

Attaching:

  • Place laser cut light diffuse in place (there is an inset circle on the case)
  • Put a very large quantity of hot glue over light diffuse and in the surrounding area
    • NOTE: I would rather not attach the LED this way, but with my current case design this is the easiest way... When designing a case, be sure to think about how you are attaching things.
  • Press LED board on to hot glue
    • Hold for as long as necessary (wait longer than you think you have to)

Step 15: Ground & 5V

Now we just need to connect all of the ground and 5V wires. I ended up soldering all of my wires. It would be easier to use "electrician caps" (I don't know a better name for these).

Notes:

  • Make sure you solder the wire coming off of the switch to the 5V bundle
  • Make sure you include the 5V and Ground wires from the Arduino

Steps:

  • Gather all ground wires
  • Twist together
  • Solder
  • Heat shrink
  • Repeat for 5V

Step 16: Almost Done!

Notes:

  • This step exists so I have a place to put these photos

Things to Consider:

  • Bundle wires by group (tape, zip tie, etc) to clean things up

Step 17: Testing!

At this point, we can plug it in, upload code and test it.

Notes:

  • You will need a Mini USB cable to upload code to the Nano and power it
    • This is bigger than most phone chargers (most phones use micro USB)

Notes on Code:

  • You may have to change some parameters like screen info, etc
  • All of the places to change info should be labeled pretty well
  • All of the pin assignments should be labeled if you want to change those
  • You will need to have a few libraries installed
    • LiquidCrystal_12C
    • dht
      • These should be included on the "Prototyping" step
  • I have included the code in the text and have uploaded my Arduino Sketch File (formatted much better)

Code:

//Smart Plant Code v1
//Author: Jordan Alexander Palka //Date finalized: 21 May 2017

//define libraries to include

#include #include #include

//define pin for Temperature and Humidity Sensor

dht DHT; #define DHT11_PIN 7

//define global variables

int temp; bool count_m = false; bool count_t = false;

//define information for LCD Display

#define I2C_ADDR 0x3F LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);

// define Soil Sensor Values

int soil_sensor = A0; int SoilValue = 0; int SoilVCC = 5; //define led values

int redPin = 11; int greenPin = 10; int bluePin = 9;

#define COMMON_ANODE

void setup() { //led setup

pinMode(redPin, OUTPUT); pinMode(greenPin, OUTPUT); pinMode(bluePin, OUTPUT);

//lcd setup

//soil sensor setup

pinMode(SoilVCC, OUTPUT); }

void loop() { //lcd setup //This needs to be here if we ant to switch lcd on and off by a switch on vcc. Else put it in void setup () area lcd.begin(16, 2); //display temp values.

int chk = DHT.read11(DHT11_PIN); temp = DHT.temperature;

lcd.setCursor(0, 0);

if (temp >= 27 ) { lcd.print("Help me im hot! "); }

if (temp >= 16 && temp <= 26) { lcd.print("Temp is awesome!"); }

if (temp <= 15 ) { lcd.print("Help me im cold "); }

//display moisture values

digitalWrite(SoilVCC, HIGH); delay(100);

SoilValue = analogRead(soil_sensor);

lcd.setCursor(0, 1);

if (analogRead(1) > 701 ) { lcd.print("DYING of thirst!"); }

if (analogRead(1) > 601 && analogRead(1) < 700) { lcd.print("Im thristy! "); }

if (analogRead(1) > 461 && analogRead(1) < 600) { lcd.print("Just enough H2O."); }

if (analogRead(1) > 421 && analogRead(1) < 460) { lcd.print("Too much water! "); }

if (analogRead(1) < 420) { lcd.print("Im drowning!!! "); }

digitalWrite(SoilVCC, LOW);

//led controll-Defining Bool Values

if (temp >= 16 && temp <= 26) { count_t = true; }

else { count_t = false; }

if (analogRead(1) >= 461 && analogRead(1) <= 600) { count_m = true; }

else { count_m = false; }

//led control-Color Selection

if (count_m == true && count_t == true) { setColor(0, 255, 0); // Green Color }

else if (count_m == true || count_t == true) { setColor(255, 255, 0); // Yellow Color }

else { setColor(255, 0, 0); // Red Color } } void setColor(int red, int green, int blue) {

analogWrite(redPin, red); analogWrite(greenPin, green); analogWrite(bluePin, blue);

//final delay //set delay time in the line below. delay(1000*#)where # = desired sceonds of delay delay(1000*8); }

Troubleshooting:

  • I had to change the COM Port for my Arduino
    • I ended up changing it to COM 2 (that worked!)

Steps:

  1. Go to Control Panel
  2. Select Device
  3. Open up its properties
  4. Change COM Port

*See Photos for individual mouse-clicks

Step 18: Attach Bottom and Plaque

Attach Bottom Panel:

  • Place a line of hot glue along the entire bottom lip
    • I did not take pictures of this step because I wanted to work quickly... Sorry
  • Press the bottom panel in place and hold
    • NOTE: This is a terrible design. It makes it very difficult to remove the bottom if something needs to be modified, fixed or replaced.
    • Be sure to put the bottom in the desired orientation (this is only necessary if you engraved text)
  • Once the hot glue has dried, scrape away excess glue using an x-acto knife, fingernail, etc)

Attach Front Plaque:

  • OPTIONAL: Use some wood finish on the front of the plaque (Danish Oil is my personal favorite)
    • I would not put any finish on the back. It will make it harder to adhere
  • Place a few dots of hot glue in the cavity for the plaque
  • Press and hold the plaque in place until glue is dry

Step 19: Your Done!

Gardening Contest:

This Instructable is entered in the Gardening Contest. If you think that this was informative or cool, please vote for me.

Things to Consider:

I have a few plans for v2:



• Add a self-watering function
• Add internet connectivity and have the plant tweet / e-mail when it wants something
• Design a better case

• Better attachments
• Better LED viewing angle
• Smaller
• Thinner walls
• Better, more accurate sensors





If you do any of the above or some other modification, please share your work (and code) to save us all some effort.

Comments

author
Swansong (author)2017-06-20

That's a neat setup, I have some roses that are suffering from over watering so I could use something like this. :)

About This Instructable

750views

15favorites

License:

Bio: My name is Jordan Palka, I am an: Engineering Student at the Colorado School of Mines, Maker &amp; 3D Printing enthusiast.
More by Helluva_Engineer:Smart Plant
Add instructable to: