Hackster is hosting Hackster Holidays, Ep. 4: Livestream & Giveaway Drawing. Start streaming on Wednesday!Stream Hackster Holidays, Ep. 4 on Wednesday!
Nick FurrGrayson TaylorParker Robb
Published

Plant Conditions Monitoring System

This project will allow you to keep your plant happy by monitoring its environment via temperature, light, and soil moisture data.

BeginnerFull instructions provided287
Plant Conditions Monitoring System

Things used in this project

Hardware components

Photon 2
Particle Photon 2
×3
Breadboard (generic)
Breadboard (generic)
×3
Photo resistor
Photo resistor
×1
Jumper wires (generic)
Jumper wires (generic)
×10
USB-A to Mini-USB Cable
USB-A to Mini-USB Cable
×3
Resistor 220 ohm
Resistor 220 ohm
×2
Grove - Temperature Sensor
Seeed Studio Grove - Temperature Sensor
×1
Gravity: Analog Capacitive Soil Moisture Sensor- Corrosion Resistant
DFRobot Gravity: Analog Capacitive Soil Moisture Sensor- Corrosion Resistant
×1

Software apps and online services

adafruit.IO
Particle Build Web IDE
Particle Build Web IDE

Story

Read more

Schematics

Data Diagram

This diagram shows how the data flows within the project. The first Photon receives data from the photo-resistor and publishes this data to the photon console and to Adafruit through a web-hook. The Second Photon Receives data from the soil moisture sensor and this data is sent to the photon console and Adafruit through a web-hook. The Third photon receives data from the temperature sensor and sends this data to the photon console and adafruit through a web-hook. The first photon subscribes to the soil moisture data from the second photon and turns on the D7 on the first photon when the moisture gets too low. The second photon subscribes to the data from the third photon's temperature data. If the temperature gets too low it turns on the D7 on the second photon.

Soil Moisture Sensor Schematic

This is the circuit schematic for the soil moisture sensor to be connected to the Photon 2.

Soil Moisture Sensor Circuit Image

This is an image of the built soil moisture sensor circuit.

Temperature Sensor Schematic

This is the circuit schematic for the SeeedGrove temperature sensor to be connected to the Photon 2.

Temperature Sensor Circuit Image

This is an image of the built temperature sensor circuit.

Photoresistor Light Sensor Circuit Image

This is an image of the built photoresistor light sensor circuit.

Photoresistor Light Sensor Schematic

This is the circuit schematic for the photoresistor light sensor to be connected to the Photon 2.

Code

Soil Moisture Sensor Code

C/C++
This is the code used to allow the transfer of data from the sensor to be received in the Particle console. This code also creates a communication line between the temperature sensor and a separate photon that turns on the built in LED if the temperature conditions exceed their healthy limit. A web hook was also created to send the data to the Adafruit graph from the particle publish command.
#include "Particle.h"
//define the soil moisture pin
int soilmoistpin = A0;
int ledPin = D7;


#define IO_USERNAME "insert-username"
#define IO_KEY "insert-key"

// Replace "soilmoist_data" with the name of your Adafruit IO feed
#define IO_FEED "soil-moisture"

void setup() {
    //put initialization code
    Particle.connect();
    pinMode(ledPin, OUTPUT);
    Particle.subscribe("temperature", temperatureHandler, MY_DEVICES);
}

void loop() {
    //read the analog value from the moisture sensor
    int sensorValue = analogRead(soilmoistpin);
    
       //Punblish the sensor value to the Adafruit IO feed
    Particle.publish("soildata", String(sensorValue));
    
    // Wait for a few secinds before reading again
    delay(10000);
}

void temperatureHandler(const char *event, const char *data) {
    int temperature = atoi(data);
    if (temperature < 60) {
        // If the temperature exceeds 85 degrees, turn on the D7 LED
        digitalWrite(ledPin, HIGH);
    } else {
        // If the temperature is below or equal to 85 degrees, turn off the D7 LED
        digitalWrite(ledPin, LOW);
    }
}

Photoresistor Code

C/C++
This is the code used to allow the transfer of data from the photo-resistor to be received in the Particle console. This code also creates a communication line between the soil moisture sensor and a separate photon that turns on the built in LED if the moisture conditions exceed their healthy limit. A web hook was also created to send the data to the Adafruit graph from the particle publish command.
#include "Particle.h"
//define the soil moisture pin
int photoresistpin = A0;
int ledPin = D7;


#define IO_USERNAME "insert-username"
#define IO_KEY "insert-key"

// Replace "soilmoist_data" with the name of your Adafruit IO feed
#define IO_FEED "soil-moisture"

void setup() {
    //put initialization code
    Particle.connect();
    pinMode(ledPin, OUTPUT);
    Particle.subscribe("soildata", soilHandler, MY_DEVICES);
}

void loop() {
    //read the analog value from the moisture sensor
    int sensorValue = analogRead(photoresistpin);
   
       //Punblish the sensor value to the Adafruit IO feed
    Particle.publish("light-data", String(sensorValue));
   
    // Wait for a few secinds before reading again
    delay(10000);
}

void soilHandler(const char *event, const char *data) {
    int soildata = atoi(data);
    if (soildata < 2000) {
        // If the temperature exceeds 85 degrees, turn on the D7 LED
        digitalWrite(ledPin, HIGH);
    } else {
        // If the temperature is below or equal to 85 degrees, turn off the D7 LED
        digitalWrite(ledPin, LOW);
    }
}

Temperature Code

C/C++
This is the code used to allow the transfer of data from the temperature sensor to be received in the Particle console. A web hook was also created to send the data to the Adafruit graph from the particle publish command.
void loop() {
  // Read the analog value from the sensor
  int sensorValue = analogRead(A0);

  // Convert the analog value to temperature (adjust the conversion factor based on your sensor)
  float temperature = sensorValue/28.35;
  // Publish the temperature to the Particle Cloud
  Particle.publish("temperature", String(temperature));

  // Delay before the next reading
  ;delay(10000);
}

Credits

Nick Furr

Nick Furr

1 project • 0 followers
Grayson Taylor

Grayson Taylor

1 project • 0 followers
Parker Robb

Parker Robb

1 project • 0 followers

Comments