A colleague recently made an Arduino-based thermometer to measure how hot it gets in the office. I thought I'd recreate and document the project with the components I have at hand
Circuit
The circuit is based around the TMP36 temperature sensor. It's cheap, easy to use and doesn't require any external calibration. The voltage output is linearly proportional to temperature in degrees Celsius, making the conversion easy to calculate.
Any Arduino or microcontroller having at least one analog input pin can be used to make the reading. Finally, some form of display is required. This could be a 7-segment display, a character LCD or even an OLED display.
I'll be using an Arduino Micro combined with a small OLED display.
The resulting circuit is the following:
Code
The temperature sensor can be used without any additional libraries, the analogRead() function and some math will do the trick.
The OLED display however, requires two libraries:
- Adafruit GFX: core graphics library
- Adafruit SSD1306: library for monochrome OLED displays based on SSD1306 drivers
The completed code looks as follows (comments in the code for explanation):
Result
Now I finally know how hot it is in my room ... Outside temperature is not bad either
Extra
As requested in the comments, I have made an updated version of the above project. It includes a button to toggle between degrees C, F and K.
All temperatures are calculated, and a button connected to an interrupt pin is used to toggle the displayed value.
The updated code:
Some pics:
Top Comments