Skip to content

Latest commit

 

History

52 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Occupancy and Relay System

This is a C-based embedded system utilizing two IR sensors connected to an Arduino to determine the room occupancy. The system tracks the people entering and exiting the room by maintaining a count and displaying the data on an LCD. Temperature readings are also monitored using a temperature sensor.

Hardware Requirements

  • Arduino Uno
  • Two IR sensors
  • Wires
  • Battery/Power Source
  • LCD
  • Temperature sensor

How to Set Up the System

Software Setup

  1. Clone the repository to your machine.
  2. Open the main.c file in your editor and change it to a .ino file.
  3. Open main.ino in Arduino IDE and make sure you have the LiquidCrystal_I2C library installed.
  4. To install the library:
    • Go to Sketch > Include Library > Manage Libraries.
    • Search for and install LiquidCrystal_I2C.
  5. Upload the code to your Aurdino

Hardware Setup

  • IR Sensors:
    • Sensor 1 (Entrance): Connect it to pin 9
    • Sensor 2 (Exit): Connect it to pin 8
  • LCD Display: Connect the LCD to the Arduino's I2C pins (SDA and SCL)
  • Temperature Sensor: Connect it to analog pin A0
  • Power and Ground:
    • Ensure all components are connected to ground
    • Power the Arduino and sensors

Assembly

Follow these steps to assemble the system components:

  1. IR Sensors:
    • Position the two IR sensors at the entrance of the room.
    • Senor 1 being the entrace connected to pin 9 Sensor 2 being the exit connected to pin 8
    • Ensure they are aligned correctly to detect motion effectively:
    • Secure the sensors in place so they do not move or shift during use.
  2. LCD Display:
    • Connect the LCD to the Arduino's I2C pins:
      • SDA: Connect to the Arduino's SDA pin.
      • SCL: Connect to the Arduino's SCL pin.
    • Secure the LCD where it can be easily viewed.
  3. Temperature Sensor:
    • Place the temperature sensor in the desired location to monitor room temperature.
    • Connect the signal pin of the sensor to A0 on the Arduino.
  4. Power and Ground:
    • Connect all components to a common ground pin on the Arduino.
    • Power the system using a battery or a USB connection to the Arduino.
  5. Relay:
    • If using a relay, connect it to a designated pin on the Arduino for control.
    • Connect the relay to the external device (e.g., lights or fans) as per the relay's specifications.

Once all components are connected and secured, verify the wiring to ensure everything is in the correct place before powering on the Arduino.

How It Works

  • Occupancy Tracking:
    • Sensors detect entry (pin 9) and exit (pin 8) motions.
    • A finite state machine updates the occupancy count based on the detected transitions.
  • Temperature Monitoring:
    • Reads analog input from the temperature sensor.
    • Displays temperature on the LCD.
  • LCD Display:
    • Continuously updates with the current occupancy count and temperature.

Schematics

Schematic

About

Phuc and I Proj

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages