Weather Station for Server Rooms

by shah80313 in Circuits > Arduino

91 Views, 2 Favorites, 0 Comments

Weather Station for Server Rooms

Screenshot 2024-08-27 at 2.41.36 PM.png
Screenshot 2024-08-25 at 1.08.13 PM.png

Server rooms are critical components used in many industry but these rooms generate a lot of heat due to the continuous operation of the equipment, which can lead to various issues if not properly managed. Here's how monitoring air quality, temperature, humidity, and CO2 levels can be crucial:

Heat Management: Server rooms can generate significant heat, and proper temperature monitoring ensures that the environment remains within acceptable limits. Excessive heat can lead to equipment failure, reduced lifespan of components, and even data loss or corruption.

Air Quality: Dust and other contaminants can occur in server rooms, which can shorten equipment lifespan and performance. Monitoring air quality helps ensure that the air is clean, reducing the risk of hardware damage and improving overall reliability.

Humidity Control: Maintaining optimal humidity levels is essential for preventing static buildup, which can damage sensitive electronic components. High humidity can also lead to corrosion and condensation, while low humidity can increase the risk of electrostatic discharge. This is especially a disadvantage in Singapore due to high amounts of humidity.

CO2 Monitoring: High levels of carbon dioxide can indicate insufficient ventilation in the server room, which can have health risks. It can also be a sign of inefficient cooling systems, leading to increased energy consumption and potential equipment overheating.

What are we making?

We will be designing a unit which optimises and manages the atmosphere of a server room by monitoring temperature, humidity, CO2 levels, and air quality using sensors connected to an Arduino Uno. The translated data will be displayed on an OLED display for real-time monitoring and informed decision-making. This unit will be powered by a USB cord, displaying data with low delay and as floats for accurate readings.


Supplies

Screenshot 2024-08-25 at 1.11.12 PM.png
Screenshot 2024-08-25 at 1.11.07 PM.png
Screenshot 2024-08-25 at 1.11.16 PM.png
Screenshot 2024-08-25 at 1.11.20 PM.png
Screenshot 2024-08-25 at 1.11.25 PM.png
Screenshot 2024-08-25 at 4.54.37 PM.png

Bill of Materials:

  1. ESP32 Amazon
  2. Temperature and Humidity Sensor (DHT22) Amazon
  3. CO2 Sensor (SCD30) Amazon
  4. Air Quality Sensor (CCS811) Amazon
  5. OLED Display SPI (SSD1309) Amazon
  6. Bread Board Amazon
  7. Jumper wires (female-female), (male-male), (female-male) Amazon
  8. 3.3v Micro-USB to USB connecter Amazon
  9. 12mm Momentary Buttons for Breadboard Amazon

Electronics

Screenshot 2024-08-25 at 1.11.35 PM.png
Screenshot 2024-08-27 at 1.56.53 PM.png
Screenshot 2024-08-27 at 1.56.43 PM.png

When it comes to electronics its one of the most important parts of the weather station as these sensors must be able to translate accurate data from their readings without many fluctuations. I have researched and chosen specific sensors for each different reading.

Components:

DHT22


A temperature and humidity sensor is a device designed to measure both temperature and relative humidity levels in the surrounding environment.

One popular example of a temperature and humidity sensor is the DHT series, which includes sensors like the DHT11 and DHT22. These sensors provide accurate and reliable measurements of temperature and humidity.

Parts of the temperature sensing component:

Thermistor: This is one of the most common temperature sensing components. It's a type of resistor whose resistance varies with temperature.

Temperature-Dependent Diode: By measuring the voltage across the diode, the temperature can be inferred.

Parts of the temperature sensing component:

Capacitive Humidity Sensor: These sensors measure relative humidity by tracking variations in the capacitance of a moisture-sensitive dielectric material.


Air Quality Sensor (CCS811)


Air quality sensors are devices designed to measure various pollutants and contaminants present in the air. 

Gas-Sensing Component:

These sensors are designed to detect specific pollutants commonly found in indoor and outdoor environments.

This component may include algorithms for data filtering, calibration, and conversion of raw sensor readings into meaningful air quality metrics.

Limitation: 

Air quality sensors are unable to output specific data such as carbon dioxide levels or carbon monoxide levels.


CO2 Sensor (SCD30)


CO2 (carbon dioxide) sensors are specialised devices designed to measure the concentration of carbon dioxide gas in the air. 

"The output voltage of the module falls as the concentration of the CO2 increases. The potentiometer onboard is designed to set the threshold of voltage. As long as the CO2 concentration is high enough (the voltage is lower than the threshold), a digital signal (ON/OFF) will be released." Arduino.com


OLED Display SPI (SSD1309)


An OLED (Organic Light-Emitting Diode) display is a type of display technology that uses organic compounds to emit light when an electric current is applied. 

OLED displays offer several advantages over traditional LCDs, including higher contrast ratios, faster response times, and wider viewing angles. They are commonly used in electronic devices such as smartphones, smartwatches, and digital cameras.

This display will showcase the translated data from sensors into actual readable data, which we can interpret.

The OLED specific for this project will be using SPI communication, which is known to have higher data rates than I2C.


ESP32


An ESP32 microcontroller, with its integrated WiFi and Bluetooth capabilities, extends the functionalities of the Arduino Uno. It enables the creation of web servers accessible from anywhere, facilitating IoT projects, remote monitoring, and control. Its BLE support allows integration with mobile devices for wireless communication. With enhanced processing power and memory, it's ideal for complex tasks. Using the Arduino IDE to code and upload to the microcontroller.

Wiring

Screenshot 2024-08-30 at 11.42.36 AM.png
Screenshot 2024-08-25 at 4.12.47 PM.png
Screenshot 2024-08-25 at 4.58.33 PM.png
Screenshot 2024-08-27 at 1.57.17 PM.png
Screenshot 2024-08-25 at 4.52.46 PM.png

When first encountering the ESP32 it is important to set up the ESP32 module to the Arduino IDE. If you do not have Arduino IDE please download from the Arduino Website for your specific operating system and follow this detailed guide in how to install the ESP32 Library in the Arduino IDE software Guide.

To set up the ESP32 for sensor integration, I began by connecting the GND and VCC pins from the ESP32 to the power rails of the breadboard. This setup provides the necessary power to all the components. I then proceeded to connect each sensor one by one, carefully linking their respective data pins to the designated GPIO pins on the ESP32, while the VCC and GND pins of each sensor were connected to the corresponding power rails on the breadboard.

Once the sensors were securely connected, I moved on to the OLED display. The display was connected similarly, with its communication pins wired to the appropriate I2C pins on the ESP32, and its power pins linked to the breadboard’s power rails. After setting up the display, I connected five 12mm momentary push buttons to the breadboard. Each button’s connection was established by wiring one side of the button to a GPIO pin on the ESP32 and the other side to the ground, ensuring that pressing the button would register as a signal on the microcontroller.

To complete the wiring, I used a combination of jumper wires (female-female, male-male, or female-male) depending on the connection requirements. This ensured that all components were properly powered and correctly interfaced with the ESP32.

Coding

Screenshot 2024-08-27 at 1.56.30 PM.png
Screenshot 2024-08-25 at 5.05.42 PM.png
Screenshot 2024-08-25 at 5.06.01 PM.png
Screenshot 2024-08-25 at 5.04.58 PM.png
Screenshot 2024-08-25 at 5.05.29 PM.png
Screenshot 2024-08-27 at 1.57.54 PM.png

When coding, I started by programming the sensors first before moving on to the OLED display. I used the Serial Monitor in the Arduino IDE software to display live readings from the various sensors. Initially, I encountered issues with the I2C connection interference. However, this was resolved with a simple line of code.

Code:


The code is provided below. Before using the code, make sure to download the specific libraries listed at the top of the code. You can do this via the "Library Manager" in the Arduino IDE. Additionally, you'll need to sign in to ThingSpeak and create an external channel where you can input your API key from the ThingSpeak website.

When downloading the code, you will be prompted to input your Wi-Fi SSID and password. Without this, you will not be able to access the full functionality of the weather station.

Break Down of the code:

Libraries Included


  1. SensirionI2cScd30.h: Manages the SCD30 CO2 sensor.
  2. SparkFun_SCD30_Arduino_Library.h: A SparkFun library for the SCD30 CO2 sensor.
  3. SparkFunCCS811.h: Manages the CCS811 air quality sensor, which measures CO2 and TVOC.
  4. U8g2lib.h: Manages the OLED display.
  5. DHT.h: Handles the DHT22 sensor for temperature and humidity.
  6. WiFi.h: Enables WiFi connectivity on the ESP32.
  7. ESPmDNS.h: Provides mDNS (multicast DNS) capabilities for easier access to the web server on the ESP32.
  8. WebServer.h: Manages a web server running on the ESP32.
  9. ThingSpeak.h: Handles communication with ThingSpeak for data logging.


Sensor Setup


  1. DHT Sensor: Uses GPIO pin 4 for reading temperature and humidity.
  2. CCS811 Sensor: Uses I2C communication with an address of 0x5A (or 0x5B).
  3. SCD30 Sensor: An air sensor for CO2 monitoring.


WiFi Setup


  1. SSID and Password: Connects to a WiFi network using the SSID and password.


Web Server Setup


  1. WebServer server(80): Sets up a web server on port 80.
  2. WiFiClient client: Creates a WiFi client for use with ThingSpeak.


ThingSpeak Setup


  1. myChannelNumber: The channel number on ThingSpeak for data logging.
  2. myWriteAPIKey: The API key used to write data to ThingSpeak.


Variables


  1. Temperature, Humidity, CO2, TVOC: Stores sensor readings.
  2. lastTime, timerDelay: Variables for timing ThingSpeak updates.
  3. highTemp, lowTemp, highHumidity, lowHumidity, lowCO2, highCO2, lowTVOC, highTVOC: Variables to track the highest and lowest readings for each sensor.


Display Functionality


  1. draw_all(): Draws the sensor readings on the OLED screen.
  2. draw_temp(): Displays temperature readings.
  3. draw_humidity(): Displays humidity readings.
  4. draw_CO2(): Displays CO2 readings.
  5. draw_TVOC(): Displays TVOC readings.


Web Server Functionality


  1. handle_OnConnect(): Handles client connections to display the sensor readings in an HTML format.
  2. handle_NotFound(): Handles 404 errors.
  3. SendHTML(): Generates the HTML code to display the sensor readings on the web page.


Main Loop


  1. loop(): Continuously checks for sensor data, updates the OLED display, handles web server requests, and logs data to ThingSpeak if enough time has passed.


Operations


  1. Sensor Readings: The code reads temperature, humidity, CO2, and TVOC levels from the various sensors.
  2. Display: It uses an OLED display to show the readings in real time, including graphical representations (like bar graphs) and warnings when values exceed specified thresholds.
  3. Web Interface: A simple web server is created to allow remote monitoring of the sensor data via a web browser.
  4. Data Logging: Sensor data is sent to ThingSpeak for remote logging.

Upload the code to the ESP32 using the micro USB cable connected to your computer and press the upload button on the Arduino IDE.

Next Steps and Failures on the Way

Screenshot 2024-08-27 at 2.51.55 PM.png
Screenshot 2024-08-30 at 11.32.00 AM.png
Screenshot 2024-08-30 at 11.55.30 AM.png

Some Failures you may encounter are faults within the sensors, where the sensor does not switch on or showcase any data, this is primarily the CCS811, and SCD30. If these sensors fail to initialize correctly, it could be due to wiring issues, insufficient power supply, or problems with the I2C communication.

Sensor Calibration: If sensor readings seem off, consider recalibrating the sensors according to the manufacturer's guidelines.

Check for interference with wires as this can disrupt the starting or signal of sensors and OLED display.

Next Steps: With this, you can create a PCB of the following schematic using the ESP32 as a base, attaching all the various sensors to it, reducing wire interference and increasing portability and durability, however this would be a side project and an extension, the pictures above are the PCB I had created for this particular Weather Station.