Things used in this project

Schematics

Arduino Setup
B8wanslyj8njtbhjbuja
Interfaces
F8snr9zijocbv079imxw

Code

Arduino CodeArduino
//#include <TH02_dev.h>
#include "Arduino.h"
#include "Wire.h"
#define PIR_MOTION_SENSOR 7 //Use pin 7 to receive the signal from the module
const int analogInPin0 = A0;  // light
const int analogInPin1 = A1;  // UV
const int analogInPin2 = A2;  //humidity

int lightValue = 0;        
int uvValue = 0;
int moistureValue = 0;

void setup()
{
      Serial.begin(9600);
      TH02.begin();
      pinMode(PIR_MOTION_SENSOR, INPUT);
}

void loop()
{
    if(isPeopleDetected())//if it detects the moving people?
        {
          system("/home/root/x.sh \"Welcome to Obama Care for Plants\"");
          lightValue = analogRead(analogInPin0);
          uvValue = analogRead(analogInPin1);
          moistureValue = analogRead(analogInPin2);
          float temperValue = TH02.ReadTemperature();
          float humidityValue = TH02.ReadHumidity();

          system("/home/root/x.sh \"Your Light exposure is\"");
          if(lightValue>=300){
          system("/home/root/x.sh \" good\"");
          }
          else system("/home/root/x.sh \" bad\"");
          
          system("/home/root/x.sh \" UV exposure is\"");
          if(uvValue<=30){
          system("/home/root/x.sh \" good\"");
          }
          else system("/home/root/x.sh \" bad\"");
          
          system("/home/root/x.sh \" Soil Moisture is \"");
          if(moistureValue>=30){
          system("/home/root/x.sh \" good\"");
          }
          else system("/home/root/x.sh \" bad\"");
   
          system("/home/root/x.sh \" Temperature is \"");
          if(temperValue>=10){
          system("/home/root/x.sh \" comfy\"");
          }
          else system("/home/root/x.sh \" not comfy\"");
       
          system("/home/root/x.sh \" Air Humidity is\"");
          if(humidityValue>=15){
          system("/home/root/x.sh \" good\"");
          }
          else system("/home/root/x.sh \" bad\"");

          system("/home/root/x.sh \" Thank you for visiting obama care's green house\"");
          
        }
        else
        {
          lightValue = analogRead(analogInPin0);
          uvValue = analogRead(analogInPin1);
          moistureValue = analogRead(analogInPin2);
          float temperValue = TH02.ReadTemperature();
          float humidityValue = TH02.ReadHumidity();
          String command = "/home/root/y.sh";

          command += " " + (int)humidityValue;
          command += " " + uvValue;
          command += " " + moistureValue;
          command += " " + lightValue;
          command += " " + (int)temperValue;
           
          system(command.buffer);
          sleep(10000);
        }
    }

boolean isPeopleDetected()
{
    int sensorValue = digitalRead(PIR_MOTION_SENSOR);
    if(sensorValue == HIGH)//if the sensor value is HIGH?
    {
        return true;//yes,return true
    }
    else
    {
        return false;//no,return false
    }
}

Credits

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Similar projects you might like

Blynk GPS Tracker
Intermediate
  • 78
  • 3

Full instructions

Simple GPS tracker using a Particle Photon (or Electron) and an EM406 GPS module with location visible on Blynk app map.

Amazon Echo – Control IoT devices via HTTP
Intermediate
  • 250
  • 11

Full instructions

I am going to show how to use Amazon Echo to control IoT devices via HTTP protocol. Turning on/off a light bulb is an example.

Amazon Echo – Read Temperature and Humidity from Sensor
Intermediate
  • 312
  • 12

Full instructions

I am going to show how to use Amazon Echo to read temperature and humidity from sensor.

4 Wire LCD control with BL and contrast using Shift Register
Intermediate
  • 77
  • 2

Full instructions

Control a 16x2 LCD, including contrast and backlight in code, using shift register. Includes library with fade and backlight functions.

Pool Buddy
Intermediate
  • 1,658
  • 11

Work in progress

Monitor and log water quality (pH & ORP) and temperature from everywhere.

DIY Vintage Spotify Radio Using A Raspberry Pi
Intermediate
  • 2,080
  • 15

Full instructions

Make your own vintage radio that streams Spotify, Google Play Music, SoundCloud and your own local music!

ProjectsCommunitiesTopicsContestsLiveAppsBetaFree StoreBlogAdd projectSign up / Login
Feedback