Further Extension of the Project to fulfill the Clints demand and
justify the project requirements
JUSTIFICATION:
To address the problem of maintaining a constant temperature in the materials testing room and
providing a system to monitor the door's status, you can develop a prototype using a humidity and
temperature sensor, an Arduino Uno R3, and other components. The system will monitor the room's
temperature and provide visual and audible indicators if the door is left open for too long, potentially
affecting the test results.
Components Needed:
Arduino Uno R3
DHT22 or DHT11 Sensor (Humidity and Temperature Sensor)
Door Sensor (Reed switch or magnetic switch)
Buzzer
LEDs (preferably in different colors, e.g., green, yellow, red)
LCD Display (optional, to show real-time temperature readings)
Resistors
Breadboard and Jumper Wires
Power Supply
Step-by-Step Implementation:
1. Setup the Humidity and Temperature Sensor:
Connect the DHT22/DHT11 sensor to the Arduino.
The sensor typically has three pins: VCC, GND, and Data.
Connect VCC to 5V, GND to ground, and Data to a digital pin (e.g., pin 2) on the Arduino.
Use the appropriate library (e.g., DHT library in Arduino) to read temperature and humidity.
2. Install the Door Sensor:
Connect a door sensor (reed switch or magnetic switch) to the Arduino.
One side of the switch connects to a digital input pin (e.g., pin 3), and the other side to the
ground.
When the door is closed, the circuit is complete, and the pin reads LOW. When the door is
open, the circuit breaks, and the pin reads HIGH.
3. Indicator System:
LEDs: Use three LEDs to indicate the status of the door.
o Green LED: Lights up when the door is closed.
o Yellow LED: Lights up when the door is open for a short period (e.g., < 10 seconds).
o Red LED: Lights up when the door is open for too long (e.g., > 30 seconds).
Buzzer: The buzzer can be used as an audible alert that becomes more persistent as the door
stays open longer. You can program it to beep intermittently if the door is open for a short
time and continuously if it's open for too long.
4. Monitoring and Display System:
LCD Display (optional): Display the real-time temperature and humidity readings, along
with the status of the door (e.g., "Door Closed" or "Door Open").
Serial Monitor: You can also use the Arduino IDE's Serial Monitor to print the door status,
temperature, and humidity readings for debugging.
5. Programming Logic:
Initialize the sensors and indicators: In the setup function, configure the input/output pins
and initialize the DHT sensor and any libraries.
Check the door status: In the loop function, continuously read the door sensor's status.
Temperature and Humidity Monitoring: Use the DHT sensor to read temperature and
humidity, checking for any significant changes that might indicate a problem if the door is left
open.
Indicator Activation:
o If the door is closed, ensure the green LED is lit, and the buzzer is off.
o If the door is open, start a timer. Light up the yellow LED if the door is open for less
than 10 seconds.
o If the door remains open for longer than 30 seconds, turn on the red LED and activate
the buzzer with increasing intensity.
o If the door is closed before the maximum time threshold, reset the timer and return to
the initial state.
Unexpected Events Handling: Program the system to handle any unexpected situations, like
a power outage. Consider using an uninterruptible power supply (UPS) or battery backup to
ensure the system continues to function.
6. Code Example:
Here's a basic example of how you might code this in Arduino:
#include <DHT.h>
#define DHTPIN 2 // Pin connected to the DHT sensor
#define DHTTYPE DHT11 // DHT 11
DHT dht(DHTPIN, DHTTYPE);
#define DOOR_PIN 3 // Pin connected to the door sensor
#define GREEN_LED 4 // Green LED
#define YELLOW_LED 5 // Yellow LED
#define RED_LED 6 // Red LED
#define BUZZER 7 // Buzzer
unsigned long doorOpenTime = 0;
const unsigned long shortOpenThreshold = 10000; // 10 seconds
const unsigned long longOpenThreshold = 30000; // 30 seconds
void setup() {
Serial.begin(9600);
dht.begin();
pinMode(DOOR_PIN, INPUT);
pinMode(GREEN_LED, OUTPUT);
pinMode(YELLOW_LED, OUTPUT);
pinMode(RED_LED, OUTPUT);
pinMode(BUZZER, OUTPUT);
}
void loop() {
// Read door status
int doorState = digitalRead(DOOR_PIN);
// Read temperature and humidity
float temperature = dht.readTemperature();
float humidity = dht.readHumidity();
// If the door is closed
if (doorState == LOW) {
doorOpenTime = 0;
digitalWrite(GREEN_LED, HIGH);
digitalWrite(YELLOW_LED, LOW);
digitalWrite(RED_LED, LOW);
noTone(BUZZER);
}
// If the door is open
else {
if (doorOpenTime == 0) {
doorOpenTime = millis();
}
unsigned long doorOpenDuration = millis() - doorOpenTime;
// Yellow LED for short duration
if (doorOpenDuration < shortOpenThreshold) {
digitalWrite(GREEN_LED, LOW);
digitalWrite(YELLOW_LED, HIGH);
digitalWrite(RED_LED, LOW);
noTone(BUZZER);
}
// Red LED and buzzer for long duration
else if (doorOpenDuration < longOpenThreshold) {
digitalWrite(GREEN_LED, LOW);
digitalWrite(YELLOW_LED, LOW);
digitalWrite(RED_LED, HIGH);
tone(BUZZER, 1000, 500);
}
// Continuous buzzer if door open too long
else {
digitalWrite(GREEN_LED, LOW);
digitalWrite(YELLOW_LED, LOW);
digitalWrite(RED_LED, HIGH);
tone(BUZZER, 1000); // Continuous sound
}
}
// Print temperature and humidity to Serial Monitor
Serial.print("Temp: ");
Serial.print(temperature);
Serial.print(" °C, Humidity: ");
Serial.print(humidity);
Serial.println(" %");
delay(1000); // Update every second
}
7. Testing and Enhancement:
Testing: Run tests with different scenarios to ensure the system responds as expected when
the door is opened and closed. Check the timing of the indicators and the buzzer to ensure
they align with the requirements.
Enhancement: For a more advanced system, consider adding wireless notifications (e.g.,
using a Wi-Fi module) to alert personnel if the door is left open for too long. You could also
add a data logging feature to track temperature changes over time.
Enhanced User Experience:
User-Friendly Interface: Ensure that the indicators are easily visible, possibly with larger
LEDs or a more prominent display.
Sound Control: Allow users to adjust the buzzer's volume or provide a mute option in case of
extended door usage during deliveries.
Notifications: Integrate the system with an alert system (email/SMS) to notify the relevant
personnel if the door is left open for an extended period, potentially affecting testing accuracy.