In this article, we are going to learn how to use a Flame Sensor With Raspberry Pi Pico to detect whether there is a fire. We will go through the circuit diagram, the code, and how to put it all together. In this reader, we will discuss how to use the Raspberry Pi Pico board and the flame sensor to create a simple fire detection system.
- Raspberry Pi Pico
- USB cable
- Flame sensor module
- jumper wires
What is Flame Sensor?
A flame sensor is a device that detects the presence of a flame. The most common type of flame sensor is an infrared sensor, which detects the infrared radiation emitted by a flame. There are also flame sensors that detect the ultraviolet radiation emitted by a flame. Flame sensors are used in a variety of applications, including fire alarm systems, furnaces, and engines. In a fire alarm system.
Raspberry Pi Pico
The Raspberry Pi Pico is a powerful little board that opens up a world of possibilities for makers and hobbyists. It is a great platform for learning about electronics and programming. The Pico board is also well suited for IoT applications. The GPIO pinout makes it easy to interface with a wide variety of sensors and actuators. The Pico is a great choice for makers and hobbyists who want to explore the flame sensor on a raspberry pi that is used to detect and measure the intensity of a flame.
The schematic diagram for a flame sensor with raspberry pi pico
And here we have the breadboard schematic diagram:
Raspberry Pi Pico Flame Sensor
- GPIO0 ————————– DO
- 3.3V ———————–—— +
- GND ———————-—— G
Programming for Flame Sensor With Raspberry Pi Pico
from machine import Pin, PWM import utime flame_sensor = Pin(16, Pin.IN) buzzer = Pin(17, Pin.OUT) utime.sleep(0.5) buzzer.high() #OUT1 and OUT2 In1=Pin(1,Pin.OUT) #IN1` In2=Pin(0,Pin.OUT) #IN2 EN_A=PWM(Pin(2)) # Defining frequency for enable pins EN_A.freq(1500) duty_cycle = 65535 while True: while flame_sensor.value() == 1: print("Flame Detected") buzzer.low() In1.low() In2.high() EN_A.duty_u16(int(duty_cycle/2)) if flame_sensor.value() == 0: buzzer.high() In1.low() In2.low() print("No Flame") utime.sleep(0.2)
I defined the buzzer as the output and the flame Sensor as the Input. The buzzer is connected to GP17 and Flame Sensor is connected to GP16.
if the sensor has detected any fire and then accordingly turn ON and turn OFF the buzzer. So, that’s all about the code.
Read Similar Articles:
- Getting Started Raspberry Pi Pico – Pinout, Specs – Beginner Guide
- Interfacing PIR Motion Sensor with Raspberry Pi Pico
- Raspberry Pi Pico Home Automation System
- Interface Servo Motor With Raspberry Pi Pico
- Interface 0.96″ OLED Display with Raspberry Pi Pico
- Raspberry Pi Pico Weather Station Using Dht11 Sensor
- Interface 16*2 LCD Display With Raspberry Pi Pico