ক্লাসের ফ্যান: CO₂ আর নড়াচড়া দিয়ে চেষ্টাClassroom CO₂ + Motion Fan Experiment
একজনের “CO₂ concentration?” idea থেকে এই পরীক্ষা। কী কাজে লাগবে: CO₂ আর নড়াচড়া একসঙ্গে দেখে fan control, reading সামান্য বদলালে বারবার on/off ঠেকানো, আর কেউ স্থির বসে থাকলে কী ভুল হতে পারে—নিজে পরীক্ষা করে শিখবে। চালিয়ে CO₂ input-এ click করে ppm বাড়াও, PIR-এ নড়াচড়া বন্ধ রাখো: fan চলবে। CO₂ 800-এর নিচে নামিয়ে নড়াচড়া বন্ধ রাখলে 10 সেকেন্ড পর fan থামবে। আবার নড়াচড়া দিলে চালু হবে। 1000/800 ppm আর 10 সেকেন্ড শুধু demo-র জন্য। CO₂ slider তুমি নিজে বদলাও; ঘরের বাতাস, শ্বাস বা CO₂ কমার হিসাব নিজে থেকে হয় না। কম CO₂-তেও কেউ চুপচাপ বসে থাকতে পারে—তাই এটা ঘর খালি নিশ্চিত করে না। সাধারণ ceiling fan শুধু বাতাস ঘোরায়, নিজে fresh air আনে না। তোমার challenge: ভুল করে fan বন্ধ হওয়া কমাতে আর কী যোগ করবে? Share → Show it দিয়ে নিজের বদলানো project-এর link নাও।
Inspired by a student suggesting CO₂ concentration. Learn to combine sensor inputs, use hysteresis to prevent repeated switching, and test the risk of turning a fan off on someone sitting still. This is a control-logic learning project, not an automatic occupancy detector. Run, select the CO₂ input and raise its ppm slider while PIR motion is off: the fan stays on. Lower CO₂ below 800 with no motion for 10 seconds to stop it; motion restarts it. The 1000/800 ppm thresholds and 10-second hold are demo choices, not standards. CO₂ is a manual simulated input, not a real sensor protocol or an MQ-135 calibration; breathing, ventilation and gas decay are not modelled. Low CO₂ and no motion cannot prove an empty room. A ceiling fan circulates air rather than supplying fresh air. What would you add to avoid switching off on a quiet student? Share → Show it creates a link to your version.
সার্কিট ডায়াগ্রাম · Circuit diagram
যা যা লাগবে · Parts you need
- 1 × Arduino Uno R3 Arduino Uno
- 1 × CO₂ input (simulation) CO₂ input (simulation)
- 1 × PIR motion sensor (HC-SR501) PIR মোশন সেন্সর (HC-SR501)
- 1 × LCD 16x2 with I2C LCD ১৬x২ (I2C)
- 1 × Relay module (5V, 1 channel) রিলে মডিউল (5V, ১ চ্যানেল)
- 1 × Cooling fan (12 V) কুলিং ফ্যান (12 V)
- 1 × DC adapter + jack (12 V) DC adapter + জ্যাক (12 V)
- 17 × Jumper wires জাম্পার তার
তার লাগানো · Wiring
| CO₂ input (simulation) VCC | → | Arduino Uno R3 5V |
| CO₂ input (simulation) GND | → | Arduino Uno R3 GND |
| CO₂ input (simulation) OUT | → | Arduino Uno R3 A0 |
| PIR motion sensor (HC-SR501) VCC | → | Arduino Uno R3 5V |
| PIR motion sensor (HC-SR501) GND | → | Arduino Uno R3 GND |
| PIR motion sensor (HC-SR501) OUT | → | Arduino Uno R3 D2 |
| LCD 16x2 with I2C VCC | → | Arduino Uno R3 5V |
| LCD 16x2 with I2C GND | → | Arduino Uno R3 GND |
| LCD 16x2 with I2C SDA | → | Arduino Uno R3 A4 |
| LCD 16x2 with I2C SCL | → | Arduino Uno R3 A5 |
| Relay module (5V, 1 channel) VCC | → | Arduino Uno R3 5V |
| Relay module (5V, 1 channel) GND | → | Arduino Uno R3 GND |
| Relay module (5V, 1 channel) IN | → | Arduino Uno R3 D7 |
| DC adapter + jack (12 V) + | → | Relay module (5V, 1 channel) COM |
| Relay module (5V, 1 channel) NO | → | Cooling fan (12 V) + |
| Cooling fan (12 V) - | → | DC adapter + jack (12 V) - |
| DC adapter + jack (12 V) - | → | Arduino Uno R3 GND.3 |
Code (Arduino C++)
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
// Inspired by a student's "CO2 concentration?" idea.
// Run, click the CO2 MODEL, and change its ppm slider.
// Click the PIR and toggle "Someone moves" independently.
// Quiet + high CO2: fan stays ON. Low CO2 + no motion: OFF after 10 s.
// Try low CO2 while an imagined student sits still: this can still miss them!
// These are DEMO thresholds/timing, NOT occupancy or ventilation standards.
// The CO2 MODEL is a manual input, not an MQ-135 or a real sensor protocol.
// Room air, breathing, ventilation and CO2 decay are NOT simulated.
// A real ceiling fan circulates air; it does not supply fresh air by itself.
// This example switches a low-voltage DC model fan, not a mains ceiling fan.
const int CO2_ON = 1000, CO2_OFF = 800;
const unsigned long HOLD_MS = 10000;
unsigned long lastMotion = 0;
bool co2Demand = false;
void setup() {
pinMode(2, INPUT);
pinMode(7, OUTPUT);
digitalWrite(7, LOW);
lcd.init(); lcd.backlight();
Serial.begin(9600);
lastMotion = millis(); // conservative startup hold
Serial.println("DEMO: CO2 + PIR cannot prove a room is empty");
}
void loop() {
int ppm = analogRead(A0) * 5000L / 1023;
bool motion = digitalRead(2) == HIGH;
if (motion) lastMotion = millis();
if (ppm >= CO2_ON) co2Demand = true;
if (ppm <= CO2_OFF) co2Demand = false;
bool recentMotion = millis() - lastMotion < HOLD_MS;
bool fanOn = co2Demand || motion || recentMotion;
digitalWrite(7, fanOn ? HIGH : LOW);
lcd.setCursor(0, 0); lcd.print("CO2 "); lcd.print(ppm); lcd.print(" ppm ");
lcd.setCursor(0, 1); lcd.print(fanOn ? "Fan ON " : "Fan OFF ");
lcd.print(co2Demand ? "CO2 " : recentMotion ? "HOLD " : " ");
Serial.print("CO2="); Serial.print(ppm);
Serial.print(motion ? " motion" : " quiet");
Serial.println(fanOn ? " FAN ON" : " FAN OFF - not proof of empty room");
delay(250);
}
আরো project · More projects
- স্মার্ট সেচ ব্যবস্থা (ক্যালিব্রেটেড, LCD সহ)Smart irrigation system (calibrated, with LCD)
- অগ্নিনির্বাপক রোবট (আগুন খুঁজে পানি ছাটে)Fire-fighting robot (finds the flame, pumps water)
- ব্লুটুথ গাড়ি (HC-05 + L298N)Bluetooth-controlled car (HC-05 + L298N)
- বৃষ্টির এলার্ম (বৃষ্টি ধরার যন্ত্র)Rain alarm (rain detector with buzzer)