0% found this document useful (0 votes)
8 views7 pages

Ebpl Lab

The document outlines various Arduino projects including an automatic street light, a smart waste bin with garbage level monitoring, a smart home security system, a temperature monitoring system, and a gas leak detection system. Each project includes code snippets demonstrating the setup and loop functions for sensor readings and device control. The projects utilize components like ultrasonic sensors, PIR sensors, DHT sensors, and LCD displays to achieve their respective functionalities.

Uploaded by

jebas5294
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views7 pages

Ebpl Lab

The document outlines various Arduino projects including an automatic street light, a smart waste bin with garbage level monitoring, a smart home security system, a temperature monitoring system, and a gas leak detection system. Each project includes code snippets demonstrating the setup and loop functions for sensor readings and device control. The projects utilize components like ultrasonic sensors, PIR sensors, DHT sensors, and LCD displays to achieve their respective functionalities.

Uploaded by

jebas5294
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

EBPL LAB:

EXNO:1
AUTOMATIC STREET LIGHT
void setup()
{
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(A0, INPUT);

}
void loop()
{
int value;
value = analogRead(A0);
if (value > 500)
{
digitalWrite(2, LOW);
digitalWrite(3, LOW);
digitalWrite(4, LOW);
}
else
{
digitalWrite(2, HIGH);
digitalWrite(3, HIGH);
digitalWrite(4, HIGH);
}
delay(0);
}

CIRCUIT DIAGRAM:
EXNO:2
Smart waste bin with garbage level monitoring
const int trigPin = 7;
const int echoPin = 6;
long duration;
int distance;
int LED =13;

void setup()
{
pinMode(trigPin,OUTPUT);
pinMode(echoPin,INPUT);
pinMode(LED,OUTPUT);
Serial.begin(9600);

}
void loop()
{
digitalWrite(trigPin,HIGH);
digitalWrite(trigPin,LOW);
duration = pulseIn(echoPin,HIGH);
distance = duration * 0.034 / 2;
Serial.print("distance");
Serial.println(distance);
Serial.print("\n");
delay(1000);
if (distance > 10)
{
digitalWrite(LED,HIGH);
delay(1000);
Serial.println("Garbage full");
}
else
{
digitalWrite(LED,LOW);
delay(1000);
Serial.println("Garbage is not full");
}
}

EXNO:3
Smart home
const int trigPin = 7;
const int echoPin = 6;
const int pir =19;
long duration;
int distance;
void setup()
{
pinMode(trigPin,OUTPUT);
pinMode(echoPin,INPUT);
pinMode(pir,INPUT);
Serial.begin(9600);
}
void loop()
{
digitalWrite(trigPin,HIGH);
digitalWrite(trigPin,LOW);
duration = pulseIn(echoPin,HIGH);
distance = duration * 0.034 / 2;
Serial.println("Duration:");
Serial.println(duration);
Serial.print("Distance from security");
Serial.println(distance);

const int IP=digitalRead(pir);


Serial.println(IP);
delay(100);
if(IP==1)
{
Serial.println("Movement of a human detected alert");
delay(1000);
}
else
{
Serial.println("Safe state");
delay(1000);

}
}
Exno:4
Temperature monitoring system
#include <DHT.h>;
#include <LiquidCrystal_I2C.h>

#define DHTPIN 2
#define DHTTYPE DHT22
DHT dht(DHTPIN, DHTTYPE);
LiquidCrystal_I2C lcd(0x27,16,2);

int chk;
float temp;

void setup()
{
dht.begin();
lcd.init();
lcd.backlight();
}

void loop()
{
delay(2000);
temp= dht.readTemperature();
lcd.setCursor(0,0);
lcd.print(" Temp: ");
lcd.print(temp);
lcd.println(" Celsius");
delay(10000);
}

Exno:5
#include <LiquidCrystal_I2C.h>
#define GasSensor A0
#define RelayPin 8
LiquidCrystal_I2C lcd(0x27, 20, 4);
bool gasLeak = false;
void setup()
{
Serial.begin(9600);
pinMode(RelayPin, OUTPUT);
lcd.init();
lcd.backlight();
}
void loop()
{
int gasLevel = analogRead(GasSensor);
int GasThres = 500;
if (gasLevel > GasThres)
{
digitalWrite(RelayPin, HIGH);
gasLeak = true;
}
else
{
digitalWrite(RelayPin, LOW);
gasLeak= false;
}
lcd.setCursor(0, 0);
if (gasLeak)
{
lcd.print("Gas Leak Detected!");
lcd.setCursor(0, 1);
lcd.print("Shutting off valve");
}
else
{
lcd.print("Gas Level in Control");
lcd.setCursor(0, 1);
lcd.print("Valve is Open");
delay(1000);
}

You might also like