BRUH DIY Multisensor

They are working fine, they respond instantly if I introduce an outside force like placing it in front of a heater or blowing on them. This sensor is in my basement which is very stable temp / humidity wise. I’ll test it out further by putting it outside and track it.

I have no clue why it reports zero on a server restart, I’d assume it’s because HASS isn’t up to receive the updates.

Here’s the results from letting the sensor run outside.
Took it outside at 1:00 pm and brought it back in the house at 11:00pm and left the sensor on the main floor where levels tend to wander a bit more. The dips in the charts are when the sensor was unplugged and moved.


2 Likes

A lot of potential with this sensor. Just curious, have you looked into Grafana or InfluxDB at all for more advanced data logging? Its possiblly overkill for your usecase, but I am curious, has anyone worked with rate of change of sensor values over time in addition to just raw numbers? It occurs to me that if the curve of the graphs you posted could be smoothed a bit and the slope or rate of change over time could be used as an automation trigger, it could could expand possible uses.

My main use-case was to tinker and learn something new. My secondary goal was using the temp component to control the stand-up fans in my kids rooms. Turn them off at 10:00pm unless the temp is above X, type of thing or urn the living room AC on if the temp is above X between certain hours etc. Long term I would like to swap from stand up fans to ceiling fans. To that point I was thinking of trying to implement an IR solution into the sensor to control an IR ceiling fan. The PIR sensor is cool but not needed at this point, my twins are 6 years old, I most certainly know when they are in their rooms and moving around. :wink:

Indoors, in the kids rooms I believe the existing graph curves will probably suffice but I’ll have to wait until I get it up and running to be sure.

quick question- where did you locate the Portable directory in OS X? something like:
/Applications/Arduino.app/Contents/Java/portable ? Also, I am curious which driver(s) you used. Right now I have these 2:

I made a homemade ‘ecobee’-like “follow me mode” (motion-sensor-focus) thermostat program via a cluster of automations, scripts, input sliders, and sensors. It works great; I’ve been really happy with how it keeps my bedroom cool at night while the wall AC unit is in the livingroom. It’s currently only made for my IR-controlled AC in-wall cooler and two BRUH multisensor nodes, but I’ll update it (maybe python it?) when I get an IR space heater and more nodes.

I wrote it based on code from a few other people’s thread topics. I didn’t know python scripts would be implemented into HASS at the time or I’d have done it that way to make it easier to implement into other people’s configs.

6 Likes

I’m not using a portable setup. I downloaded Arduino.app (1.8.2), and Iput it in ~/Applications, but I moved it (simple cut & paste) to a secondary hard drive in a self named Downloads folder. If you want, I can privately message you the log of the contents of Arduino.app.

Driver

Running: please ioreg -p IOUSB
Results: +-o USB2.0-Serial@fd124000 <class AppleUSBDevice, id 0x1000011a5, registered, matched, active, busy 0 (793 ms), retain 18>
Note: Confirmed this by unplugging \ plugging in etc.

Running: please system_profiler SPUSBDataType
Results:

USB2.0-Serial:

Product ID: 0x7523
Vendor ID: 0x1a86
Version: 2.54
Speed: Up to 12 Mb/sec
Location ID: 0xfd124000 / 6
Current Available (mA): 500
Current Required (mA): 96
Extra Operating Current (mA): 0

Running: please ls /dev/tty.*
Results: /dev/tty.wchusbserialfd1240
Note: This is on a NodeMCU that mentions on the silkscreen to use a CH340 driver.

Here’s the resources I looked over:

  1. Good solid writeup, but not quite what was needed. Older info, but does have some interesting stuff about being wary of tty’s with spaces in them. Pretty sure I didn’t do this, since I can’t find a symlink, I could also be missing it due to my inexperience in *nix systems. (oxcf.com)

  2. Pretty sure I didn’t use anything from this one, but it led me forward to Sengotta.net)

  3. Getting closer, this is linked in the beginning of the link above. (blog.sengotta.net)

  4. This is important to do (allow signed installs) and links to the same driver on sengotta.net above (mblock.cc)

But the official (I think) GitHub, points you to this site here with a signed driver, which I think is the same as the one linked by mblock.cc and sengotta.net: (http://www.wch.cn/download/CH341SER_MAC_ZIP.html)

Maybe try removing the kext, rebooting, installing again, and rebooting?

1 Like

I have observed so far that when I an enclosure, the DHT gives more abrupt changes in temp/humidity (from the influence of the ESP ?). It might be the same for the LDR.

What values do you get if you just all the stuff laying on a table without an enclosure ?

Also for your Light sensor, did you do anything in the ESP code (to change values to actual LUX for instance instead of resistance, which is what the sensor returns). If that is, it might be your conversion equation that leads to strange behavior (ie. too large importance of second/third/… order terms)

Thank you! That is very thorough and extremely helpful. Ok, so, I successfully flashed the firmware- and I do not know why it worked this time. Some background: The first and last time I (successfully) flashed the NodeMCU, I was at one location with its own router and IP. For a few weeks in between, I was at a different location with its own respective IP etc. Nothing worked, and I replaced everything involved, incl the chip, the cable, the driver, the IDE, and the computer. I can’t imagine how the IP or physical location would affect the flashing of the NodeMCU, but that is the only variable that has changed.

Since I already have a few NodeMCU’s laying around and wanted to have a temperature sensor on most divisions I have ordered a couple of each sensor along with this cheap case https://nl.aliexpress.com/item/1Pcs-100X60X25MM-DIY-Enclosure-Instrument-Case-Electrical-Supplies-Good-Quality-Black-Plastic-Electronic-Project-Box/32816575628.html?spm=2114.010208.3.2.YoRxca&ws_ab_test=searchweb0_0,searchweb201602_1_10152_10208_10065_10151_10068_5330014_10304_10301_10136_10137_10060_10155_10062_437_10154_10056_10055_10054_5340018_10059_303_100031_10099_10103_10102_10096_10052_5350018_10053_5320017_10142_10107_10050_10051_10084_10083_10080_10082_10081_10177_10110_519_10111_10112_10113_10114_10182_10078_10079_10073_5260017_10123_10189_142,searchweb201603_9,ppcSwitch_4&btsid=739c170c-6f2f-4c20-9748-3eb96aa8ee63&algo_expid=0bb10b8d-47ce-4940-9ec0-017c67feab9e-0&algo_pvid=0bb10b8d-47ce-4940-9ec0-017c67feab9e

If its reliable enough on the temperature it is the perfect solution for me as I can gear up the all house with those sensor’s for the price of a single sensor from any brand.

Also I think the PIR and the LUX even if they are not 100% reliable they can work help with bluetooth detection and presence detection being more accurate.

how you made the holes?

Is the PIR not reliable?

Haven’t received the modules yet nor the case so I haven’t bother yet thinking how I’m gonna make the holes also I’m not sure if it will all fit inside.
I’ll post back when everything arrives and I get my hands to work.

Waiting also for the components to make a RFLink Gateway and only the 2.4ghz radio module left to come which is the one I most need for my milights.

Isn’t that insanely frustrating? Gotta love hidden variables. Here’s my preferences and such in case it helps.

1 Like

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.

5 Likes

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…

5 Likes

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 :slight_smile:

1 Like

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

3 Likes

Excellent, thanks for sharing. I will for sure try this out! Thanks again :slight_smile: