0% found this document useful (0 votes)
7 views4 pages

Arduino Sensor Projects Overview

The document describes the pin configurations and code for several Arduino projects including a gas sensor, automatic light, car parking sensor, and tap water sensor. It provides the pin connections and code snippets for the setup and loop functions for each project.

Uploaded by

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

Arduino Sensor Projects Overview

The document describes the pin configurations and code for several Arduino projects including a gas sensor, automatic light, car parking sensor, and tap water sensor. It provides the pin connections and code snippets for the setup and loop functions for each project.

Uploaded by

Al IMRAN
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

Digital Point

Digital 2 = gas sensor led red


Digital 3 = relay auto light on off
Digital 4 = tap distance sensor (TRIG)
Digital 5 = tap distance sensor (echo)
Digital 6 = water tap DC motor
Digital 7= car parking sensor
Digital 8= gas sensor buzzer
Digital 9 = PIR Sensor AUTO LIGHT OFF
Digital 10 = Car parking led red
Digital 11 = Car parking led orange
Digital 12 = Car parking led green
Digital 13= car parking buzzer

Analog Point

Ana A0= gas sensor blue


Ana A5= light auto resistor
Ana A1= light auto photo resistor

//Gas Sensor -Sunny

int redled = 2;
int buzzer = 8;
int sensor = A0;
int sensorThresh = 400;

//Automatic Light-Faruk
float x,y;

//AutoCar Parking- Imran


#define green 12
#define orange 11
#define red 10
#define buzzer 13
int inches = 0;
int cm = 0;

//Auto-tap - Shoron
#define echoPin 5
#define trigPin 4
int long duration;
int distance;

//Gas Sensor -Sunny

void setup()
{
pinMode(redled, OUTPUT);
pinMode(buzzer, OUTPUT);
pinMode(sensor, INPUT);
}

//Automatic Light-Faruk

void setup()
{
pinMode(3, OUTPUT);
pinMode(9, INPUT);
pinMode(A1, INPUT);
[Link](9600);
}

//AutoCar Parking- Imran

long readUltrasonicDistance(int triggerPin, int echoPin)


{
pinMode(triggerPin, OUTPUT); // Clear the trigger
digitalWrite(triggerPin, LOW);
delayMicroseconds(2);
// Sets the trigger pin to HIGH state for 10 microseconds
digitalWrite(triggerPin, HIGH);
delayMicroseconds(10);
digitalWrite(triggerPin, LOW);
pinMode(echoPin, INPUT);
// Reads the echo pin, and returns the sound wave travel time in microseconds
return pulseIn(echoPin, HIGH);
}

void setup()
{
[Link](9600);
pinMode(green,OUTPUT);
pinMode(orange,OUTPUT);
pinMode(red,OUTPUT);
pinMode(buzzer,OUTPUT);
}

//Auto-tap - Shoron

void setup(){
pinMode(echoPin,INPUT);
pinMode(trigPin,OUTPUT);
pinMode(6,OUTPUT);
digitalWrite(6,LOW);
delay(2000);
}

//Gas Sensor -Sunny

void loop()
{
int analogValue = analogRead(sensor);
[Link](analogValue);
if(analogValue>sensorThresh)
{
digitalWrite(redled,HIGH);
tone(buzzer,1000,10000);
}
else
{
digitalWrite(redled,LOW);
noTone(buzzer);
}
}

//Automatic Light-Faruk
void loop()
{
x=digitalRead(3);
y=analogRead(A1);
[Link](x);
[Link](y);
if((x>0)&&(y<550))
{
digitalWrite(3,HIGH);
delay(5000);
}
else
{
digitalWrite(3,0);
}

//AutoCar Parking- Imran

void loop()
{
// measure the ping time in cm
cm = 0.01723 * readUltrasonicDistance(7, 7);
// convert to inches by dividing by 2.54
inches = (cm / 2.54);
[Link](inches);
[Link]("in, ");
[Link](cm);
[Link]("cm");
delay(100); // Wait for 100 millisecond(s)

if(cm>=100)
{
digitalWrite(green,HIGH);
delay(500);
digitalWrite(green,LOW);
delay(500);
}

else if(cm>=50 && cm<100)


{
digitalWrite(yellow,HIGH);
delay(500);
digitalWrite(yellow,LOW);
delay(500);
}
else if(cm>=25 && cm<50)
{
digitalWrite(red,HIGH);
delay(500);
digitalWrite(red,LOW);
delay(500);
}
else if(cm<25)
{
digitalWrite(buzzer,HIGH);
delay(500);
digitalWrite(buzzer,LOW);
delay(500);
}

}
//Auto-tap - Shoron

void loop(){
digitalWrite(trigPin,LOW);
delayMicroseconds(2);
digitalWrite(trigPin,HIGH);
delayMicroseconds(10);
digitalWrite(trigPin,LOW);
duration=pulseIn(echoPin,HIGH);
distance=(duration*0.034/2);

if(distance<=20){
digitalWrite(6,HIGH);
}
else{
digitalWrite(6,LOW);
}
}

Common questions

Powered by AI

In the gas sensor system, the buzzer sounds as an alert when the gas levels exceed a predefined threshold, indicating potential danger. In the car parking system, the buzzer activates to warn when the object distance is critically low (less than 25 cm). In both systems, the buzzer provides an audible warning, essential for immediate attention and response to critical conditions .

The combination of a digital sensor and an analog photo resistor in light automation enhances sensitivity and accuracy. The digital sensor detects movement or presence, while the analog photo resistor gauges ambient light levels, allowing the system to activate lights only when both presence is detected and ambient light is insufficient. This dual system reduces unnecessary light usage and increases energy efficiency .

The integration of colored LED indicators (green, orange, red) in the car parking system provides a clear, immediate visual representation of the car's proximity to obstacles. Green signals a safe distance, while orange and red progressively indicate closer proximity, prompting the driver to slow down or stop. This intuitive color coding enhances situational awareness, allowing the driver to react promptly and avoid collisions .

The auto light system uses a digital input from pin 3 and an analog input from a photo resistor (A1) to control lighting. If the digital input is high (light detected) and the analog input is below 550 (low resistance, indicating darkness), the light turns on. This ensures the light activates only when it is dark despite motion or presence in the area, which is detected by digital input .

When the PIR sensor in the Automatic Light System detects motion, it triggers a signal on digital pin 9. The system then evaluates the analog reading from A1. If the environment is dark (low analog reading), it activates the light via the output on digital pin 3. This sequence ensures the light is activated only in scenarios of detected motion accompanied by low ambient light .

The gas sensor system reads analog values from the gas sensor. If the analog value exceeds a predefined threshold (400), it triggers a response: the red LED lights up and a buzzer sounds. This indicates a high level of gas detection. If the value is below the threshold, the LED and buzzer are turned off .

The auto car parking system uses an ultrasonic sensor to determine the distance of an object (e.g., a car) in relation to fixed points: green LED for distances 100 cm or more, orange LED for distances between 50 and 100 cm, red LED for distances between 25 and 50 cm, and a buzzer for distances less than 25 cm. This progressive signaling helps in providing clear proximity alerts for parking guidance .

The auto tap uses an ultrasonic sensor to measure the distance to an object in front of it by sending out sound waves from a trigger pin and measuring the time they take to be reflected back to the echo pin. If the measured distance is less than or equal to 20 cm, the tap (controlled by a DC motor on pin 6) is activated (turned on), and if the distance is more than 20 cm, the tap remains off. This allows for hands-free operation of the tap .

Delays are incorporated into system loops after activating lights or buzzers to prevent constant triggering and to allow the system time to stabilize before next actions. In the car parking system, delays between LED signals prevent flickering, and in the gas or light control systems, delays avoid continuous noise or light activation, enhancing user experience and system responsiveness .

While both systems use ultrasonic sensors, the auto-tap is designed for short-range detection (around 20 cm) to trigger a water flow based on proximity, ensuring hands-free operation. Conversely, the auto-car parking system uses measurements over a range of distances (up to 100 cm or more) to guide parking precision. The auto-tap's simpler proximity trigger contrasts with the nuanced signaling in auto parking, which adjusts alerts based on varying proximity levels .

You might also like