George WestphallAbassie ThomasDaniel Sanford
Published © GPL3+

Golf Green Moisture, Temperature and Humidity Sensor

Golf greens often require a lot of labor in order to maintain them. This project plans to make that job easier.

IntermediateShowcase (no instructions)18 hours117
Golf Green Moisture, Temperature and Humidity Sensor

Things used in this project

Hardware components

Argon
Particle Argon
×3
DHT11 Temperature & Humidity Sensor (4 pins)
DHT11 Temperature & Humidity Sensor (4 pins)
×1
Gravity: Analog Capacitive Soil Moisture Sensor- Corrosion Resistant
DFRobot Gravity: Analog Capacitive Soil Moisture Sensor- Corrosion Resistant
×1
Jumper wires (generic)
Jumper wires (generic)
×10
LED (generic)
LED (generic)
×2

Software apps and online services

ThingSpeak API
ThingSpeak API

Story

Read more

Schematics

Moisture Sensor Circuit Diagram

This is the Circuit Diagram for the Moisture Sensor

Moisture Sensor

Picture of the Moisture Sensor

Temperature and Humidity Sensor Circuit

Temperature and Humidity circuit

Temperature and Humidity Sensor

Picture of the Temperature and Humidity Sensor

LED Circuit Diagram

LED Circuit

Picture of the LED Circuit

Project Schematics

This is a display of how each of our argons communicate with each other.

Code

Moisture Sensor Code

C/C++
This code collects moisture data from the grass sample and sends it to ThingSpeak.
// This #include statement was automatically added by the Particle IDE.
#include <ThingSpeak.h>

int moisture_pin = A1;

TCPClient client;


unsigned long myChannelNumber = 2102454;
const char * myWriteAPIKey = "FSTNOIUAZK05HSTB";


void setup() {
   
    ThingSpeak.begin(client);
    Serial.begin(9600);

}

void loop() {
   
    delay(2000);
   
    int moisture_analog = analogRead(moisture_pin);
    float moisture_percentage = (100 - ((moisture_analog/4095.00) * 100 ));
    float m = moisture_percentage;
   
    int sensor_analog;
   
   
    ThingSpeak.setField(3,m);
    ThingSpeak.writeFields(myChannelNumber, myWriteAPIKey);
   
   
   
    Serial.print("Moisture Percentage = ");
    Serial.print(moisture_percentage);
    Serial.print("%\n\n");
   
    delay(20000);
   
      if(m<=20){
          Particle.publish("Moist_20Sensor","DRY",PUBLIC);
    }
    else{
      Particle.publish("Moist_20Sensor","MOIST",PUBLIC);
      }
     
    delay(1000);
}

Temperature and Humidity Sensor

C/C++
This is the code for the DHT11 and its primary function is to send its data to our ThingSpeak page and publish and alert the LED circuit.
// This #include statement was automatically added by the Particle IDE.
#include <Adafruit_DHT.h>

// This #include statement was automatically added by the Particle IDE.
#include <ThingSpeak.h>






#define DHTPIN D6     // what pin we're connected to

// Here we define the type of sensor used
#define DHTTYPE DHT11        // DHT 11 

DHT dht(DHTPIN, DHTTYPE);
TCPClient client;


unsigned long myChannelNumber = 2102454;
const char * myWriteAPIKey = "FSTNOIUAZK05HSTB";


void setup() {
    
    ThingSpeak.begin(client);
    dht.begin();
}

void loop() {
    
    delay(2000);
    
   float h = dht.getHumidity();
    // Read temperature as Celsius
    float t = dht.getTempCelcius();
    // Read temperature as Farenheit
    float f = dht.getTempFarenheit();
   

    
    ThingSpeak.setField(1,f);
    ThingSpeak.setField(2,h);
    ThingSpeak.writeFields(myChannelNumber, myWriteAPIKey);
    
    Serial.print(dht.getHumidity());
  Serial.println("h");
  Serial.print(dht.getTempFarenheit());
  Serial.println("t");
    
    delay(30000);
    
    
    if(f>=80){
       Particle.publish("Temp_20Sensor","HOT",PUBLIC);
    }
    else{
      Particle.publish("Temp_20Sensor","LESS HOT",PUBLIC);
      }
      
    delay(1000);
   
    
}
 

LED ALERT CODE

C/C++
This code receives the alerts from the other two Argons and turns on the LED
int Led1 = D7;
int Led2 = D6;

void setup() {
    
Particle.subscribe("Temp_20Sensor", Temp_20Sesnor_Handler, "e00fce685149b691c0681dd2");
Particle.subscribe("Moist_20Sensor", Moist_20Sesnor_Handler,"e00fce68a82e99814c342878");

Serial.begin(9600);



}

void loop() {

}

void Temp_20Sesnor_Handler(const char *event, const char *data){
    
   digitalWrite(led1,HIGH);
   
    if (strcmp(data,"LESS HOT")==0) {
        
        
       digitalWrite(led1,LOW);
    }
    else if (strcmp(data,"HOT")==0) {
        
        digitalWrite(led1,HIGH);
       
    }

    delay(1000);
}

void Moist_20Sesnor_Handler(const char *event, const char *data){
    
   digitalWrite(led2,HIGH);
   
    if (strcmp(data,"MOIST")==0) {
        
        
       digitalWrite(led2,LOW);
    }
    else if (strcmp(data,"DRY")==0) {
        
        digitalWrite(led2,HIGH);
       
    }

    delay(1000);
}

Credits

George Westphall
1 project • 2 followers
Contact
Abassie Thomas
0 projects • 2 followers
Contact
Daniel Sanford
0 projects • 2 followers
Contact

Comments

Please log in or sign up to comment.