Server Room Monitoring with IoT

Using an ESP8266 as a sensor node for environmental monitoring

Shane Hull
Beyond the Helpdesk
5 min readJun 28, 2019

--

We spent months searching for a simple solution to monitor our server room temperatures, only to be quoted thousands of dollars for rack mountable monstrosities that don’t offer much more than what a cheap ADC sensor and a WiFi enabled Espruino board would.

In this guide I’ll explain how we set up a simple temperature/humidity sensor monitor using an ESP8266 board, a DHT11 sensor and Home Assistant (using the HassIO virtual appliance).

I won’t focus so much on Home Assistant or HassIO, as they already have documentation for everything you could ever think of here.

The only additional thing you will require aside from a default install of Home Assistant is the ESPhome plugin, which is a one click install if you’re using one of the HassIO options.

Parts List

  • NodeMCU ESP8266 v3 (Lolin) — available here
  • DHT11/DHT22 sensor, preferably with the integrated pull up resistor — available here
  • 28 AWG jumper wires — available here
  • 3D printer (optional)

Putting it together

There are different pinouts depending on the circuit layout of the DHT you have, so make sure you look up the wiring diagram before trying to hook it up, or it may end up melting!

The ones I linked above look like this:

We want to attach the signal cable to any of the pins beginning with a “D”, the Ground to any pin labelled “G” and the Vcc (+) pin to the pin labelled “VU” (or “VV” on the board I received), which stands for VUSB. The VV/VU pin outputs 5v direct from USB.

I chose to 3D print a case for mine, which I remixed from one posted by another user to make it rack mountable.

The design is available for download here.

Compiling and Uploading the Firmware

Let’s install ESPhome’s CLI tools so we can compile and flash the board with the ESPhome firmware.

Firstly, make sure you have Python 2.7 (🤔) installed and run:

Use ESPhome’s built in wizard to set the values of your configuration file.

It will ask you for some basic configuration values such as a name the platform type etc. You will want to enter something along the lines of:

This will create a basic yaml file, which assists ESPhome in compiling the firmware for your ESP board.

Now, to upload and run the firmware make sure your ESP8266 board is plugged in to your computer via microUSB and run the following:

You should be asked what port you wish to use to upload the firmware; USB2.0-Serial or OTA. Select the number corresponding to USB2.0-Serial and hit enter.

If there are no errors, the output from ESPhome should display its current signal strength, a valid IP and other network information like so:

Once you’ve confirmed that the node connects to the WiFi and obtains an IP, you’ll want to add some more info to your config file and upload your changes.

Open the yaml file in any text editor you’re comfortable with and update any config, which I’ll explain below:

My configuration looks similar to this:

As I had issues with resolving the nodes IP via mDNS, I set the IP to static, reserving it in DHCP. And as I had issues with 2.4Ghz signal when using previous ESP8266 boards, I like to monitor the current RSSI.

You may wish to go with the bare minimum, eg:

When you’re happy with the config, upload and run it again, or if you just want to upload it, try:

The node is ready to deploy!

Once it’s all plugged in and has been running for a few minutes, your HassIO install should automatically detect the device and notify you, asking you to add it as a new entity.

If it doesn’t, no stress — just head over to Configuration > Integrations and hit the plus button in the bottom right of the screen.
Select ESPhome > and enter the hostname of the node, eg: “server_room.yaml”, or the static IP set in your config.

If successful, it will now appear as an entity and you’ll be able to create dashboards with it.

You can even create an automation to notify Slack when the sensor reaches a certain temperature!

We now have full visibility on how well our air conditioners are performing.

Our next project will be leak detection using a soil moisture sensor.

--

--