ESP32 SensorNode, 4-in-1 Wi-Fi multisensor board

Tags: #<Tag:0x00007f7399072c40> #<Tag:0x00007f73990728f8>

After a long period of development, troubleshooting and testing, I finally got what I consider a satisfactory version of a custom board based on the ESP32 microcontroller, able to measure some environmental parameters such as brightness, temperature, humidity and motion.

The board can be programmed over USB and it’s compatible with both ESPHome (read here some limitations of current ESPHome implementation) and typical Arduino/ESP-IDF code with MQTT messages, so that could be easily integrated into Home Assistant and a lot of others home automation systems.

The board dimensions are 5.08 x 4.57 cm (2 x 1.8 inches)

The sensors installed on the board are the following:

  • Temperature / Humidity: SI7021
    ± 0.4 °C (max), –10 to 85 °C
    ± 3% RH (max), 0 – 80% RH
  • Ambient Light: BH1750
    1 - 65535 lx
  • Motion sensor: AS312

This board takes its inspiration from the well-known BRUH’s ESP-MQTT-JSON-Multisensor and it offers some improvements such as a more compact footprint and the use of an ESP32 microcontroller capable of interfacing with external Bluetooth sensors.

The files for the production (schematics, BOM and Gerber files) are present on the GitHub repository of the project for the realization of the multisensor.

Since the production of this board requires relatively advanced soldering techniques and tools, upon request of some interested people, I opened a shop on Tindie where I sell already assembled boards.
Purchase an ESP32 SensorNode on Tindie.

Original thread

11 Likes

Awesome project, waiting for tindi store!
I’m aware the board is in production phase already, but I think a LiPo circuit would be handy, Dover can scatter some around the house.
Do you have a mailing list set up (or is that too difficult these days with GDPR?)?

Well done!

Initially I had thought to make these boards battery powered but unfortunately if you want to use ESPHome the battery would run out immediately because of the constant connection to the Wi-Fi and the high consumption of the microcontroller. I’m experimenting with a software that can stay in deep sleep most of the time and turn on the Wi-Fi only when necessary, if I get good results I could think about developing a second battery powered revision.

For updates I think it’s better to follow this thread, I’ll post all the updates here.

1 Like

In my use case I could do without the PIR, mostly interested in temperature/humidity and light sensors. In that case wouldn’t it be possible to use Deep Sleep to reduce the temperature (and increase accuracy of the temperature sensor)?

I assume the reason you’re not using Deep Sleep to cool down and reduce power consumption is for the PIR to be quick and responsive, right?

Actually the PIR doesn’t cause problems because it’s connected to a pin able to wake up the microcontroller from deep sleep. In the current version of the software, a configurable periodic wakeup is performed for the measurement and possible sending of the values, and the PIR creates an instant wakeup in order to have a short response time.
The board consumes less than 1 mA in deep sleep so there are no thermal problems in this case.

Impressive project. I’ll watch for your Tindie store.

Are there any free GPIOs that would enable connection of additional sensors?

ESPhome also supports Deep Sleep though, so why the need for special software? I assumed the PIR was why, but sounds like that’s not an issue.

@ronschaeffer My idea was to put this board in a 3d printed box, so I didn’t think of additional GPIOs, I could try to add a couple if I find space on the board. There are already pads (power supply and SCK/SDA) that allow you to add I2C sensors if you want to.

@Tim1 I know ESPHome supports deep sleep but I decided to create a specific software so that I have full control of the timing and hardware in view of a possible battery-powered revision. You are still free to use the software you prefer or even write your own.

1 Like

great project, i followed it from the other thread, i know you decided to get rid of the ir sensors as well as others. do you still have the esphome config for the original set up including the ir diodes? i wanted to try some ir diodes i had to see if it could work as a multisensor as well as a make shift harmony hub

Unfortunately it’s been a while since I used the IR diodes in ESPHome but if I remember correctly I simply used the example sketch found here and I added the codes of my TV brand.

Since the production of this board requires relatively advanced soldering techniques and tools, upon request of some interested people, I opened a shop in Tindie where I sell already assembled boards.

Purchase an ESP32 SensorNode on Tindie.

If the shop no longer has stock, register in the queue and I will replenish the stock as soon as possible.

Great work! I know I brought this up once before but I just wanted to clarify before I buy a couple of these:

Using ESPhome with Deep Sleep enabled I should be able to get accurate temperatures (no thermal issues) at the expense of slower sensor updates? The PIR can wake from Deep Sleep since it’s a ESP32 and attached to one of the appropriate pins.

If I’m correct then the only benefit to not using Deep Sleep (and dealing with +1C°) is to get instant sensor updates for temp/humidity and lux? With Deep Sleep I could have it wake every 2 minutes or something and get reasonable updates while keeping the temperature accurate?

Exactly, with deep sleep you would have no temperature problems as long as you use long enough intervals sleeping between measurements, 2 minutes should be more than sufficient.

The timing problem I mentioned in the past is related to leaving enough time for ESPHome to turn on, connect, take and send all measurements. I noticed while testing this possibility a few months ago that it was necessary to leave the device on for 10-30 seconds, depending also on the Wi-Fi signal and the time needed for the connection, before receiving all the values correctly. You can certainly increase the run time to be sure it works but then you should leave the board off for a few minutes, but my idea was to have a much more responsive system.

This is the reason why I’m making specific software. It is going to check every 5 or so seconds the values of the sensors and only if necessary connect to the Wi-Fi and send the values. This way it is possible to obtain very high reactivity and at the same time minimum consumption and heat.

I’m testing right now ESPHome with a 20-second runtime with a two-minute sleep and it seems to be fine. The PIR can be used as well even when sleeping if you set up the GPIO wakeup. Until I finish the software, this might be an way to get precise temperature values.

Sounds perfect to me. I went ahead and ordered a couple!

1 Like

Has there been done any work on a 3D printable case?

I started working on a 3d printable case with a friend of mine a few days ago. As soon as I have a final design I will upload it to Thingiverse.

Awesome work! Thank you :clap:

1 Like

Got mine today! Looks great. Thanks! Build quality is excellent, seems accurate to me with what little testing I could do tonight. I’m using 30s on 3min deep sleep for now. I also disabled the Status LED, as it was blinking green whenever it woke up or detected motion.

Now to figure out why even though it shows F in the States screen, when put in Lovelace it shows C (with the F values though…)


sensor4

Looks like it may be this issue… so maybe it will fix itself overnight: https://github.com/home-assistant/core/issues/24814

EDIT: Removed some original issues that worked themselves out.

1 Like

I’m glad you’re happy with it! Let me know if you find better configurations and I’ll update the guide for everyone.
As far as the C/F problem is concerned, you can try the custom esp-idf MQTT software but I also assume it’s a bug in Home Assistant as you indicated, it never happened to me personally.

Okay so the strange C/F Lovelace behavior seems to have worked itself out after a day or so, and everything seems normal now.

New issue: I have 2 of the SensorNodes, I setup both with nearly identical configurations except for the Deep Sleep settings. One with 40s/3min and one with 30s/2min to see how the temperature measurements would differ (trying to find the sweet spot between responsiveness and accuracy/heat). Overnight I found that one sensor (40s/3min) stopped responding completely very soon after it came online (did not reply to pings all night either). When I checked on it this morning the ESP32 was warm to the touch (the other SensorNode was not). Going to try a different USB cable and power supply to see if that helps.

The other sensor (30s/2min) seems to have been responding all night, but I notice that in the logs that several times (at least 8 times) during the night the SensorNode seems like it may be rebooting? The log entries start with a [C] and colored pink/purple. Not sure if that’s normal behavior, or if the SensorNode is actually restarting. The time between these [C] log entry blocks is not evenly separated in the log (so it doesn’t look like it is happening exactly once every 60 seconds or something.) That said, this is the log from the web interface, so maybe these [C] entries actually occur on every wakeup from Deep Sleep and it just doesn’t always report into the web interface yet. Anyway, here is a screenshot (so that the colors are retained) of one of the events that occurred in the middle of the night.

(You can right-click on the image and choose ‘Open image in new tab’ to view it full size, since it looks like the forum shrinks it down)

EDIT: Added some additional detail.