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.
- Arduino Uno
- Two IR sensors
- Wires
- Battery/Power Source
- LCD
- Temperature sensor
- Clone the repository to your machine.
- Open the
main.cfile in your editor and change it to a .ino file. - Open
main.inoin Arduino IDE and make sure you have theLiquidCrystal_I2Clibrary installed. - To install the library:
- Go to Sketch > Include Library > Manage Libraries.
- Search for and install
LiquidCrystal_I2C.
- Upload the code to your Aurdino
- 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
Follow these steps to assemble the system components:
- IR Sensors:
- Position the two IR sensors at the entrance of the room.
- Senor 1 being the entrace connected to
pin 9Sensor 2 being the exit connected topin 8 - Ensure they are aligned correctly to detect motion effectively:
- Secure the sensors in place so they do not move or shift during use.
- 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.
- Connect the LCD to the Arduino's I2C pins:
- Temperature Sensor:
- Place the temperature sensor in the desired location to monitor room temperature.
- Connect the signal pin of the sensor to
A0on the Arduino.
- 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.
- 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.
- 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.
- Sensors detect entry (
- 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.
