I needed a way to keep an eye on the conditions inside a warehouse. Temperature, humidity, and air pressure all matter in a space like that, and so does the general air quality. Rather than buying a finished product, I decided to build my own monitor using a BME680 sensor from Bosch and an ESP32 board, then package the whole thing into a small electrical box so it can be mounted on location. The data gets pushed out over MQTT, which means I can send it anywhere I want, including a dashboard I can check from my phone.
Before I get into the build, I want to thank today's sponsor, PCBWay. If you are a maker working on any kind of project, they make the whole process really simple. You upload your design files, pick your specifications, and get high quality PCBs delivered to your door. They also do CNC machining, 3D printing, and full PCB assembly, so prototypes and finished products can come from the same place. Pricing is very reasonable for small runs and the turnaround is fast, which is exactly what you want when you are iterating on an idea. Check out this link with a small welcoming bonus if you want to try them out.
Why the BME680 Sensor
The BME680 is a really versatile little sensor, and that is the main reason I picked it. In a single package it measures temperature, humidity, air pressure, and volatile organic compounds in the air. That last one is worth explaining a bit. It does not tell you that there is a specific gas present at a specific concentration. What it gives you is a general reading that works as an air quality indication. For a warehouse that is exactly what I want. I am not trying to detect a particular chemical leak, I just want to know if the air in there is getting bad.
Having everything in one sensor keeps the build simple. One component, one set of wires, and four different measurements coming back.
The sensor talks over I2C, which is a communication protocol that only needs two wires. Add two more for power and you are done with the wiring. The version I have is designed to run on 3.3 V, which lines up perfectly with the ESP32 since that board runs at the same voltage.
If you look at the breakout board, there are six pins along the edge. The first two on the right side I am not using in this project. One of them is a chip select pin, which becomes useful if you have several of these sensors hanging off the same controller and need to tell them apart. I only have one sensor here, so that is not something I have to worry about.
Flashing Tasmota onto the ESP32
Instead of writing my own firmware, I am flashing the board with Tasmota. Tasmota is a ready made firmware that handles sensor reading, a web interface, and MQTT communication out of the box. It saves a huge amount of work.
The first thing to do is plug the ESP32 into the computer with a USB cable. Then head over to the Tasmota install page in your browser, because the flashing happens straight from there. No extra software to install.
On that page there are a few things to choose before you connect. The most important one is which firmware variant you want. There is a dropdown with all the different Tasmota builds, and for this project you need the Tasmota Sensors variant. That is the build that includes the I2C driver for the BME680. If you pick the standard build, the sensor simply will not be recognized. You can also pick a specific version from the Git repository if you have a reason to, but I left it on the default. Same with the flash speed, the default works fine.
Getting the Board into Bootloader Mode
Once the options are set, click connect. The browser will ask which COM port your device is on, you pick it, and after a couple of seconds the connection is established. From there you can either manage things on the device or go straight to installing. I chose to erase the device first and then install, which gives a clean starting point.
My first attempt failed. The installer came back with an error saying it could not enter bootloader mode. This is a very common thing with ESP32 boards and it is not a sign that anything is broken. Depending on the exact board you have, the USB chip cannot always put the chip into flashing mode on its own.
The fix is simple. I disconnected the port, then held down the boot button on the board while reconnecting. That forces the chip into bootloader mode manually. I selected the port again, chose erase and install one more time, and this time it went straight into erasing. From there the firmware installation started on its own. It takes a few minutes to finish, so this is a good moment to walk away and grab a coffee.
Connecting to Wi-Fi
When the install finished, the installer offered a few options. Since the board had never been configured, it had no Wi-Fi credentials, so the first job was to give it some. I did this directly from the install page. I picked my network from the list, typed in my password, and hit connect. After a short wait the device was on the network.
At that point there is a "visit device" button that takes you straight to the Tasmota web interface running on the board itself. That interface is where all the remaining configuration happens.
Wiring the Sensor to the Board
With the firmware sorted, it was time to physically connect the sensor. Both the sensor breakout and the ESP32 board have male pins on them, so I used Dupont cables that are female on both ends. I will have links to everything I used in the video description if you want to build the same thing.
I like to keep wire colours consistent so I can trace things later. Brown goes to ground and red goes to 3.3 V. So the VCC pin on the sensor connects to the 3.3 V pin on the ESP32, and the ground pin on the sensor connects to a ground pin on the board.
For the two communication wires I used yellow and orange. Yellow is SCL, which is the clock line, and orange is SDA, which is the data line. On the ESP32 these need to go to specific pins. The yellow SCL wire goes to D22 and the orange SDA wire goes to D21. Those are the pins I have used for I2C in past projects and they work reliably.
Four wires total and the hardware side is done. What is left is telling the firmware what is connected where.
Configuring the Pins in Tasmota
Tasmota does not automatically know that you have an I2C sensor hanging off two particular pins. You have to tell it. In the web interface, go to Configuration and then Configure Module. That screen lists all the usable pins on the board with a dropdown next to each one.
The D21 and D22 labels on the board correspond to GPIO 21 and GPIO 22 in the firmware, so those are the two entries to change. On GPIO 21, I selected I2C SDA from the dropdown. On GPIO 22, I selected I2C SCL. Then save.
Saving triggers a restart of the device. Once it comes back up, the sensor readings should show on the main page of the web interface.
Getting the First Readings
My first restart did not show the sensor. This threw me for a second, but the reason is straightforward. I had connected the sensor wires while the board was already powered up, and the I2C scan that Tasmota runs happens at boot. Since the sensor was not there yet at the moment of that scan, it never got detected.
The fix was to unplug the USB cable and plug it back in for a proper power cycle. After that, all the values appeared on the main page. At that moment I was reading 29.8 degrees, 37.7 percent humidity, a dew point of 13.7 degrees, and air pressure at 942 hPa. The dew point is calculated from the temperature and humidity, so you get it for free. For my use case, temperature, humidity, and pressure are the three I care about most.
Seeing the numbers on the device page is nice, but it only helps if you are sitting on the same network with a browser open. To make this actually useful I need the data going somewhere I can look at it any time.
Sending the Data Over MQTT
This is where MQTT comes in. MQTT is a lightweight messaging protocol that lets a small device publish its readings to a server, and then anything else can subscribe to those readings. It is the standard way of doing this kind of thing in home and industrial automation.
You can point this at Home Assistant if that is what you run. I am sending mine to thing.mk, which is the platform I use, and it also works over MQTT. I made a separate video covering that platform, and there is a link in the description if you want to see how it is set up.
The configuration lives under Configuration and then Configure MQTT in the Tasmota interface. You fill in the host, port, credentials, and topic details that your MQTT provider gives you. The exact values will be different depending on which server you use, so grab them from your provider.
Once that was saved, the data started flowing. I can see the readings in the mobile app, in the device console, and on the platform's web interface. One thing to be aware of is that Tasmota publishes on a timer, and by default that is once every ten seconds. So there is a small delay between the sensor reading something and it appearing on your dashboard. You can set up rules on the device to push an update the moment a value changes, but for what I need, a ten second resolution is more than enough.
Putting It All in the Enclosure
The last job was packaging. I used a small electrical box, smaller than the ones I usually reach for. I found it in a local store and it turns out to be a great size for devices like this. I had already drilled a couple of holes in it, so I disconnected the USB cable and threaded it through before plugging it back into the board.
The hole is just barely wide enough for the USB cable to pass through, which is fine. Tight is better than loose here.
My original plan was to put the board and the sensor inside the box and let airflow through the holes give the sensor something to measure. Once I had it assembled I changed my mind. The ESP32 puts out a bit of heat, and inside a sealed plastic box that heat has nowhere to go. The sensor would end up reading the temperature of the box instead of the temperature of the room.
So I repositioned things so the tip of the sensor pokes out through the side of the box. That way it is measuring the actual air outside the enclosure and any heat build up inside does not affect the reading. Small change, big difference in how accurate the data is.
With everything closed up, I checked the interface one more time. Readings were still coming through and updating as expected, so the unit is ready to be installed on site.
Conclusion
This is one of those projects where the parts count is tiny but the result is genuinely useful. One sensor, one ESP32, four wires, and a firmware you do not have to write. The BME680 covers temperature, humidity, pressure, and air quality all at once, and Tasmota handles the web interface and MQTT so you can send the data wherever you like.
The two things that tripped me up are worth remembering if you build one yourself. Hold the boot button if flashing fails, and power cycle the board after you wire up an I2C sensor so the firmware actually finds it. Beyond that it is a very quick build. If you want to take it further, you could add device rules for instant updates on change, or run several of these around a building using the chip select pin to keep them apart.
If this was useful and you want to see more builds like it, subscribe to my YouTube channel so you catch the next project when it goes up.
Tools And Materials
- BME680 Sensor: https://s.click.aliexpress.com/e/_c3iIDMmL
- ESP32 Development Board: https://s.click.aliexpress.com/e/_c3PfpZXZ
- Tasmota Firmware Web Installer: https://tasmota.github.io/install/
- Dupont Jumper Cables (Female to Female): https://s.click.aliexpress.com/e/_c3fr8y5p
- Electrical Enclosure Box: https://s.click.aliexpress.com/e/_c3XEbZl5
- ding.mk Platform: https://ding.mk/en
- ding.mk Video: https://youtu.be/9simFNsFohA
- Bench Power Supply: https://s.click.aliexpress.com/e/_c3OoaCuB
- Soldering Station: https://s.click.aliexpress.com/e/_c3fAwU4n
- Multimeter: https://s.click.aliexpress.com/e/_c3PfXcr9
- Microscope: https://s.click.aliexpress.com/e/_c4su1Ycr