Thanks for sharing the reed switch addition, I’ve just received a couple of the ones you linked to.
How did you power the reed from the ESP board?
Thanks
Thanks for sharing the reed switch addition, I’ve just received a couple of the ones you linked to.
How did you power the reed from the ESP board?
Thanks
I’m waiting on my components to arrive from China but I printed the sensor box on a Form 1. The LED fits perfect into the designated interior hole and has a nice glow through the box. I’ll post some photos when it’s wired and working.
I bought a very simple box from aliexpress (approx 100 x 60 x 40 mm, 1.5€). I cut the holes using drill bits normally for wood and jigsaw for the rectangle box. Then trim the cuts using an exacto knife. (I still have to drill some small holes on the side as my DHT sensor is reporting 3° too much (coming from the nodeMCU itself I believe).
The sensor is basically the same than bruh’s one, except that I replaced the PIR with an ultrasonic distance sensor. The Sensor Node is attached above my garage door and tells me if the door is open/closed and if it’s closed, it tells me if my car is in the garage.
I am planning on proceeding likewise for the other nodes, except that I will use some vinyl sticker that looks either like wood or like carbon fiber to make it more classy and blend in its surroundings.
@Sthope, it is basically the same box as yours exept that mine is a bit taller (and you will see that it’s already complicated to make all wires fit in such a tiny space).
I am currently building a second one (basically bruh’s sensor with all the stuff and also an IR led receiver and two IR led emitter). I will definetly post the outcome with the stickers and everything…
I feared already that it would be too small, for if thats the case I happy have them hanging out until I figure it out another solution, I love the picture above with the lego house!
hopefully parts should start arriving this week
Interesting, great idea with the distance sensors. I’m in the process of automating my garage and might give this a go. Could you share the code you used for the distance in Arduino and Yaml.
I have 10 PIR bruh nodes around the house.
Thanks for sharing
Basically, I proceeded like with the PIR sensor. Define Trigger and Echo Pin, initialize them , add a line to the sendstate() function to send distance measurement also, then in the loop simply do the following (I can’t remember where I got this code, but it’s the very basic way to do ultrasonic sensing).
// ULTRASONIC CODE
// send the pulse
digitalWrite(ULTRATRIGPIN, LOW);
delayMicroseconds(2); // low for 2 microseconds
digitalWrite(ULTRATRIGPIN, HIGH);
delayMicroseconds(10); // high for 10 microseconds
digitalWrite(ULTRATRIGPIN, LOW);
duration = pulseIn(ULTRAECHOPIN, HIGH); // measure the time to the echo
distance = (duration/2)/29.1; // calculate the distance in cm
//Noise control: if deviation of last 3 readings not consistent (e.g. movement), ignore
if (abs(distance - last_reading) > 1 || abs(last_reading - second_last_reading) > 1) {
second_last_reading = last_reading;
last_reading = distance;
distance = last_distance;
}
else {
second_last_reading = last_reading;
last_reading = distance;
}
//Only do something if measured distance has changed by >= 2cm since last time
if (abs(distance - last_distance) >= 1) {
last_distance = distance;
sendState();
}
else {
distance = last_distance;
}
For the YAML, I get the distance in cm from MQTT topic, then I use a template sensor to determine the 3 cases: (Open/car unknon, Close/car out, Close/Car in).
- platform: mqtt
state_topic: "lambtho/SN_Garage"
name: "SN_Garage Distance"
unit_of_measurement: "cm"
value_template: '{{ value_json.distance }}'
- platform: template
sensors:
garagedoor:
friendly_name: 'Garage Door'
icon_template: >-
{%- if states('sensor.SN_Garage_Distance') | float <= 35 %}
mdi:garage-open
{% else %}
mdi:garage
{%- endif %}
value_template: >-
{%- if states('sensor.SN_Garage_Distance') | float <= 35 %}
Open
{% else %}
Closed
{%- endif %}
carpresence:
friendly_name: 'Car presence'
icon_template: >-
{%- if states('sensor.SN_Garage_Distance') | float <= 35 %}
mdi:help
{% else %}
mdi:car
{%- endif %}
value_template: >-
{%- if states('sensor.SN_Garage_Distance') | float <= 35 %}
Unknown
{% elif states('sensor.SN_Garage_Distance') | float >= 190 %}
Outside
{% else %}
In Garage
{%- endif %}
The ideal solution would be to use a 433MHz (RF) door sensor to dectect door opening, get RF signal using RF receiver with nodeMCU and place your ultrasonic sensor in an other location to measure only the car presence. That way you could also have the case door open/car in garage
Excellent, thanks for sharing. I will for sure try this out! Thanks again
Hi All,
I’m trying to incorporate a push button into my Bruh Sensor.
I have a button near my front door at the moment using a Wemos D1 and a Wemos Button Shield to trigger and “all-off” script. It works very well but I’d love to incorporate into my Bruh Node.
Here’s the code I’m using on the Wemos Button Today which works very well:
https://pastebin.com/HkigqM4y
On the Wemos Board I have only PIN D3 and GND connected connected to the button.
When the button is pressed, the MQTT message is changed to “on” when it’s pressed again it changes back to “off” and so on…
On my NodeMCU ESP, I’m trying to use D6 instead of D3… Only D6 and GND connected to the button.
I’ve tried to incorporate my Wemos code into the Bruh, it’s sort of working but I can only get the MQTT state to change from “on” to “off” when connecting 3v or GND to D6… on the Wemos board, I do not need to connect 3v for state to change…
Here’s my bodged code:
https://pastebin.com/S7Ypda2J
Can anyone help me make this work?
Regards
If the pin is just connected to ground via the switch, that’s your issue. You’re checking to see if the pin goes HIGH (+3.3V) You need to use a pulldown resistor to ground on the microcontroller side of the switch/button and connect the other leg to 3.3V. As you’ve got it right now your input is “floating” which leads to inconsistent behavior. The pulldown will make the microcontroller think the pin is grounded until you press the button supplying 3.3V to the pin.
Thanks. That’s what I thought was needed but what I don’t understand is why this works so perfectly on my Wemos Board which is only connected like this:
No pulldown and No 3.3v
I’d be willing to be it’s probably defined as INPUT_PULLUP and it’s looking for LOW when the button is pressed.
Wouldn’t it have to be defined in the code as the pin mode INPUT_PULLUP instead of INPUT?
Yay! Welcome to the club!
PIR sensor and the LED’s arrived so I started uploading the sketch to the nodemcu and gave it a swirl
I must said I am already amazed with the PIR, with automation to turn on with motion and off with no motion responds much MUCH MUCH faster then my Xiaomi Human Sensor
I only put it inside this cat treats box to attract the females attention
fantastic enclosure
I’m working on a Wmos D1 mini version of this sensor minus the LED. Here’s what I’ve come up with so far
I also submitted a PR to the codebase for the BRUH sensor that will display Heat Index or “Real Feel” temp from the data gathered by the DHT22
where did you get that case from? It looks very nice and compact!
I have ordered yesterday a rain sensor from aliexpress hopefully I can integrate it with the multisensor.
Maybe we could try to “enlarge” this project documenting how to add new sensors making it the ultimate “DIY Multisensor” so it could really fit everyone needs(?)
I printed it
And it’s great because if it fails, you’ll have 8 more lives.
Ooooohhhh! Nice redesign of the enclosure! Any chance of the STL files making it to Thingiverse?
Have anyone tried building a mysensors battery powered version?