Hackster is hosting Hackster Holidays, Ep. 7: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Friday!Stream Hackster Holidays, Ep. 7 on Friday!
Gabriel FloresShahrukh Khan
Published

Greenhouse Temperature/Humidity and Soil Moisture Sensor

This is a pair of sensors that collect the temperature and humidity of a location, along with the soil moisture of a particular plant.

AdvancedFull instructions provided6 hours4,871
Greenhouse Temperature/Humidity and Soil Moisture Sensor

Things used in this project

Hardware components

Photon
Particle Photon
×1
DHT22 Temperature Sensor
DHT22 Temperature Sensor
×1
Resistor 10k ohm
Resistor 10k ohm
×1
SparkFun Soil Moisture Sensor (with Screw Terminals)
SparkFun Soil Moisture Sensor (with Screw Terminals)
×1
Jumper wires (generic)
Jumper wires (generic)
×1
5 mm LED: Red
5 mm LED: Red
×1
Perf board
×1

Software apps and online services

Particle

Hand tools and fabrication machines

Laser cutter (generic)
Laser cutter (generic)
Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Custom parts and enclosures

Enclosure SVG. File

Enclosure Plans

Schematics

Enclosure Sketch

This was our prototype sketch of the enclosure.

PCB Sketch

This diagram shows how the different components of the project will be layed out onto the pcb board.

Fritzing Diagram

This is a diagram for you to follow when constructing the circuit of the project.

Code

The Code

Arduino
Can only be used in the Particle coding environment.
#include <Adafruit_DHT.h>

#define DHTPIN 3
#define DHTTYPE DHT22	


DHT dht(DHTPIN, DHTTYPE);

double hum;
double temp;
double newTemp;
double newHum;
int moist;
int sensorPin = A0;


void setup()
{
    Serial.begin(9600);
    pinMode(DHTPIN, INPUT);//DHT sensor
    pinMode(6, OUTPUT); //red LED
   
    moist = analogRead(sensorPin);
    
    Particle.variable("hum", hum);
    Particle.variable("temp", temp);
    Particle.variable("moist", moist);
}

void loop()
{    
    hum = dht.getHumidity();
    temp = dht.getTempFarenheit();
    moist = analogRead(sensorPin);
    
    newHum = dht.getHumidity();
    newTemp = dht.getTempFarenheit();
    
    delay(3000);
   
    if (newHum > 0 && newHum < 100)
        {
        hum = newHum;
        }
    if (newTemp > 32 && newTemp < 100)
        {
        temp = newTemp;
        }
    delay(3000);
   
   
   //The constraints set for the moisture sensor and LED, will vary depending on the plant used. These can be determined by graphing/charting the data.
   
    if(moist < 1200)
    {
        digitalWrite(6, HIGH);
    } 
    
    if(moist > 3900)
    {
        digitalWrite(6, LOW);
    }
}

Credits

Gabriel Flores
1 project • 1 follower
Shahrukh Khan
1 project • 1 follower

Comments