The following blog post was sent to us from the guest car Niklas Heinzel. Have fun reading and postponing:
The second part of this blog series is about using the AZ-Envy environmental development board for early mold prevention in homes. Having looked in part 1 at the structural factors under which mold growth is more likely to occur, we now turn to the technical consideration of the problem, or rather its implementation with the AZ-Envy development board.
We have taken the following basic principles from Part 1, which must now be taken into account in the technical implementation:
"In the technical discussion must be tried to measure the Room air temperature, the Relative humidity (<65%) and the Dew point temperature (
In addition to the correct interconnection of all hardware components, a suitable algorithm is necessary for the project, which checks the three values mentioned above the sensors. To write the appropriate algorithm, I used the Open Source Software Arduino IDE, with the adaptation for the ESP12-F microcontroller used from the ESP8266 family.
Advantage of this development environment is the simple integration of libraries that serve the simplification of commands and practicality. These libraries are available for a wide variety of sensors and other components. But they also offer a variety of programming examples to learn the programming language C ++ or C. I have therefore deliberately renounced other development environments that I use otherwise to avoid unnecessary difficulties in upload, or due to the syntax condition.
As usual in almost every programming language, the libraries are first integrated. In my case, there are libraries for easier reading of sensor values of the SHT30 and libraries that allow to build up their own website with the ESP12-F microcontroller.
After initializing all sensors, it is trying to connect via WLAN with the credentials stored in the internal memory with the local network. If no credentials are available, eg. B. When starting the system by the user, a website is built up in which information about the device and a login page are available. There you are wearing his wireless name (SSID) and his wireless password. These data are stored in the internal memory, the EEPROM, and remain obtained even after switching off the power supply of the device. A EEPROM is a so-called Electrically Erasable PRogrammable READ-Only MEmory, ie an electrically erasable, programmable, exclusively reserved for the reading process, which can be programmed or deleted by voltage differences. The capacity of permanent storage and the ability to modify the memory are ideal to safely preserve the credentials.
After entering the data by the user, these are now permanently stored and another login process is not necessary after a short reboot. The microcontroller then connects to Google's Firebase Database via the home network, a free solution for storing small records. For this, only one account must be created and data can be sent to it via the associated API. An API is a programming interface that receives data from users or devices and forward them for the specific application, according to a predetermined syntax. The unique, used for authentication, API key is also stored in the EEPROM and is connected to the account. After establishing the connection to the FireBase database, the SHT30 and MQ-2 sensors are read out. Subsequently, these data are rounded to two decimal places and uploaded to the database. Such a central storage in a database makes it possible to retrieve the data at any time outside the home network, on vacation or via the mobile network.
To retrieve and evaluate the data user-friendly, as well as easy to implement for the user, I have programmed an Android app for this purpose with the development environment Android Studio.
Since the app has no user inferface with which it would be possible to change the API key, etc., this should only give a thought start for the development of its own app.
This allows the automatic and a few seconds delayed download of the current data of the mold warning system, as well as the complete evaluation of those. User-friendly and clear is humidity (left), room air quality (right), but also the general mold hazard (above). The wreath surrounding the values, depending on the risk potential, turns from green to red and shows again, z. B. in the relative humidity, the value of 0 to 100%.
In order to be able to react quickly and effectively without expertise, a constantly updating and animated button is integrated among the values. This shows, depending on the hazard position, a green hook or a red cross, to clarify the user rapidly the danger.
Click on the button to be proposed to the endangerment parameters, measures such as ventilation, heating or other construction technical measures. Using a navigation bar at the bottom of the field, it is also possible for the user of the application to switch between the presented home page, a contact page, and a page for further information material.
The application is thus an all-in-one solution for IoT-based mold prevention, which represents and evaluates the measured values of the board intelligent and user-friendly.
Here I have illustrated the whole again as a flow chart:
Thus, it is also possible for the user without special expertise, by complying with the measures proposed by the app, effectively avoid the majority of the factors that lead to mold formation.
Since several times the temperature interference between the heated gas sensor and the temperature sensor was pointed out:
Unfortunately, in the current version of the AZ-ENVY, this is a known problem which can be curved by creating offset values to correct the temperature artificially downward or through structural changes. This includes a suitable 3D print housing with a wall between the two sensors or alternatively the gas sensor can be released and placed further away by cable.
Since now all the details would be clarified, find here the code for the Arduino IDE, which works with a few adjustments (SSID, password, API-Key) also with you!
Here again the wiring for upload:
It follows the sketch for the Arduino IDE:
You can use the sketch download here.
After the first upload of the sketch, use a mobile phone e.g. Connect to the Wi-Fi network of the AZ-ENVY and enter a login website. There, select your desired network with which the board should always connect after the setup and after a restart the data is sent!
To make a corresponding database it is only necessary https://firebase.google.com to create a real-time database. In the settings you will also find the SECRET code with which the board can access the database. A possible layout is the following here (accordingly, the Arduino code must be changed for other designation):
From this point you can use the data for many applications, e.g. Android apps reading, display a display, etc.
So I wish a lot of fun with the AZ-Envy development board and I'm very curious which new projects will be built on it!