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

Reducing Arduino Power Consumption
Intermediate
  • 1,163
  • 98

Protip

One the most important feature of portable electronics should be long battery life. We can reduce the current drawn by several ways.

Ultrasonic Sensor
Intermediate
  • 210
  • 3

This project shows you how to use the Ultrasonic for meter distance.

Smart Payment System for Parking Area Using RFID
Intermediate
  • 627
  • 11

This project makes a simple, cheap and secure payment system using RFID that is suitable for small businesses.

IoT Red Phone
Intermediate
  • 998
  • 9

Work in progress

The phone will ring if you have an alert in your AWS Cloudwatch. If you pick up the handset, it tells you whats wrong.

RING PONG
Intermediate
  • 1,940
  • 8

A simple Ping Pong game played on a NeoPixel Ring with Arduino.

 Monitoring Working Time of Employees Using RFID
Intermediate
  • 535
  • 10

Full instructions

This helps monitor the working time of employees, storing information in database.

ProjectsCommunitiesTopicsContestsLiveAppsBetaFree StoreBlogAdd projectSign up / Login