BRUH DIY Multisensor

No, it flashes, but then it stays on for 5-6 seconds

I changed like this and now is ok, It flashes only.

I notices that it takes 5-6 seconds to go from MOTION to back to STANDBY … anyway to change this and make it shorter, like 1 second?

#
  - alias: "Motion Office SN3- ON motion light"
    initial_state: 'on'
    trigger:
      - platform: state
        entity_id: sensor.sn3_pir
        from: 'standby'
        to: 'motion detected'
    action:
      - service: light.turn_on
        entity_id: light.sn3_led
        data_template:
          brightness: 255
          rgb_color: ['{{ (range(0, 255)|random) }}','{{ (range(0, 255)|random) }}','{{ (range(0, 255)|random) }}']
          flash: 'short'
      - service: light.turn_off
        entity_id: light.sn3_led
      - service: mqtt.publish
        data:
          topic: sensor/livingSN3
          payload: "on"
          retain: "true"
#
# Automation off
  - alias: "Motion Office SN3- OFF motion light"
    initial_state: 'on'
    trigger:
      - platform: state
        entity_id: sensor.sn3_pir
        state: 'standby'
        for: '00:00:01'
    action:
#      - service: light.turn_off
#        entity_id: light.sn3_led
      - service: mqtt.publish
        data:
          topic: sensor/livingSN3
          payload: "off"
          retain: "true"
1 Like

probably needed to change the arduino code? But how?

It is possible to run two PIR’s off one NodeMCU with one one VIN? Could I run an additional PIR from a 3.3v pin?

I was planning on ditching one of the other sensors, temp, LED or LUX sensor.

Many thanks

you can without any problem I guess, all these sensors do not use much current. However, you have to check the datasheet of the sensor to make sure it will work with 3.3V. If not, you must wire it to VIN also, using a breadboard or solder to wire the two to the same pin.
Also, if you have only BRUH’s sensors, there is still GPIO pin lefts on the nodemcu, so you can add the extra PIR without removing the other stuff.
You will also need to adapt the arduino code to take into account the new PIR

Excellent, thank you. I already have a number of BRUH nodes. Two of them have reed switches for doors and also a push button to trigger an automation using the spare GPIO pins.

I’ll have a go tonight! thanks!

I use these mini breadboard with my multisensor as I added a lot of other sensors to them. You just need to have female to male wires along with them and everything works like a charm.

https://fr.aliexpress.com/item/Free-shipping-Mini-25-Tie-point-Breadboard-Solderless-Prototype-Test-Board/32562517170.html?spm=2114.13010608.0.0.RYSNQx

They’re nice, might have to get some.

I’ve just been soldering the wires, reeds, switches and resistors to the wires and putting them in project boxes, these might be easier as it’s a bit of a faff soldering and using heat shrink.

Plus if a sensor ever failed this would make it much easier to replace!

Cheers!

Hi, I just copy and past Bruh code in Arduino and change wifi and mqtt info and when I verify the code getting following error:

E:\MultiSensor\BrushMultiSensor\BrushMultiSensor.ino:32:17: fatal error: DHT.h: No such file or directory

#include <DHT.h>

             ^

compilation terminated.

exit status 1
Error compiling for board Generic ESP8266 Module.

download DHT library

after downloading the DHT library getting following error:

Arduino: 1.8.2 (Windows 10), Board: “Generic ESP8266 Module, 80 MHz, 40MHz, DIO, 115200, 1M (64K SPIFFS), ck, Disabled, None”

Build options changed, rebuilding all
BrushMultiSensor:68: error: ‘D1’ was not declared in this scope

const int redPin = D1;

                ^

BrushMultiSensor:69: error: ‘D2’ was not declared in this scope

const int greenPin = D2;

                  ^

BrushMultiSensor:70: error: ‘D3’ was not declared in this scope

const int bluePin = D3;

                 ^

BrushMultiSensor:72: error: ‘D7’ was not declared in this scope

#define DHTPIN D7

               ^

E:\Amazon Alexa\Sonoff\Arduino\Bruh MultiSensor\BrushMultiSensor\BrushMultiSensor.ino:136:9: note: in expansion of macro ‘DHTPIN’

DHT dht(DHTPIN, DHTTYPE);

     ^

E:\Amazon Alexa\Sonoff\Arduino\Bruh MultiSensor\BrushMultiSensor\BrushMultiSensor.ino: In function ‘void setup()’:

BrushMultiSensor:71: error: ‘D5’ was not declared in this scope

#define PIRPIN D5

               ^

E:\Amazon Alexa\Sonoff\Arduino\Bruh MultiSensor\BrushMultiSensor\BrushMultiSensor.ino:145:11: note: in expansion of macro ‘PIRPIN’

pinMode(PIRPIN, INPUT);

       ^

BrushMultiSensor:72: error: ‘D7’ was not declared in this scope

#define DHTPIN D7

               ^

E:\Amazon Alexa\Sonoff\Arduino\Bruh MultiSensor\BrushMultiSensor\BrushMultiSensor.ino:146:11: note: in expansion of macro ‘DHTPIN’

pinMode(DHTPIN, INPUT);

       ^

E:\Amazon Alexa\Sonoff\Arduino\Bruh MultiSensor\BrushMultiSensor\BrushMultiSensor.ino: In function ‘void loop()’:

BrushMultiSensor:71: error: ‘D5’ was not declared in this scope

#define PIRPIN D5

               ^

E:\Amazon Alexa\Sonoff\Arduino\Bruh MultiSensor\BrushMultiSensor\BrushMultiSensor.ino:427:28: note: in expansion of macro ‘PIRPIN’

 pirValue = digitalRead(PIRPIN); //read state of the

                        ^

exit status 1
‘D1’ was not declared in this scope

This report would have more information with
“Show verbose output during compilation”
option enabled in File -> Preferences.

Did you follow the instructions: download the zip version, install it and make a portable folder?

Yes, already installed and make portable folder for Sonoff, additionally install
- DHT sensor library
- Adafruit unified sensor

The not declared part issue could be due to the board you have selected (esp8266 generic or wemos d1 etc. etc.), if you select the wemos d1 board you’ll see that those specific error messages will dissapear (did for me) however, selecting the esp8266 generic board/nodemcu board you’ll have to translate those d1, d2 etc. to actual gpio ‘numbers’, like:

const int greenPin = D2; should be const int greenPin = 4; etc. etc.

This is what fixed it for me back when I got those specific errors, hopefully might do it for you too.
Here is one of the pinout images for nodemcu boards:

1 Like

after install new board manager etc and now getting this error message:

In file included from E:\Amazon Alexa\Sonoff\Arduino\Bruh Sensor Node updated\arduino-1.8.3\portable\packages\esp8266\hardware\esp8266\2.3.0\libraries\ESP8266WiFi\src/ESP8266WiFiGeneric.h:27:0,

             from E:\Amazon Alexa\Sonoff\Arduino\Bruh Sensor Node updated\arduino-1.8.3\portable\packages\esp8266\hardware\esp8266\2.3.0\libraries\ESP8266WiFi\src/ESP8266WiFiSTA.h:28,

             from E:\Amazon Alexa\Sonoff\Arduino\Bruh Sensor Node updated\arduino-1.8.3\portable\packages\esp8266\hardware\esp8266\2.3.0\libraries\ESP8266WiFi\src/ESP8266WiFi.h:34,

             from E:\Amazon Alexa\Sonoff\Arduino\Bruh Sensor Node updated\arduino-1.8.3\portable\sketchbook\sensorNodeUpdated\sensorNodeUpdated.ino:4:

e:\amazon alexa\sonoff\arduino\bruh sensor node updated\arduino-1.8.3\portable\packages\esp8266\tools\xtensa-lx106-elf-gcc\1.20.0-26-gb404fb9-2\xtensa-lx106-elf\include\c++\4.8.2\functional:48:28: fatal error: bits/c++config.h: No such file or directory

#include <bits/c++config.h>

                        ^

compilation terminated.

exit status 1
Error compiling for board NodeMCU 1.0 (ESP-12E Module).

Thinking of ordering a couple of MQ-135 Sensors for air quality levels, will it work? :thinking:

normally yes, but it uses 5V I belive, so you either have to get rid of the PIR sensor of the original BRUH’s configuration or solder the two together to the VIN pin.
The code for interfacing it with the nodemcu should be a bit more complex though. Check mysensors.org to see how they do it

wouldnt a breadboard do the job instead of soldering the two together?

Already checked MySensors, it is where I actually got the idea from :stuck_out_tongue:

I selected NODEMCU 1.0

1 Like

@anon35356645 thanks its working now, just put the bits/c++config.h outside of c++ folder and its working.

really appreciate your help and suggestions

yes obviously a breadboard or mini breadboard would fit as well. I already suggested it to someone just a few replies before

1 Like