Had some time this weekend and a desire to create something new and interesting, so went ahead and created an Arduino/NodeMCU based indoor dial thermometer. This device displays the temperature in degree centigrade on a D-Shaped Gauge as well as on a 7-Segment display.
In addition to that, it also saves the temperature and humidity readings in a MySQL DataBase hosted on a home based Raspberry Pi Server. The data is then displayed using the "Our Smart Home" app.
Awards
This project got featured on Cults3D and Instructables | |
![]() | ![]() |
https://cults3d.com/en/3d-model/gadget/arduino-based-indoor-dial-thermometer | https://www.instructables.com/NodeMCU-Based-3D-Printed-Indoor-Gauge-Thermometer/ |
Components Required
- 2 x TM1637 Display Modules
- 1 x DHT22 or DHT11 Module
- 1 x NodeMCU Microcontroller
- 1 x 28BYJ-48 Stepper Motor with ULN2003 Driver Board
- 1 x 10K Resistor
- A 3D Printer
- Copper Wire and Some Nuts & Bolts
Circuit Diagram

The Code
The code starts by including all the necessary libraries.
Then it defines all the variables needed for setting up the WiFi connection.
Next, it assigns a static IP address to the ESP8266 (if you want to use DHCP then go ahead and delete these three lines from the code).
After that, it sets up the 2 x URLs that are needed for updating the heartbeat, temperature and humidity.
String URLUpdateStatus = "http://192.168.0.7/Arduino/Weather/UpdateStatus.php";
String URLUpdateTemp = "http://192.168.0.7/Arduino/Weather/UpdateTemperature.php";
Before going ahead let's have a quick look at the 2 php files. The "UpdateStutus.php" file uses an UPDATE query to update the timestamp of the device sending the request to the current epoch time and hence updating the heartbeat.
<?PHP
try {
$Token = $_GET["Token"];
$Location = $_GET["Location"];
include "ConnectionStringArduino.php"; // Create connection
$sql = 'Update `Status` SET `DateTime`=\''.time().'\',`State`=\'1\' WHERE `Device`=\''.$Location.'\' AND `Token` = \''.$Token.'\';';
$result = $con->query( $sql ); if($result === FALSE) { die(mysqli_error());}
mysqli_close($con);
} catch (Exception $e) {}
?>
The "UpdateTemperature.php" uses an INSERT query to add a new row to the database with the current values of Temperature and Humidity.
<?PHP
try {
$Location = $_GET["Location"];
$TEMP = $_GET["TEMP"];
$HUM = $_GET["HUM"];
...