ESPHome based Smoke Alarm

Well, my first PCB’s arrived :slight_smile: (don’t be too hard, these are the first PCB’s I’ve ever designed)

I’m happy to say that the bme680 and the ADS1115 (which reads all the analog values from the MQ-7, MQ-135 and the illuminance sensor) are working. The MQ-7 and MQ-135 are not yet working due to designing this thing too late. I do need to do more testing though.

And. for some reason I don’t get my PIR sensors (AM312 PIR) working (which should be the simplest of them all :smile: ). Even if I now connect them directly to the esp_poe, nothing happens.

The idea is that the PCB will fit inside the 3D printed case. Total size is still less than 10cm on 10cm.

Has anybody an idea on how long these MQ-* sensors live? So, how long are the readings relevant?

1 Like

Which esp32 poe board did you use please?

I didnt know esp32 PoE boards were a thing. Very useful to know!

It’s the cheaper https://www.olimex.com/Products/IoT/ESP32/ESP32-POE/.

1 Like

I’ve not used a ESP32 PoE board, but if I was, I’d use the board that @nickrout suggested in another thread: wESP32

I just finished mine :nerd_face:

I used:

  • ESP8266
  • MQ-2 gas/smoke sensor
  • GY-302 illumination sensor (just for fun :wink:)

So now in HA I have:

  • binary sensor calibrated via potentiometer on MQ-2
  • sensor of gas (%) converted from voltage using adc (analog to digital)
  • Illumination sensor


Peak you see on the graph is when I blew on the sensor shortly after smoking. Binary sensor didn’t catch that as it is calibrated to turn on on higher gas percentage.

I will monitor how it behaves.

3 Likes

@MrUkleja @rdehuyss @orange-assistant

How do you calibrate your MQ 7 Sensors?

How do you know that the concentrations are in range?

I didn’t do any calibration. I am using MQ-2 sensor.
I am just monitoring how it behaves and additionally use potentiometer on sensor to set level of binary sensor.
Knowing that adc component works in 0-1V range I am converting it to percents in my sensor reading.
Will see how it goes

I need to change my setup because I suspected something is off. adc is suppose to work in 0-1V range and MQ-2 reports gas concentration in 0-5V range … So I think I will need to add resistors

@MrUkleja can you please share your template/code for calculating ppm from V

I didn’t go forward with this project so I just present the value as %:

  - platform: adc
    pin: A0
    name: "ESP-2 Gas ADC"
    update_interval: 60s
    filters:
      - multiply: 100
    unit_of_measurement: "%"
    icon: "mdi:percent"
1 Like

I have manged o get some ppm, but not sure if they are right:

filters:
     lambda: |- 
       return (x * 1024/5);
      
    unit_of_measurement: "ppm"
2 Likes

Here I changed the library MQ135 for yaml format for CO2.
Outdoor calibration is required for adequate performance.
https://github.com/AlexBelfegor/esphome-mq135

5 Likes

FYI looks like someone might be commercializing this for $20 on ebay: A+ *Plug & Play* Wi-Fi Wireless 24/7 Monitor for Smoke / LPG / CO Air Quality | eBay

2 Likes

And the problem with that is?

@nickrout don’t know what the problem is - was that sarcastic?

I took your post as criticising the commercialising.

@nickrout got it - sorry I was not - I think it’s cool and definitely ordered 1 to try out will let you know how it is. (Also this reminded me of the famous “Was that sarcasm” scene from Big Bang Theory: "Was That Sarcasm?" - Sheldon Cooper - The Big Bang Theory - YouTube)

1 Like

Sorry I didn’t get it, I am not a Sheldonista, more my son’s generation. I get the humour, just haven’t fanatically followed the show :slight_smile:

1 Like

Hello all,
I am relatively new to ESPhome and Home Assistant, so I think it is better to ask…
I noticed that the MQ-2 initial resistance change over time or at the startup. So I found this article.
https://diyprojects.io/mq2-gas-smoke-detector-arduino/#.YVzBTdpByUk
So how can I make the automatic calibration… something like…
on boot… from 2nd to 5 minute to calculate the mid-value and set that value to a global variable
(I am using NodeMCU)
(i don’t know should I calculate all the curve ppm values, coz it’s good for me to be notified if the analog value increases dramatically from the initial mid-value).

1 Like