===== How to Build a Comfort Monitoring Sensor Station =====
[[https://www.instructables.com/id/How-to-Build-an-Indoor-Comfort-Monitoring-Sensor-S/|Originalartikel]]
[[https://www.qgelm.de/wb2html/wb516.html|Backup]]
Thermal and visual comfort have become more and more important topics, especially in office and workplace environments, but also in the residential sector. The main challenge in this field is that the thermal perception of individuals often varies in a wide range. One person might feel hot in a certain thermal condition while another person feels cold in the same. That’s because the individual thermal perception is influenced by many factors, including the physical factors of air temperature, relative humidity, air velocity, and radiant temperature of surrounding surfaces. But also, clothing, metabolic activity, and an individual aspect of age, sex, body mass, and more, influence the thermal perception. While the individual factors remain an uncertainty in terms of heating and cooling controls, the physical factors can be determined precisely by sensor devices. Air temperature, relative humidity, air velocity, and globe temperature can be measured and used as a direct input to building controls. Further, in a more detailed approach, they can be used as input to calculate the so called PMV-index, where PMV stands for Predicted Mean Vote. It describes how people in average would be likely to rate their thermal sensation under given ambient room conditions. PMV can take on values from -3 (cold) to +3 (hot), with 0 being a neutral state. Why do we mention that PMV-thing here? Well, because in the field of personal comfort it is a commonly used index that can serve as a quality criterion for the thermal situation in a building. And with CoMoS, all ambient parameters required for PMV calculation can be measured. If you're interested, find out more about thermal comfort, the context of globe and mean radiant temperature, the PMV-index, and the implementing ASHRAE-standard at ISO 7726 Ergonomics of the thermal environment By the way: There are long existing, but also plenty of newly developed gadgets in the field of personalized environment to provide individual thermal and visual comfort. Small desktop fans are a well-known example. But also, footwarmers, heated and ventilated chairs, or office partitions for IR-radiative heating and cooling are being developed or even already available on market. All these technologies influence the local thermal condition, at a workplace for example, and they can be controlled automatically based on local sensor data, too, as illustrated in this step's pictures. More information about the gadgets of personalized environment and the ongoing research is available at Living Lab smart office space: Personalized Environment University of California, Berkeley One of the main goals in the development process was to create a wireless, compact, and inexpensive sensor device to measure indoor environmental conditions of at least ten individual workplaces in a given open office space. Therefore, the station uses an ESP32-WROOM-32 with on-board WiFi connectivity and with a large variety of connector pins and supported bus types for all kinds of sensors. The sensor stations use a separate IoT-WiFi and send their data readings to a MariaDB database through a PHP script that runs on the database server. Optionally, an easy-to-use Grafana visual output can be installed as well. The scheme above shows the arrangement of all peripheral components as an overview on the system setup, but this instructable focuses on the sensor station itself. Of course, the PHP file and a description of the SQL connection is included later on, too, to provide all necessary information to build, connect, and use CoMoS. Note: at the end of this instructable you can find instructions on how to build an alternative stand-alone version of CoMoS with SD-card storage, internal WiFi access point, and a web app for mobile devices. Electronics Sensors and controller, as shown in the picture: More electric parts: Case parts Miscellaneous Tools Software and libraries CoMoS' design features a slim, vertical case with most of the sensors mounted in the top area, with only the temperature and humidity sensor mounted near the bottom. The sensor positions and arrangements follow specific requirements of the measured variables: Additional resources about the mean radiant temperature and the use of black table tennis balls as globe temperature sensors are: The case is designed simple, to keep the manufacturing time and effort as low as possible. It can easily be built from standard parts and components with just a few simple tools and skills. Or, for those lucky enough to have a 3D-printer at their service, all case parts can be 3D-printed as well. For printing the case, the rest of this Step can be skipped and all required files and instructions can be found in the next Step. For the construction from standard parts, fitting dimensions are chosen for most of them: The manufacturing and assembling process is simple, beginning with some holes to drill. The steel round needs an 8 mm continuous hole, to fit the LED and cables. The main body tube needs some 6 mm holes, as cable feed-through for the USB and sensor cables, and as ventilation holes. The number and positions of holes can be varied up to your preference. The developers’ choice is six holes on the backside, close to top and bottom, and two on the front side, one top, one bottom again, as a reference. The top plate is the most tricky part. It needs a centered, straight and continuous 12 mm whole to fit the top riser tube, another off centered 6 mm hole to fit the illuminance sensor cable, and a thin slit of approximately 1,5 mm width and 18 mm length to fit the wind sensor. See the pictures for reference. And finally, the table tennis ball needs a 6 mm whole, too, to fit the globe temperature sensor and cable. In the next step, all PMMA parts, except the bottom plate, should be spray painted, the reference is white. The table tennis ball must be painted in matte black to establish its estimated thermal and optical attributes. The steel round is glued centered and flat to the bottom plate. The top riser tube is glued into the 12 mm hole of the top plate. The table tennis ball is glued on the top end of the riser, with its hole matching the inner opening of the riser tube, so the temperature sensor and cable can be inserted to the ball afterwards through the riser tube. With this step done, all parts of the case are ready to be assembled by putting them together. If some fit too tight, sand them down a bit, if too loose, add a thin layer of tape. While Option 1 of building CoMoS' case is still a fast and simple one, letting a 3D-printer do the job might be even easier. Also for this option, the case is divided into three parts, top, case body, and bottom part, to allow easy wiring and assembly as described in the next Step. The files and further info on printer settings are provided at Thingiverse: Following the instructions to use white filament for the top and case body parts is highly recommended. This prevents the case from heating up too quickly in sunlight and avoids false measurements. Transparent filament should be used for the bottom part to allow LED indicator illumination. Another variation from Option 1 is that the metal round is missing. To prevent CoMoS from toppling over, any kind of weight like bearing balls or a bunch of metal washers should be placed in/on the transparent bottom part. It is designed with an edge around to fit and hold some weight. Alternatively, CoMoS can be taped to its place of installation by using double-sided tape. Note: The Thingiverse folder includes files for a micro SD card reader case which can be mounted to the CoMoS case. This case is optional and part of the stand-alone version described in the last step of this instructable. The ESP, sensors, LED, and USB cable are soldered and connected according to the schematic circuit shown in the pictures of this step. The PIN-assignment matching the example code described later is: The Si7021, BH1750, and DS18B20+ sensors are powered through an IO-pin of the ESP32. This is possible because their max current draft is below the ESP's max current supply per pin, and necessary to be able to reset the sensors by cutting off their power supply in case of sensor communication errors. See the ESP code and comments for more information. The Si7021 and BH1750 sensors, same as the USB cable, should be soldered with the cables already put through the dedicated case holes to allow assembly in the next step. WAGO compact splicing connectors are used to connect devices to the power supply by the USB cable. All are powered at 5 V DC by USB, which works with the logic level of the ESP32 at 3,3 V. Optionally, the data pins of the micro USB cable can be reconnected to the micro USB plug and connected to the ESP's micro USB socket, as power input and data connection to transfer code to the ESP32 while the case is closed. Else, if connected as shown in the scheme, another intact micro USB cable is needed to initially transfer code to the ESP before assembling the case. The Si7021 temperature sensor is glued to the back side of the case, close to the bottom. It's very important to attach this sensor close to the bottom, to avoid false temperature readings caused by heat evolved within the case. See Epilogue step for more Information about this issue. The BH1750 illuminance sensor is glued to the top plate, and the wind sensor is inserted and fit mounted to the slit on the opposite side. If it fits too lose, a little bit of tape around the center part of the sensor helps to keep it in position. The DS18B20 temperature sensor is inserted through the top riser into the table tennis ball, with a final position in the center of the ball. The inside of the top riser is filled with isolation wool and the lower opening is sealed with tape or hot glue, to prevent conductive or convective heat transfer to the globe. The LED is attached into the steel round hole facing down to illuminate the bottom plate. All wires, the splicing connectors, and the ESP32 go inside the main case and all case part are put together in final assembly. The ESP32 micro controller can be programmed by using the Arduino IDE and the ESP32 Core library provided by Espressif. There are plenty of tutorials available online on how to set up the IDE for ESP32 compatibility, for example here. Once set up, the attached code is transferred to the ESP32. It is commented throughout for easy understanding, but some key features are: The attached PHP file has to be installed and accessible in the root folder of the database server, at serverIP/sensor.php. The PHP file name and content of data handling must match the call function code of the ESP and, on the other side, match the database table setup, to allow storage of data readings. The example codes attached are matched, but in case you change some variables, they have to be changed throughout the system. The PHP file includes an adjusting section at the beginning, in which individual adjustments are made according to the environment of the system, especially database username and password, and the database name. A MariaDB or SQL database is set up on the same server, according to the table setup used in the sensor station code and the PHP script. In the example code, the MariaDB database name is "sensorstation" with a table named "data", which contains 13 columns for UTCDate, ID, UID, Temp, Hum, Globe, Vel, VelMin, VelMax, MRT, Illum, IllumMin, and IllumMax. A Grafana analytics and monitoring platform can be installed additionally on the server as an option for direct database visualization. This is not a key feature of this development, so it's not further described in this instructable. With all wiring, assembly, programming, and environmental setup done, the sensor station sends data readings periodically to the database. While powered, several operation states are indicated through the bottom LED color: With this final step done, the sensor station runs and operates continuously. To date, a network of 10 sensor stations is installed and running in the beforehand mentioned Living Lab smart office space. The development of CoMoS continues and the first result of this ongoing process is a stand-alone version. That version of CoMoS doesn't need a database server and WiFi network to monitor and record environmental data. The new key features are: This replaces the WiFi and database connection while all other features including calibration and all design and construction remain untouched from the original version. Still, the stand-alone CoMoS requires experience and further knowledge of how to access the internal file management system "SPIFFS" of the ESP32, and a little awareness of HTML, CSS, and Javascript to understand how the web-app works. It also needs a few more / different libraries to work. Please check the Arduino code in the zip file attached for required libraries and the following references for further information on programming and uploading to SPIFFS file system: SPIFFS file uploader by me-no-dev ESP32WebServer library by Pedroalbuquerque This new version would make a whole new instructable which might be published in the future. But for now, especially for more experienced users, we don't want to miss the chance to share the basic information and files you need to set it up. Quick steps to build a stand-alone CoMoS: Check the Arduino code and adjust the WiFi access point variables "ssid_AP" and "password_AP" to your personal preference. If not adjusted, the standard SSID is "CoMoS_AP" and the password is "12345678". Insert micro SD card, upload the code, upload the content of the "data" folder to the ESP32 using the SPIFFS file uploader, and connect any mobile device to the WiFi access point. Navigate to "192.168.4.1" in your mobile browser and enjoy! The app is all based on html, css, and javascript. It's local, no internet connection is involved or required. It features an in-app side menu to access a setup page and a memory page. On the setup page, you can adjust the most important settings like local date and time, sensor readings interval, etc. All settings will be stored permanently in the ESP32's internal storage and restored on next boot. On the memory page, a list of files on the SD card is available. Clicking a filename initiates a direct download of the CSV file to the mobile device. This system setup allows individual and remote monitoring of indoor environmental conditions. All sensor readings are stored on the SD card periodically, with new files being created for every new day. This allows a continuous operation for weeks or months without access or maintenance. As mentioned before, this is still an ongoing research and development. If you're interested in further details or assistance, please don't hesitate to contact the corresponding author through the comments or directly via LinkedIn. The sensor station described in this instructable is the outcome of a long and ongoing research. The goal is to create a reliable, precise, yet low-cost sensor system for indoor environmental conditions. This held and holds some serious challenges, of which the most certain should be mentioned here: Sensor accuracy and calibration The sensors used in this project all offer relatively high accuracy at low or moderate cost. Most are equipped with internal noise reduction and a digital bus interfaces for communication, reducing the need for calibration or level adjustments. Anyway, because the sensors are installed in or on a case with certain attributes, a calibration of the complete sensor station was performed by the authors, as shown briefly by the pictures attached. A total of ten equally built sensor stations were tested in defined environmental conditions and compared to a TESTO 480 professional indoor climate sensor device. From these runs, the calibration factors included in the example code were determined. They allow a simple compensation of the case's and electronics' influence on the individual sensors. To reach the highest accuracy, an individual calibration for each sensor station is recommended. The calibration of this system is a second focus of the authors' research, besides the development and construction described in this instructable. It is discussed in an additional, connected publication, which is still in peer-review and will be linked here as soon as it goes online. Please find more information about this topic on the authors' website. ESP32 operation stability Not all Arduino-based sensor libraries used in this code are fully compatible with the ESP32 board. This issue has been widely discussed at many points online, especially regarding the stability of I2C and OneWire communication. In this development, a new, combined error detection and handling is carried out, based on powering the sensors directly through IO pins of the ESP32 to allow cutting their power supply for reset purpose. From today's perspective, this solution has not been presented or is not widely discussed. It was born of necessity, but to date is running smoothly for operation periods of several months and beyond. Yet it is still a topic of research. Outlook Together with this instructable, further written publications and conference presentations are carried out by the authors to spread the development and allow a wide and open source application. In meanwhile, the research is continued to further improve the sensor station, especially regarding system design and manufacturability, and system calibration and verification. This instructable might be updated on important future developments, but for all up-to-date information, please visit the authors' website or contact the authors directly via LinkedIn: corresponding author: Mathias KimmlingStep 1: Background – Thermal and Visual Comfort
Step 2: System Scheme
Step 3: Supply List
(Find more detailed information on these parts and sizes in the next Step. If you have a 3D-printer available, you only need a table tennis ball. Skip the next Step and find all info and files for printing in Step 5.)
(The numbers indicate the library versions we used and tested the hardware with. Newer libraries should work as well, but we faced some issues occasionally while trying different / newer versions.)Step 4: Case Design and Construction – Option 1
Step 5: Case Design and Construction – Option 2
Step 6: Wiring and Assembly
Step 7: Software – ESP, PHP, and MariaDB Configuration
Step 8: Results – Data Reading and Verification
Step 9: Alternative: Stand-alone Version
Step 10: Epilogue – Known Issues and Outlook

Second Prize in the
First Time Author