Bruh Multisensor not sending any readings

I’m having endless trouble getting the Bruh Multinsensor to work.
Code loads up fine and connects to internet and mqtt but the sensors aren’t being picked up by HASS, below is what’s coming up on my IDE serial monitor. Looks like the sensors aren’t working? I’ve swapped NodeMCU boards but no difference. I’m not sure what else to look for?

Arduino serial monitor:

calibrating sensor Starting Node named MultiSense Livingroom

Connecting to WiFi
.
WiFi connected
IP address:
192.168.1.109
Ready
Setting LEDs:
r: 0, g: 0, b: 0
Attempting MQTT connection…connected
Setting LEDs:
r: 0, g: 0, b: 0

I would check that you have the sensors on the correct GPIO port. If you do not get any readings on the serial monitor then there will be no readings into Hass.

What sensor and which port are you connected to on the code and physically on the board ?

NodeMCU Pinout Diagram

I’ve double and triple checked the pins

Have you checked the wires? Occasionally I have come across bad wires. You might want to check the resistance on your wires to make sure there are no problems there.

OK What sensors are you using and where have you connected them ? eg D1, D2, D3, GND, 3.3V etc

gumbo:
wires seem good, I’ve been using these for all sorts of diy projects. I have hundreds of them and never found an issue with any of them. I can check them individually to see if they light up an led or check with a multimeter but that’s tricky because they’re female on both ends so tricky to get my chunky multimeter fingers in there! :grinning:

BertrumUK:
I’ve connected as per the diagram, but I’m using slightly different sensors as I’ve blown the AM312 by connecting it incorrectly so using one I had lying around, HC-SR501 to be specific.
and the light sensor is also one I had in my spares box not sure of the name or code. The DHT22 however is one I’ve used before so know it works but I’m not getting any readings for temp/hum… It’s very unlikely that all the sensors I’m using are faulty surely?
Also the led doesn’t respond?
I’ve tested the “set state” in the Dev tools to the Bruh examples of:

{"entity_id":"light.sn1_led",
"brightness":150,
"color_name":"blue",
"transition":"5"
}

and although the state declared on the Dev tools changes to what I’ve put in, the LED doesn’t ever come on or flash or change colour.

PIN connections are:
LED: Red - D1, Green - D2, Blue - D3 and GND
PIR: Positive - 3v3, Negative - GND. Out - D7
Light sensor: VCC - 3v3, GND - GND, AO - A0
PIR: VCC - Vin, GND - GND, OUT - D5

I’ve even un-installed Arduino and all my libraries and started with a fresh install followed his video step for step… This is very frustrating. I’ve spent so much time on this stupid thing I should really now how to code myself by now!

It appears you have eliminated the following as potential problems:

  • wires and connectors
  • connecting said wires to the proper pins
  • compiling the sketch

The sensors as long as they are compatible with the libraries should not be a problem either. I have used a similar PIR as you. I have also used a different photo sensors. Each without a hitch.

You could always try powering up the board with only one sensor attached. You might have to try each sensor one by one to see if you get data. Try the DHT22 first since you know that is working okay.

After that, what’s left?

Do you have a spare nodemcu to try. It will not hurt anything to try a different one.

If you eliminate the nodemcu, that leaves the sketch.

I believe they were a few folks with different versions of the sketch who posted in that huge Bruh multisensor thread. i tried the one @digiblur made available. Worked great.

Hopefully it is just something simple. Sometimes the simplest things cause the most trouble.

2 Likes

Ok lets try something else, your serial connection in entry 1 is missing a lot of data - mine has a much longer json string so it could be that your sketch is simply not configured to send all the values. Looking at the code all values are sent during this part of the sketch

/********************************** START SEND STATE*****************************************/
void sendState() {
StaticJsonBuffer<BUFFER_SIZE> jsonBuffer;

JsonObject& root = jsonBuffer.createObject();

root[“state”] = (stateOn) ? on_cmd : off_cmd;
JsonObject& color = root.createNestedObject(“color”);
color[“r”] = red;
color[“g”] = green;
color[“b”] = blue;

root[“brightness”] = brightness;
root[“humidity”] = (String)humValue;
root[“motion”] = (String)motionStatus;
root[“ldr”] = (String)LDR;
root[“temperature”] = (String)tempValue;
root[“heatIndex”] = (String)calculateHeatIndex(humValue, tempValue);

char buffer[root.measureLength() + 1];
root.printTo(buffer, sizeof(buffer));

Serial.println(buffer);
client.publish(light_state_topic, buffer, true);
}

I’ve already swapped the NodeMCU. I suspect it’s the code but I copied it directly from the BRUH github so not sure how that can be but all the hardware has been tried and replaced, pins checked, cables changed etc… I’ve downloaded the digiblur github for his revised code but getting an error so need to tincker a bit to try figure out what’s wrong

‘def_hostname’ was not declared in this scope

error coming up at the moment and I’m not really sure how to go further on this, the “def_hostname” is one of the configurations that need defining in the config file, which I’ve done.

The code from digiblur works!

I just had to “backdate” the esp board manager to version 2.3 and voila.
Thank you so much for pointing out the revised code of digiblur’s. As always the good folk on the forum save the day. Thanks guys! :grinning:

2 Likes