Jatin Bhati
Published © GPL3+

Smart Sensors

Set an alarm when it's too hot, or detects motion, or detects an obstacle.

IntermediateShowcase (no instructions)1 hour1,506
Smart Sensors

Things used in this project

Hardware components

PIR Motion Sensor (generic)
PIR Motion Sensor (generic)
×1
Arduino UNO
Arduino UNO
×1
Temperature Sensor
Temperature Sensor
×1
LED (generic)
LED (generic)
×2
Ultrasonic Sensor - HC-SR04 (Generic)
Ultrasonic Sensor - HC-SR04 (Generic)
×1
Buzzer
Buzzer
×1

Software apps and online services

Arduino IDE
Arduino IDE

Code

Smart_Car.ino

Arduino
float temp;
int tempPin=0;
int sensor=7;
int Motion_Sensor_value;
int echoPin=9;
int trigPin=13;
int redLEDpin=10;
int greenLEDpin=11;
int buzzer=4;
void setup() {
  // put your setup code here, to run once:
pinMode(sensor,INPUT);//configuring pin 7 as Input
Serial.begin(9600);//To show output value of sensor in serial monitor
pinMode(redLEDpin,OUTPUT);
pinMode(greenLEDpin,OUTPUT);
pinMode(echoPin,INPUT);
pinMode(trigPin,OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
temp=analogRead(tempPin);
temp=temp*0.48828125+32;
Serial.print("Welcome to the demo car");
Serial.print("Current Engine Temperature:");
Serial.print(temp);
Serial.print("*F");
Serial.println();
delay(3000);
if(temp<132)
{
  Motion_Sensor_value=digitalRead(sensor);// reading sensor value from pin 7
int duration=pulseIn(echoPin,HIGH);
int dist=duration*0.34/2;
if(Motion_Sensor_value==1 || dist<100)
{digitalWrite(greenLEDpin,HIGH);//turn on the LED/Buzzer when motion is detected by writing 1 to the pin 10 
 digitalWrite(redLEDpin,LOW);
 digitalWrite(echoPin,HIGH);
  digitalWrite(trigPin,LOW);
  delayMicroseconds(1);
    digitalWrite(trigPin,HIGH);
  delayMicroseconds(10);
  tone(buzzer,1000,5000);
  Serial.println("Stop!");
  Serial.println("Motion detected!");//printing output to serial monitor
  Serial.print("Distance:");
  Serial.println(dist);
  delay(5000);
  }else{
    digitalWrite(redLEDpin,HIGH);
    digitalWrite(greenLEDpin,LOW);
 digitalWrite(12,HIGH);
Serial.println("Carry on no obstacle there!");//printing output to serial monitor
    }
}
else{
  Serial.print("Car Overheated!!");
  tone(buzzer,20000,2000);
  delay(2000);
   tone(buzzer,10000,2000);
  delay(2000);
   tone(buzzer,20000,2000);
  delay(2000);
  }
}

Credits

Jatin Bhati
3 projects • 3 followers
Contact

Comments

Please log in or sign up to comment.