개발자/라즈베리파이4

라즈베리파이4 화염 불꽃 감지 센서 모듈 Flame Sensor

지구빵집 2022. 5. 27. 08:16
반응형

 

 

불꽃 감지 센서(Flame Sensor)란 적외선 LED를 통해 화재 시 연소반응에 의해 불꽃에서 파생되는 열 복사인 적외선 파장 (760nm ~ 110nm) 을 감지하여 아날로그 혹은 디지털 신호를 수신하는 센서입니다. 불꽃 감지 센서는 말 그대로 스파크성 불꽃, 근접 거리에서의 발화체 감시 및 점화 확인 등 불꽃 감지가 가능한 센서입니다.

 

화염 불꽃 감지 센서 모듈 Flame Sensor

 

근접한 거리의 불꽃만 감지되며, 최대 감지 거리는 약 17cm ~ 18cm 정도 입니다.

 

실생활에서는 문화재 시설이나 중요 공공 시설에서 화재 감지용으로 사용되거나, 산업용이나 민간용 제품의 고전압 릴레이 및 브러쉬, 접전 스위치에서 발생하는 스파크성 불꽃 및 근접거리에서 발화체를 감시, 점화장치의 점화 확인 등 불꽃 감지가 가능한 센서입니다.

 

센서 파트 넘버: 아두이노 5파이 화염 불꽃 감지 센서 / Flame Sensor

 

중요한 점은 실내에서는 라이터의 불꽃, 스파크 등을 잘 인식하지만 야외에서는 사용할 수가 없다. 야외에서 화재나 불꽃의 인식은 특별한 방식으로 센싱하는데 자세한 설명은 생략한다.

 

참고자료

 

출처: 에듀이노 참고자료

 

불꽃 센서 설명 자료

 

불꽃 센서 설명 자료

 

 

- 파일 이름: flamedetect.c

- 소스코드: 할당된 gpio 번호는 예고없이 변경할 수 있습니다.

 

불꽃 센서 데이터를 폴링 방식으로 받는 코드

 

#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <stdlib.h>
#include <wiringPi.h>


// Use GPIO Pin 7, which is Pin 11 for wiringPi library

#define FLAME_IN 5  //gpio7


// the event counter 
volatile int eventCounter = 0; 

// -------------------------------------------------------------------------
// myInterrupt:  called every time an event occurs
void myInterrupt(void) {
   eventCounter++;

}


// main
int main(void) 
{
	// sets up the wiringPi library
	if (wiringPiSetup () < 0) 
	{
		fprintf (stderr, "Unable to setup wiringPi: %s\n", strerror (errno));
		return 1;
	}
	
	pinMode(FLAME_IN, INPUT);

	// set Pin 17/0 generate an interrupt on high-to-low transitions
	// and attach myInterrupt() to the interrupt
	/*if ( wiringPiISR (LIGHTSEN_OUT, INT_EDGE_RISING, &myInterrupt) < 0 ) 
	{
		fprintf (stderr, "Unable to setup ISR: %s\n", strerror (errno));
		return 1;
	}*/

	// display counter value every second.
	while ( 1 ) 
	{
		//printf( "%d\n", eventCounter );
		//eventCounter = 0;
		
		if(digitalRead(FLAME_IN) == 0)
			printf("Fire !!!!!!!!!!!\n");
		if(digitalRead(FLAME_IN) == 1)
			printf("No Fire \n");		
	
		delay( 100 ); // wait 1 second
	}

	return 0;
}

 

불꽃 센서 출력 데이터를 인터럽트 방식으로 데이터를 받는 코드

 

#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <stdlib.h>
#include <wiringPi.h>


// Use GPIO Pin 7, which is Pin 11 for wiringPi library

#define FLAME_IN 5  //gpio7


// the event counter 
volatile int eventCounter = 0; 

// -------------------------------------------------------------------------
// myInterrupt:  called every time an event occurs
void myInterrupt(void) {
   eventCounter++;

}


// -------------------------------------------------------------------------
// main
int main(void) {
  // sets up the wiringPi library
  if (wiringPiSetup () < 0) {
      fprintf (stderr, "Unable to setup wiringPi: %s\n", strerror (errno));
      return 1;
  }

  // set Pin 17/0 generate an interrupt on high-to-low transitions
  // and attach myInterrupt() to the interrupt
  if ( wiringPiISR (FLAME_IN, INT_EDGE_FALLING, &myInterrupt) < 0 ) {
      fprintf (stderr, "Unable to setup ISR: %s\n", strerror (errno));
      return 1;
  }

  // display counter value every second.
  while ( 1 ) {
    printf( "%d\n", eventCounter );
    //eventCounter = 0;
    delay( 1000 ); // wait 1 second
  }

  return 0;
}

 

 

 

 

반응형