mcp3008 to read flame sensor

Using Rpi circuit python and MCP3008 ADC to read Flame Sensor data

Ask QuestionAsked todayActive todayViewed 17 times1

I have an IR pyroelectic flame sensor which detects flames within the 8-10hz of flame flicker. I am new to the ADC world so any help is very appreciated.

Documentation: https://pyreos.com/wp-content/uploads/2020/11/Pyreos-Analog-TO-Flame-Sensor-One-Channel.pdf

I have the py0573 which has a bandpass filter for CO2 spectrum. According to the company’s algorithm recommendation, I basically need to plot/detect FFT (Fast Fourier transform) bins from the 5-15hz frequency to determine a “flame” exists on the FOV of the sensor.

In order for me to read the signal from the half-rail, I installed a MCP3008 to my RPi model 4 and set the signal to CH0 of the ADC. I also included a .1uf decoupling capacitor.

Using the below code, I am able to get some readings from the sensor, but I am unsure if this sampling rate is setup correctly or not.


  1. How do I setup the read from the ADC within the 8-10hz range?
  2. Is there a way to plot this with FFT? Do I need FFT or can I determine the total sum values from ADC to indicate a “flame”?
  3. Is the frequency setup basically the loop speed of Python or the spi.max_speed_hz option?
  4. Am I converting the raw ADC values correctly using numpy interp?
  5. If the sensor has a max 10hz frequency then I need to double that for my sample rate?
  6. Should I be using Adafruit’s adafruit-circuitpython-mcp3xxx package instead?

With the below code, I am able to see the values change when I light a flicker match but its a bit inconsistent and only changes when the flame is flickering and not when its still.

import spidev 
from numpy import interp
import time
import datetime
from datetime import timedelta

# Start SPI connection
spi = spidev.SpiDev() # Created an object

# Read MCP3008 data
def analogInput(channel, hz):
  spi.max_speed_hz = hz
  adc = spi.xfer2([1,(8+channel)<<4,0])
  data = ((adc[1]&3) << 8) + adc[2]
  return data

init_time = datetime.datetime.now()

while True:
    output1 = analogInput(0, 1000000)
    output1 = interp(output1, [0, 1023], [0, 100])
    if init_time < datetime.datetime.now() - timedelta(seconds=2):
        print("min" + str(min(data_list)))
        print("max" + str(max(data_list)))
        print("avg" + str(sum(data_list)/len(data_list)))
        init_time = datetime.datetime.now()

sensorspianalog-to-digitalmcp3008ShareEditFollowClose 1Flagedited 1 min agotlfong013,50633 gold badges77 silver badges2222 bronze badgesasked 5 hours agoGeorgetheCat1111 bronze badge

  • (1) Question “How do I setup the read from the ADC within the 8-10hz range?” – Answer, you just do conversions at a rate you want, up 200k samples per second. So eg if you want to have 10 conversions per second, you just read ADC conversion results 10 times per second, or repeat every 100mS. In other words, you just do one “single shot” conversion any time you want, within the limit of 200k conversion per second. – tlfong01 4 hours ago   
  • 1So whats is the SPI frequency setting doing exactly? Is that just the speed the RPI can read from the ADC or should I limit the frequency to 10hz for the flicker of the frame? – GeorgetheCat 4 hours ago
  • 1For FFT, I can store each conversion from the loop in a list, but how can I plot FFT per frequency range from 8-10hz? – GeorgetheCat 4 hours ago
  • 1Ok I updated the code to 100kHz and updated to sample every .001s to dump into a list. The basic statistics give print every 2 seconds, and so far the avg hovers around 50value and when i flicker a flame, the min drops to around 40 while the simultaneously the max jumps to around 60 or more. Is it odd for the sensor to drop and also increase in values at the same time? – GeorgetheCat 3 hours ago 
  • 1I am using the 3.3v not 5v. I though 5v would kill RPI using MCP3008. I do not have a scope. I do not have any other documentation other than what I shared. And company shared some FFT algorithm but its very vague. Do I need any resistor values? I also have a .1uf capacitor to decouple. Do I need an external amplifier even though it has an internal one? – GeorgetheCat 2 hours ago 

Add a comment  |  Show 9 more comments

1 Answer



How to use Rpi python MCP3008 ADC to help analyse flame flicker signals?

pyreos schematic


  1. A py0573 bandpass filter is used for CO2 spectrum
  2. To determine if a “flame” exists on the FOV of the sensor, the vendor recommends a plot/detect FFT bins from the 5-15hz frequency.

Electrical Characteristics

  1. Max. Voltage (+V) = 8.0 V
  2. Min. Voltage (+V) = 2.7 V
  3. Output voltage normalised around mid-rail
  4. Time Constant = ~12 ms
  5. Op-Amp with 10 GΩ feedback resistor


/ to continue , …


(1) Thin Film Pyroelectric Flame Sensor – PY-ITV-FLAME–TO39(2+1) R5.2 – Pyreos

(2) MCP3008 SPI 2.7V 8-Channel 10-Bit A/D Converters – MicroChip

(3) Rpi Reading MCP3008 10 bit ADC Result Problem – Rpi SE 2019may22

(4) Flame Detector – Wikipedia

(5) Tips To Select The Right Flame Detector – Edward Naranjo, Emerson Automation Solutions 2019mar06

(6) AN0125 Application Note: Sample Flame Detection Ratio Based Algorithm – Pyreos

(7) Pyreos Evaulation Kit


Appendix A – Pyroelectric Flame Sensor PY-ITV Datasheet Summary


The Pyreos thin film pyroelectric infrared flame detectors offer exceptionally high responsivity, a wide field of view of typically 100° (*subject to filter band pass specification) and class leading rapid recovery from thermal and electrical shocks (<1 second downtime). This current mode sensor has excellent signal to noise at the signature 8-10 Hz flicker range of a flame, and can provide accurate discrimination of flame sources in triple IR flame detection systems.

The sensor element is built into a low noise circuit that has an internal CMOS op amp with a 10GΩ feedback resistor outputting a voltage signal centred around half the supply rail.

Sensor Characteristics

Filter aperture = 5.2 mm x 4.2 mm

Element size = 1000 µm x 1000 µm

Package = TO39

Responsivity = 1 150,000 V/W

D* = 3.5 x 108 cm√Hz/ W

Noise = Mean 70 µV√Hz

Field of View = Typical 100°

Electrical Characteristics

Max. Voltage (+V) = 8.0 V

Min. Voltage (+V) = 2.7 V

Output voltage normalised around mid-rail

Time Constant = ~12 ms

Operating Temperature = -40 to +85 °C

Storage Temperature = -40 to +110 °C

Op-Amp with 10 GΩ feedback resistor

Filter As per Filters Available table

Appendix B – Package Info and Internal Schematic

package info and schematic

/ to continue, …

ShareEditDeleteFlagedited 5 mins agoanswered 3 hours agotlfong013,50633 gold badges77 silver badges2222 bronze badgesAdd a comment

Categories: Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.