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.
Thanks ------ Thanks again for checking my post. I hope it helps you. If you want to support me subscribe to my YouTube Channel: https://www.youtube.com/user/tarantula3
This project demonstrates the creation of a NodeMCU-based indoor dial thermometer that displays temperature and humidity via a physical D-shaped gauge, seven-segment displays, and a remote web application. The system integrates hardware sensors with a Raspberry Pi home server and a MySQL database for data logging and visualization.
Had some time this weekend and a desire to create something new and interesting,
so went ahead and created a NodeMCU-based indoor dial thermometer.
This device displays the temperature in degree centigrade on a D-shaped gauge
as well as on a seven-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 OurSmartHome app.
This video is sponsored by PCBWay. PCBWay specializes in manufacturing of very high-quality,
low-volume colored PCBs at a very budgetary price. In addition to standard PCBs,
you can also order advanced PCBs, aluminum PCBs, rigid, flex PCBs. They also provide PCB assembly
and other related services which can meet your need to the greatest extent.
For this project we need
Two TM1637 display modules
One DHT22 or DHT11 module
One NodeMCU
One stepper motor with ULN2003 driver board
One 10k resistor
A 3D printer
Copper wire
And some nuts and bolts
The circuit is very simple. Connect the ULN2003 driver boards IN1, IN2,
IN3 and IN4 to the NodeMCU's digital pin D0, D1, D2 and D3.
Then connect the out pin of the DHT22 to the D5 pin of NodeMCU.
After that connect the two digital display modules to the microcontroller.
We are going to use a common clock pin D4 for both the modules.
Then connect the DIO pin of one of the modules to D6 and the other one to D7 of the NodeMCU.
Please avoid using the boot config pins D3, D4, D8 and the RTC pin D0 for these displays.
Now on the D8 pin we are going to connect the switch.
The switch has a very important role in this circuit.
The switch acts as the home or the starting point of the stepper motor.
When the switch is open, D8 is connected to ground through the pull down resistor
and we read a low.
When the switch is closed, pin D8 connects to the 3.3 pin of the NodeMCU and we read a high.
When the temperature changes or the device boots up,
the pointer starts moving counterclockwise.
As soon as the pointer hits the home position, pin D8 reads high
and the logic moves the pointer clockwise to display the temperature on the gauge
as read by the DHT22 module.
The code starts by including all the necessary libraries.
Then it defines all the variables needed for setting up the Wi-Fi 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 your code.
After that, it sets up the two URLs that are needed for updating the heartbeat,
temperature and humidity.
Before going ahead, let's have a quick look at the two PHP files.
The updateStatus.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.
The updateTemperature.php uses an insert query to add a new row to the database
with the current value of temperature and humidity.
This is what is written to the database and can be displayed using Google Charts.
In my case, I'm using the OurSmartHome app to display the data using PHP and JavaScript.
Currently, I'm only displaying the data from the study room and the pegbox.
To know more about my award-winning pegbox project,
please have a look at my electronics tutorial number 34,
Pegbox with Temperature and Humidity Monitoring using NodeMCU.
The link is in the description below.
After that, I'm defining all the variables required for reading and
storing the value of temperature and humidity.
Next, I'm defining all the variables and setting up any additional symbols
required for displaying the temperature and humidity on the TM1637 display module.
After that, I'm defining the D8 pin of the NodeMCU as the reset switch pin.
We will talk about this in detail in the following sections.
Next, I'm setting up the steps per revolution of the stepper motor to 2038
and then initializing the stepper library through pins D0 to D3.
Since I need both clockwise and counterclockwise movement,
I have to initialize the pins in the order shown on screen.
Then in the setup section, first I'm setting up the Wi-Fi connection
and then sending a heartbeat to the server.
Then I'm setting up the brightness of the 7-segment display to its max value,
followed by starting the DHT module and finally setting up the pin mode of the switch to input.
Now in the loop section, I'm reading the temperature using the read underscore
temp function and then sending the temperature and humidity values every 30 minutes.
Next, you see the definition of the sendIamAlive and sendTemperatureAndHumidity functions which
utilizes the Wi-Fi connect functions to send the values using the previously discussed URLs.
The read underscore temp function reads the temperature and humidity and updates the
7-segment displays and moves the pointer only if there is a change in their values.
The move underscore needle function sends the pointer to its home position using the
and then looks through and moves the pointer to the correct position
until the step count is equal to steps.
The value of steps is calculated based on the steps per revolution which we previously set
it up as 2038. So 2038 by 2 for half circle is equal to 1019. Now by dividing 1019 by 180,
we get the steps required to display each degree centigrade.
Since our gauge starts from minus 10 and not from 0, we also have to add the first 10 blocks
which is 5.661 times 10 times 3 to our calculation. That's it. As easy as that.
Now let's have a quick look at the 3D model of the project.
At the front, we have the pointer, D-shaped dial and the temperature scale on the dial.
Down at the bottom, we have the enclosure that will house the microcontroller
and all other electronic components in it. The enclosure has a lid to keep the
electronic components safe and sound. At the back, we have a pocket to hold the DHT22 module,
three holes for the stepper motor, two groves for the TM1637 display module
and two L-shaped brackets to hold the top dial to the bottom enclosure.
Once the 3D models were sorted, it was time for me to fire up my 3D printing oven
and start printing these 3D models. I used 1.75mm cold white PLA filament and printed the models
with 0.2mm with 0% infill and with support. As we all know, 3D printing is the process
that uses computer-aided design or CAD to create objects layer by layer.
3D printing is not a new technology. It's been there since 1980s when Charles W. Hull
invented the process and created the first 3D printed part. Since then, the field of 3D printing
has grown exponentially and holds countless possibilities. The 3D printing process fascinates
me a lot and I sometimes love to sit near my 3D printer and watch these layers getting printed.
The entire printing process took a little over 5 hours to complete and this is the final result.
Alright, now let's start gluing all the printed parts. I first superglued the L-shaped bracket
to the dial followed by the pocket that will hold the DHT22 module. Then I went ahead and
screwed the bottom enclosure to the top section via the L-shaped brackets. So, this is how it
looks like. Before adding the electronic bits to the 3D printed bits, let's do a quick test to make
sure everything works as expected. So, this 7-segment display is displaying the temperature
and the other one is displaying the humidity. The pointer is currently going round and round
in circles as it has no idea where to stop. To stop the pointer and to send it to the correct
position on the gauge, I need to connect this red jumper cable connected to 3.3V to the D8 pin of
the NodeMCU. Once I short the cable, the needle changes its direction and moves clockwise to
display the temperature value as read from the DHT22 module. The temperature and humidity values
are also sent to the home server which are then displayed using the OurSmartHome app.
Using acrylic colors, I painted all the 3D printed parts of the project. Once the coloring is done,
it's now time for me to put all the electronic components together. First, I screwed the stepper
motor to the back of the dial. Then I gently pushed the DHT22 module into its pocket at the
of the dial. Now the interesting bit. As per our previous discussion, we are going to use a copper
wire as a switch that will move the pointer to its correct position. The copper wire will be fed
through these two holes from the back and will loop through this small pipe-like structure in
the front. A small cut will be made on the top exposed side of the copper wire. Now on the
pointer, we need to add a small piece of copper wire. When this copper bit touches the two copper
wires on the pipe, it will complete the circuit and will send a high to the system. Next, I'm
hot gluing the two TM1637 7-segment display modules to the back of the dial. Once done,
it's pretty much just a matter of soldering all the sensors to the NodeMCU as per our circuit
diagram. So this is how my final setup looks like. Once the device is turned on, the pointer moves
counterclockwise until it touches the copper wire that acts like a switch. Upon touching the wire,
the pointer moves clockwise to display the temperature value read from the DHT22 module
on the D-shaped gauge. The temperature and humidity values are also displayed using the
7-segment displays. The values are also sent over Wi-Fi to a Raspberry Pi home server and is stored
in a MySQL database. Using Google Charts, you can display the data using various different graph
options. In my case, I'm using the Our Smart Home app to display the data using PHP and JavaScript.
Thanks for watching. Please comment and let me know if there are any scopes of improvement.