Arduino-Based Flame Detection and Automatic Fan Control System
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
This circuit is designed to detect the presence of a flame using a KY-026 Flame Sensor and control a 220V fan through a 1-Channel Relay. The Arduino UNO microcontroller is used to process the sensor input and control the relay, which in turn controls the fan.
Component List
1-Channel Relay (5V 10A)
- Description: A relay module that allows a low voltage (5V) control signal to switch a high voltage (up to 10A) load.
- Pins: NC, signal, C, power, NO, ground
KY-026 Flame Sensor
- Description: A sensor module that detects the presence of a flame.
- Pins: A0, GND, VCC, D0
220V Fan
- Description: A fan that operates on 220V AC.
- Pins: N, L
Power 220V
- Description: A power source providing 220V AC.
- Pins: hot wire, neutral wire
Arduino UNO
- Description: A microcontroller board based on the ATmega328P.
- Pins: UNUSED, IOREF, Reset, 3.3V, 5V, GND, Vin, A0, A1, A2, A3, A4, A5, SCL, SDA, AREF, D13, D12, D11, D10, D9, D8, D7, D6, D5, D4, D3, D2, D1, D0
Wiring Details
1-Channel Relay (5V 10A)
- power connected to Arduino UNO 3.3V
- ground connected to Arduino UNO GND
- signal connected to Arduino UNO D4
- C connected to Power 220V hot wire
- NO connected to 220V Fan L
KY-026 Flame Sensor
- VCC connected to Arduino UNO 5V
- GND connected to Arduino UNO GND
- D0 connected to Arduino UNO D2
220V Fan
- L connected to 1-Channel Relay NO
- N connected to Power 220V neutral wire
Power 220V
- hot wire connected to 1-Channel Relay C
- neutral wire connected to 220V Fan N
Code Documentation
Arduino UNO Code
#define FLAME 2
#define FAN 4
void setup() {
pinMode(FLAME, INPUT);
pinMode(FAN, OUTPUT);
}
void loop() {
delay(200);
int flame = digitalRead(FLAME);
if(flame == 1) {
digitalWrite(FAN, HIGH);
} else {
digitalWrite(FAN, LOW);
}
}
Explanation:
- FLAME is defined as pin 2, which is connected to the D0 pin of the KY-026 Flame Sensor.
- FAN is defined as pin 4, which is connected to the signal pin of the 1-Channel Relay.
- In the
setup()function,pinModeis used to set FLAME as an input and FAN as an output. - In the
loop()function, the code reads the state of the flame sensor every 200 milliseconds. If a flame is detected (flame == 1), the relay is activated (digitalWrite(FAN, HIGH)), turning on the fan. If no flame is detected, the relay is deactivated (digitalWrite(FAN, LOW)), turning off the fan.