Hackster is hosting Hackster Holidays, Ep. 7: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Friday!Stream Hackster Holidays, Ep. 7 on Friday!
roshan-baig
Published © GPL3+

Environment sensing station

This project displays readings from multiple sensors.

IntermediateShowcase (no instructions)1,242
Environment sensing station

Things used in this project

Hardware components

Temperature Sensor
Temperature Sensor
I used tmp36
×1
6 pin gas sensor
×1
Through Hole Resistor, 1 kohm
Through Hole Resistor, 1 kohm
×4
Arduino UNO
Arduino UNO
×1
Solderless Breadboard Full Size
Solderless Breadboard Full Size
×1
PIR Motion Sensor (generic)
PIR Motion Sensor (generic)
×1
Alphanumeric LCD, 16 x 2
Alphanumeric LCD, 16 x 2
×1
Photo resistor
Photo resistor
×1
Tilt Sensor, SPST-NC
Tilt Sensor, SPST-NC
I used SW200D
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Rotary potentiometer (generic)
Rotary potentiometer (generic)
×1

Software apps and online services

Arduino IDE
Arduino IDE
Tinkercad
Autodesk Tinkercad
here is what I always use, tinkercad

Story

Read more

Schematics

This is the circuit diagram

Just make the connections, but if your LCD is different you might need to change connections

Code

the code

C/C++
#include <LiquidCrystal.h>

LiquidCrystal lcd(13,12,11,10,9,8);

float gas = A0;
float tilt = A1;
float light = A2;
float temp = A3;
float PIR = A4;

void setup()
{
  pinMode(gas, INPUT);
  pinMode(tilt, INPUT);
  pinMode(light, INPUT);
  pinMode(temp, INPUT);
  pinMode(PIR, INPUT);
  lcd.begin(16,2);
  lcd.home();
  lcd.write("Arduino eco");
  lcd.setCursor(1,1);
  lcd.write("sensing station");
  Serial.begin(9600);
  delay(5000);
}
void loop()
{
  gas = analogRead(A0);
  tilt = analogRead(A1);
  light = analogRead(A2);
  temp = analogRead(A3);
  PIR = analogRead(A4);
  temp = (analogRead(A3)*5.0f/1024 - 0.5) / 0.01;
  lcd.clear();
  lcd.setCursor(0,0);
  lcd.print("The temp");
  lcd.setCursor(0,1);
  lcd.print(temp);
  delay(3000);
  lcd.clear();
  lcd.write("The tilt:    ");
  lcd.write(tilt);
  delay(3000);
  Serial.println(PIR);
  if(PIR > 50)
  {
    lcd.clear();
    lcd.write("Someone's nearby");
    delay(3000);
  }
  if(light < 10)
  {
    lcd.clear();
    lcd.write("It is dark");
    delay(3000);
  } else
  {
    lcd.clear();
    lcd.write("It is light");
    delay(3000);
  }
  if(gas > 100)
  {
    lcd.clear();
    lcd.write("GAS LEAK!!!");
    delay(3000);
  }
}

Credits

roshan-baig
5 projects • 7 followers

Comments