BRUH DIY Multisensor

yep have done that just waiting for it to arrive. thanks for your help !!

Just wanted to share my idea of sensor , working :slight_smile:
its being converted in a weather forecast RGB ligh
at the moment , the weather light is working on a MQTT RGB light, as same project from Ben = BRUH .

but instead of conventional cases like you guys are discussing, I was thinking in using old toys.
The toys from my kids its something that I would love to recicle, and there are even parts I’m probably use in the near future for other projects .

1 Like

What a cool idea! I hope you’ll update us.

Could someone help me adding a MQ-2 instead?

Library is here: https://github.com/labay11/MQ-2-sensor-library
But I couldn’t manage to add to Bruh code and get the reads

@Sthope give this a shot

https://raw.githubusercontent.com/firstof9/ESP-MQTT-JSON-Multisensor/MQ-2/bruh_mqtt_multisensor_github/bruh_mqtt_multisensor_github.ino

1 Like

Thank you so much for your effort! I tried the code and compiling I get this msg:

C:\air_sensor\air_sensor.ino: In function 'void loop()':

air_sensor:436: error: 'newLPG' was not declared in this scope

     newLPG = mq2.readLPG();

     ^

air_sensor:437: error: 'newCO' was not declared in this scope

     newCO = mq2.readCO();

     ^

air_sensor:438: error: 'newSmoke' was not declared in this scope

     newSmoke = mq2.readSmoke();

     ^

air_sensor:440: error: 'difflpg' was not declared in this scope

     if (checkBoundSensor(newLPG, lpg, difflpg)) {

                                       ^

air_sensor:444: error: 'CO' was not declared in this scope

     if (checkBoundSensor(newCO, CO, diffCO)) {

                                 ^

exit status 1
'newLPG' was not declared in this scope

Sorry, just uploaded a new copy, give that a shot.

1 Like

Thanks!!!
There is a typo in line 440 need to be:
if (checkBoundSensor(newLPG, lpg, diffLPG)) {

On the serial monitor I dont get any value for Smoke
{"state":"OFF","color":{"r":255,"g":255,"b":255},"brightness":255,"humidity":"0.00","motion":"motion detected","ldr":"559","temperature":"0.00","heatIndex":"nan","lpg":"41485","co":"10096088","smoke":}

Only the MQ-2 is connected at the moment.

Odd, the code conforms to the methods/examples from the library.

try placing float* values= mq2.read(true); after int newSmoke = mq2.readSmoke();
it should output all the data from the sensor to the serial monitor.

1 Like

Got it working! thank you

@Sthope Was there an error in the code or did it just take a min to update?

Odd but after switching from powering from the PC to the wall adapter worked.

Gonna let it run a few days to see how it looks.

Kinda makes sense, on your PC it’s limited to 500mA power draw on a USB 2.0 connection.

Hi, I am also trying to upload the code but getting following error:

E:\arduino\portable\sketchbook\mq2-with-bruh\mq2-with-bruh.ino: In function 'void loop()':

mq2-with-bruh:471: error: 'difflpg' was not declared in this scope

     if (checkBoundSensor(newLPG, lpg, difflpg)) {

                                       ^

exit status 1
'difflpg' was not declared in this scope

Can you please share MQ2 sketch and ha configuration?

you need to change the code line where it says:
if (checkBoundSensor(newLPG, lpg, difflpg)) {
to:
if (checkBoundSensor(newLPG, lpg, diffLPG)) {

And I have my topics:
define light_state_topic “sthope/multisensor3”
define light_set_topic “sthope/multisensor3/set”

And this is the config in HASS to show them as sensors:

sensor:
  - platform: mqtt
    state_topic: "sthope/multisensor3"
    name: "LPG"
    unit_of_measurement: "ppm"    
    value_template: '{{ value_json.lpg | round(1) }}'

  - platform: mqtt
    state_topic: "sthope/multisensor3"
    name: "CO"
    unit_of_measurement: "ppm"
    value_template: '{{ value_json.co | round(1) }}'

  - platform: mqtt
    state_topic: "sthope/multisensor3"
    name: "Smoke"
    unit_of_measurement: "ppm"
    value_template: '{{ value_json.smoke | round(1) }}'
1 Like

it’s working now, Thank you

1 Like

Hi, I am trying to upload MQ-135 sketch but getting following error message:

E:\arduino-1.8.2\portable\sketchbook\mq-135\mq-135.ino: In function 'void software_Reset()':

mq-135-with-bruh:659: error: redefinition of 'void software_Reset()'

 void software_Reset() // Restarts program from beginning but does not reset the peripherals and registers

      ^

mq-135:637: error: 'void software_Reset()' previously defined here

 void software_Reset() // Restarts program from beginning but does not reset the peripherals and registers

      ^

exit status 1
'airQuality' was not declared in this scope

Glad to hear!

I have ordered some MQ-135 yesterday to compare both.

My main goal since we are smokers and have parrots is to have turning on the fan when we smoke near the parrots and also give us a warning to open the windows if we forgot.
I pretend to change the fans and order a Xiaomi Air Purifier on the near future.

1 Like

@mudasar8k I’ve updated the sketch on github, should fix it.