hariprasad_lokesh
Published

Real time Automated smart sensor city

Real time automatic home ligthing syatem, automatic plant watering system, anti social smoking system

IntermediateFull instructions provided278
Real time Automated smart sensor city

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Grove - Gas Sensor(MQ2)
Seeed Grove - Gas Sensor(MQ2)
×1
SparkFun Soil Moisture Sensor (with Screw Terminals)
SparkFun Soil Moisture Sensor (with Screw Terminals)
×1
IR Transceiver (Generic)
×1
Buzzer
Buzzer
×1
Linear Regulator (7805)
Linear Regulator (7805)
×1
LED Light Bulb, Frosted GLS
LED Light Bulb, Frosted GLS
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Schematics

circuit diagram

Code

code

Arduino
int mqsen = 2; int buz = 3; int ir_bulb = 8; int relay = 9; int led = 13; int sensorPin = A0;    // select the input pin for the potentiometer int sensorValue = 0;  // variable to store the value coming from the sensor int output_value; 
 
void setup() 
{ 
  pinMode(mqsen , INPUT);   pinMode(buz, OUTPUT);   pinMode(ir_bulb , INPUT);   pinMode(relay, OUTPUT);   Serial.begin(9600);   pinMode(led, OUTPUT); 
 
} 
 
void loop() 
{ 
  if ( digitalRead( mqsen ) ) 
  { 
    digitalWrite(buz, HIGH);     delay(5000);     digitalWrite(buz, !HIGH); 
  } 
 
   
  if ( digitalRead( ir_bulb ) ) 
  { 
    digitalWrite(relay, HIGH);     delay(5000);     digitalWrite(relay, !HIGH); 
  } 
  sensorValue = analogRead(sensorPin);   output_value = map(sensorValue, 1023, 0, 0, 100); 
  Serial.print("sensor = " );   Serial.print(output_value);   Serial.println("%");   if ( output_value < 20) 
  { 
    digitalWrite(led, HIGH);     delay(5000);     digitalWrite(led, !HIGH); 
  } 
} 

Credits

hariprasad_lokesh

hariprasad_lokesh

3 projects • 0 followers

Comments