Arduino UNO 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 reads the flame sensor's output and activates the relay to turn on the fan if a flame is detected.
Component List
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
1-Channel Relay (5V 10A)
- Description: A relay module that allows a microcontroller to control high voltage devices.
- 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 220V AC power source.
- Pins: hot wire, neutral wire
Wiring Details
Arduino UNO
- 3.3V connected to 1-Channel Relay (5V 10A) power
- 5V connected to KY-026 Flame Sensor VCC
- GND connected to KY-026 Flame Sensor GND
- GND connected to 1-Channel Relay (5V 10A) ground
- D4 connected to 1-Channel Relay (5V 10A) signal
- D2 connected to KY-026 Flame Sensor D0
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 (5V 10A) NO
- N connected to Power 220V neutral wire
Power 220V
- hot wire connected to 1-Channel Relay (5V 10A) 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);
}
}
- FLAME is defined as pin 2, which is connected to the KY-026 Flame Sensor's digital output (D0).
- FAN is defined as pin 4, which is connected to the 1-Channel Relay's signal pin.
- In the
setup()function,FLAMEis set as an input andFANis set 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 to turn on the fan. If no flame is detected, the relay is deactivated, turning off the fan.