"Data is raw; information is processed. A sensor might give you a value in Celsius, but your user might need Kelvin. This project is about building the mathematical engine that powers real-world weather stations and industrial monitors."
Welcome to the Thermal Processor. In this project, you are transitioning from simple data management to Mathematical Mapping. You are building a high-precision converter that handles the four most common temperature transitions used in science and engineering.
This project proves you can handle floating-point arithmetic, user-defined functions for specific formulas, and a clean user interface that doesn't break when a decimal point is entered.
The application provides a centralized terminal menu allowing the user to input a base value and select a target conversion matrix:
- 🔹 Celsius to Fahrenheit (C ⮕ F): The standard commercial conversion.
- 🔸 Fahrenheit to Celsius (F ⮕ C): Reversing the scalar for global data standards.
- 🔹 Celsius to Kelvin (C ⮕ K): The scientific standard for absolute thermal analysis.
- 🔸 Kelvin to Celsius (K ⮕ C): Transitioning from lab data to human-readable metrics.
[Image of Temperature scale comparison chart showing Celsius, Fahrenheit, and Kelvin]
Instead of writing one giant block of code, this project follows the Modular Subroutine method. Each conversion is its own "Lego Block" (function). This makes the code easy to read, easy to test, and easy to reuse in future IoT projects.
The logic flow:
- Input Interface: Captures the raw number (float) and the choice of conversion.
- Formula Engine: The script passes the raw number into a specific function (e.g.,
c_to_f(val)) which contains the hardcoded mathematical constant. - Precision Output: The result is returned and formatted to 2 decimal places using Python string formatting to keep the console clean.
Even a simple calculator can be crashed by a bad user. This project implements strict validation:
- Float Validation: If the user enters
25,5(with a comma) orabc, thetry/exceptblock catches theValueErrorand prevents the "Blue Screen of Death" for your script. - The Absolute Zero Gate: (Extra Challenge) In a pro-grade version, the script should check if a Kelvin value is below
0or a Celsius value is below-273.15and raise aValueErrorbecause those temperatures are physically impossible in our universe.
- Connect your Microcontroller and launch Thonny.
- Open the
main.pyfile from this directory. - Press F5 to boot the Thermal Processor.
- Follow the terminal prompts to perform your calculations.