Summer has been relentless this year. My passion for Bitcoin mining took a major hit due to the immense heat from my miners and the electricity costs required to keep them cool and running. There were times when the miners overheated so badly that I had to shut them down "manually" to prevent a fire hazard. To automate the shutdown and restart process and to enable remote temperature monitoring, I built an RGB thermometer with its own web interface that can control home appliances based on temperature changes. Watch this video, for detailed step by step instructions on how to build this circuit and to know how this circuit works.
Video: https://www.youtube.com/watch?v=WecOhmHxspg
Components Required
For this project we need:
1 x ESP32-C3 Super Mini : https://s.click.aliexpress.com/e/_omnke4z
1 x WS2812B RGB LED Strip : https://s.click.aliexpress.com/e/_c4oOdHi9
1 x DS18B20 Temperature Sensor : https://s.click.aliexpress.com/e/_c3oKzGsz
1 x 4.7K Ohm Resistor : https://s.click.aliexpress.com/e/_c3jMGVWl
Upto 6 Optional Relay Modules : https://s.click.aliexpress.com/e/_c3pdcpop
1 x 3D Printer and
1 x Smart Hotgun for demo and testing purpose : https://s.click.aliexpress.com/e/_c3RdrEO7
Schematic
The circuit is quite straightforward. Start by connecting the LED strip’s data pin to pin 4 on the ESP32-C3, and the waterproof DS18B20 temperature sensor’s data pin to pin 3. Then, simply link all the positive (+) and negative (–) wires together, that’s it as simple as that.
A 4.7k ohm pull-up resistor is required between the temperature sensor’s data pin and the positive terminal, as the sensor uses an open-drain (or open-collector) configuration for 1-Wire bus communication. The DS18B20 connects to the microcontroller using just one data pin (plus power and ground), allowing multiple sensors to share the same bus.
Since the main goal of this project was to automatically cool down my miners, I added a pedestal fan to the circuit. When the temperature reaches 40°C, the fan turns on to provide extra cooling and lower the miners’ temperature.
This, can either be achieved by connecting a relay module to any of pins 5 through 10 of the ESP32 board.
Alternatively, my setup sends the temperature reading to my home server over Wi-Fi, which then uses another ESP module to turn the fan on or off based on the temperature.
With the custom PCB I designed for this project, the system can be expanded to support up to six relays or optocouplers. This allows you to control other circuits. Whether by activating a fan based on a temperature threshold or shutting down an overheating device to protect it.
If you’d like to build your own relay module, I have a video tutorial that walks you through the process. For guidance on adding an optocoupler, you can also check out my video on the PC817 Optocoupler. Both links are provided in the description below.
The Code
The code is quite simple. It begins by including all the necessary libraries, followed by defining the variables and constants.
In my setup, the temperature range is set to be checked between –10 and 50 degrees Celsius.
For the LED colors, I'm using an "array" that holds precomputed hex values. As the temperature rises or falls, the corresponding LED lights up in sequence.
In the setup() section, we first establish a Wi-Fi connection and then initialize all other components.
In the loop() section, we start by requesting the temperature reading from the sensor and displaying it. We then check for any relay logic in the code - if present, the relay is either turned on or off based on the temperature. The ESP then sends a heartbeat to the server every minute and also transmits the temperature reading every 30 minutes to the server. This data is then presented using Google Charts.
The Board
So,this is the 2D version of my custom-designed PCB. The 220V-to-5V step-down converter is soldered here and the ESP32 board is soldered here. The LED strip...
Read more »
Hulk


