For centuries, thermometers had been working on a fairly simple concept. Mercury is a metal which is liquid under room conditions and this leads to its thermal sensitive properties. What’s interesting about this feature of mercury is that it can detect slight changes in temperature. When temperature rises, mercury expands. When temperature decreases, it contracts. Mercury also has one of the densest structures which makes this contraction or expansion very easy to identify.
For centuries, these thermometers provided reliable and fairly accurate readings but then technology flooded in. We have digital thermometers now with unmatched accuracy and precision. Using tiny temperature sensors and a basic circuit we can create mercury thermometer’s successor.
Know your components - Digital Thermometer
For this project, we’ll be using a LM35 Thermal sensor. A thermal sensor changes its resistance in response to the change in temperature. This, in turn, allows for a potential divider which changes the voltage. It’s output voltage is linearly proportional to Celsius temperature. Using this simple component, we can detect minute changes in temperatures.
Thereafter, we use an ADC (analogue-digital converter) to take the analogue values (voltage) from the thermal sensor and return a digital value ranging from 0 to 256. This digital data is fed to an 8051 Microcontroller which reads these digital values and returns a value in degree Celsius. The microcontroller returns data in ASCII form which is really useful to us because it can be readily displayed on an LCD.
The last step in the circuit is simply to feed the ASCII values to the 16X2 LCD using the data ports from D0 to D7. This represents an 8-bit register. The LCD screen will display our current temperature and update it frequently as with the thermometer.
Code Explanation
Microcontrollers like the 8051 microcontroller that we’re using could be programmed in C++ to perform certain tasks. Our task here is to take in the ADC digital inputs and provide an ASCII output to the LCD. This does require processing but we can easily do it in a few steps and with the help of a few in-built library commands.
Code
Getting into the code, the first libraries that we import are the reg51 library- which is essential for circuits and electronics projects like these- and the string library- which will help us convert data into ASCII for the LCD. We’ll go through the code from the top to the bottom. The code is divided into small functions to perform specified tasks which is how you should try to code your electronics circuits too.
As always in these projects, we define the constants and the ports that we’ll be using in the first few lines. This is how we initialise our entire circuit. The delay function does exactly what you’d expect it to. It provides a “delay” to a circuit which is basically just so that you can time the circuit right. If the LCD is changing temperatures way too quickly, the user won’t understand anything. The cmd and the ldata function are just initialisation functions for the LCD, they start the LCD and set everything to zero on the LCD.
Then we have the functions that are the core of our program. The first among these is the adc function which takes in values from the ADC and returns it after applying a delay (as seen visibly in the code). The ldata function loops through the characters of a string and changes them into the ASCII form that we talked about.
In the main function, we start our LCD. After a small delay, we’ll print “temp: “ on the LCD and note that this has to remain there. The temperature itself will change but the “temp: “ part stays there. Thankfully, we can do this easily by moving the LCD cursor to be after the “temp: “. To do that we just use the command cmd(0x85). After this is done, the printing part is just taking the data from ldata and putting it on the screen one by one.
Check out our Free Arduino Projects Playlist - Arduino Projects
Check out our Free Raspberry Pi Projects Playlist - Raspberry Pi Projects
Check out our Free TinkerCAD Projects Playlist - TinkerCAD Projects
Check out our Free IoT Projects Playlist - IoT Projects
Check out our Free Home Automation Projects Playlist - Home Automation Projects
Check out our Free NodeMCu Projects Playlist - NodeMCu Projects
Order Electronics Projects
Want us to guide you through your project or make the project for you? Click on the button below or reach out to us via Call/WhatsApp at (+91) - 7600948607
You can -
Order Basic Electronics Projects
Order Embedded Systems Projects
Order IoT Projects
Order FPGA Projects
Order VLSI Projects
Order Image Processing Projects
Order Matlab Projects
Order TinkerCAD Projects
Order Proteus Projects
Click on the button below to fill out the project inquiry form -
Create Various Projects
Check out our Free Arduino Projects Playlist - Arduino Projects
Check out our Free Raspberry Pi Projects Playlist - Raspberry Pi Projects
Check out our Free TinkerCAD Projects Playlist - TinkerCAD Projects
Check out our Free IoT Projects Playlist - IoT Projects
Check out our Free Home Automation Projects Playlist - Home Automation Projects
Check out our Free NodeMCu Projects Playlist - NodeMCu Projects
Follow us -
Please do follow us i.e. #learnelectronicsindia to get daily updates about new blogs, videos, courses, products, offers, competitions, quizzes, and Internship Opportunities.
Short and effective! LearnElectronics India never disappoints.
Thoroughly Impressed by the Attention to Detail!" 🧐🔍📝🌟🌟🌟🌟🌟 The meticulous attention to detail in this blog sets it apart from other resources I've come across. Learn Electronics India covers everything, from circuit diagrams and component lists to programming the microcontroller. It's evident that the author is genuinely passionate about electronics and dedicated to helping readers succeed in their projects.