Flame sensors are essential components in fire detection systems, making them useful for various DIY projects and safety applications. In this guide, we’ll show you how to test a 4-pin flame sensor module using an Arduino Uno with a simple code to monitor its output in the Serial Monitor.
![]() |
Flame sensor with Arduino UNO |
Understanding the 4-Pin Flame Sensor
Step-by-Step Instructions
Step 1: Components Required
To follow along with the tutorial, you'll need:
![]() |
Components required for this tutorial |
✅ Arduino UNO board
✅ 4-Pin Flame Sensor Module
✅ Jumper Wires
✅ USB cable for Arduino
Step 2: Setting Up the Circuit
Proper wiring is crucial for accurate readings. Follow these connections:
![]() |
Connection flame sensor |
![]() |
Wiring diagram |
✅VCC → 5V (Arduino)
✅GND → GND (Arduino)
✅A0 → A0 (Arduino) (for analog readings)
✅D0 → D2 (Arduino) (for digital output)
Once connected, plug in the USB cable to the Arduino. The PWR LED on the Arduino and flame sensor should light up, indicating power.
Step 3: Programming the Arduino
Using the Arduino IDE, you can write a simple program to control the servo motor or you can download the code HERE.
int flameAnalog = A0; int flameDigital = 2; void setup() { Serial.begin(9600); pinMode(flameDigital, INPUT); } void loop() { int analogValue = analogRead(flameAnalog); int digitalValue = digitalRead(flameDigital); Serial.print("Analog Value: "); Serial.print(analogValue); Serial.print(" | Digital Value: "); Serial.println(digitalValue); delay(500); }
![]() |
Open Arduino IDE and copy-paste the code |
Step 4: Expected Output
After uploading the code to your Arduino, open the Serial Monitor in the Arduino IDE. Bring a flame source, such as a lighter or matchstick, near the sensor.
![]() |
When no flame is detected, the sensor will produce high analog values and a digital output of 1. |
![]() |
When a flame is near, the analog value decreases, and the digital output changes to 0. |
Troubleshooting Tips
- If the sensor doesn’t detect flames, adjust the potentiometer to fine-tune sensitivity.
- Ensure correct wiring and that the module is powered.
- Try using different flame sources like a candle or matchstick.
Conclusion
Testing a 4-pin flame sensor with Arduino is simple and useful for fire detection projects. By following this guide, you can integrate the sensor into alarms, security systems, or automated responses. Try it out and let us know your results! 🔥🚀
Tools and components
Shopee:
Lazada:
Aliexpress:
Video
🔔 If you found this guide helpful, share it with fellow makers! For more tutorials, subscribe to our YouTube channel and follow us on social media. 🚀
#Arduino #FlameSensor #FireDetection #DIYTech #EmbeddedSystems
No comments:
Post a Comment