Arduino DIY Analog Thermometer




About: I am Nick Koumaris from Sparta, Greece. I'm extremely passionate about electronics, making things and design. I love teaching what I know and sharing my experiences with you. I put out new YouTube videos eve...

Dear friends welcome to another tutorial!

Today we are going to learn how to use this analog voltmeter with Arduino and make it show the temperature instead of the voltage. As you can see, in this modified voltmeter, we can see the temperature in degrees Celsius. The temperature is measured by this digital sensor, a DS18B20 and it is then displayed on the voltmeter. I really like analog dials like this one, because they give a vintage look to the projects.

By building this project you are going to gain a very valuable knowledge and expererience. The knowledge to add analog dials to any Arduino project and you are going to learn how to use the PWM functionality of the Arduino.

Let’s now see how to achieve that result.

Step 1: Get All the Parts

The parts that we are going to need today are the following:

The cost of the project is around $9.

Step 2: The DS18B20 Temperature Sensor

The DS18B20 is a digital thermometer that accurately measures temperature in the range -10°C to +85°C and also includes alarm functions and trigger points.

It is a very easy sensor to use because it uses the One-Wire interface. So, we only need to connect one wire to make it work! I have used this sensor a lot in the past, and I am going to use it a lot in the future as well because of it's ease of use and accuracy.

The cost of sensor is around $2.

You can get it here ▶

Step 3: DC Analog Voltmeter 0-5V

This is a low cost DC analog voltmeter. It has a range from 0 to 5V DC. It is very easy to use, you simple connect the leads to a voltage source and it will display the voltage.

I find this voltmeter very useful because of its range. We can easily output any voltage from 0 to 5V from a digital pin of the Arduino using the PWM functionality. So, this way we can control the position of the needle at will! This way we can build any analog meter we like! We can build amazing projects using Voltmeters like this one.

The cost of the voltmeter is around $2.5.

You can get it here ▶

Step 4: How to Control the Voltmeter With Arduino

At first let’s see how to control the voltmeter with Arduino. We connect the positive side of the Voltmeter to digital pin 9, and the negative one to GND. Since the Arduino Uno does not offer a Digital To Analog converter we have to use one of the PWM pins in order to write an analog value to a digital pin of the Arduino. Pulse Width Modulation, is a technique for getting analog results with digital means. Instead of writing HIGH to the digital pin, with PWM we send a pulse. PWM is attached to certain pins of the Arduino Uno. Those digital pins the support PWM have this symbol next to them ~.

In order to send a value to the voltmeter we use the analogWrite command and we write a value from 0 to 255. So, if we write 0, the voltmeter shows 0V and if we write 255 the voltmeter show 5V. We can write any other value between 0 and 255 the voltmeter will go to the appropriate position. So, If we want the voltmeter to show 2.5V we have to call the command analogWrite(9,128). Great! Now we can control the voltmeter needle at will!

Step 5: Building the Analog Thermometer

Let’s now convert the voltmeter to a thermometer.

First we have to connect the DS18B20 sensor. We connect the pin with the – sign to Arduino GND, the pin with the + sign to 5V and the signal pin to digital pin 2. That’s it.

Now we have to prepare panel meter. I unscrew these screws and I remove this metal plate. We then need to design our own face for it. I designed a simple one using Photoshop. Actually designing the face took me much more time than building the project itself, so in order to save your time I will attach the file in this Instructable. Now all we have to do is to print the face for the panel meter and glue it in place. If we load the code and power up the project we can see that it works fine! If I touch the sensor, the temperature rises quickly. Our analog thermometer is ready!

Step 6: The Code of the Project

Let’s now take a quick look at the code of the project in order to understand how it works.

We need the DallasTemperature library in the code to compile. Get is here:

The code is very simple. We first read the temperature from the sensor. Next we pass the temperature value to the temperatureToPWM function. This functions converts the temperature to a PWM value from 0 to 255 using the map function. Next, all we have to do is to write this PWM value out at the voltmeter. You can also define the maximum and the minimum temperatures that your panel meter can display by changing the values of MIN_TEMP and MAX_TEMP global variables. The smaller the gap between these two values, the bigger the resolution the panel meter will offer.

You can find the code of the project attached here. Also you can visit the project's website in order to get the latest version of the code ▶

Step 7: Testing the Project

As you can see, our Analog thermometer works fine! It is a very easy project to build and it also looks so cool!

I really love the looks of these analog panel meters so I am going to build a lot of projects with them. In a future video I will design and 3d print a vintage enclosure for this analog thermometer we built today. I am going use an Arduino nano to make things more compact and add some yellow diffused LEDS to illuminate the panel at night. I think it will be cool.

I would love to hear your opinion about this? Do you like analog panel meters and if yes, what kind of projects are you going to build using one of these? Please post your comments in the comments section below, and don’t forget to like this Instructable if you find it interesting. Thanks!



  • Frozen Treats Challenge

    Frozen Treats Challenge
  • 1 Hour Challenge

    1 Hour Challenge
  • Sensors Contest

    Sensors Contest

13 Discussions


Question 6 weeks ago on Step 5

Hi, can you post the photoshop template for the dial?


4 months ago

this is a nice instructables, and it is working, Thank You for shearing :-)
And I got an idea (bright light!), what if, add a Led strip, WS2812, addresable
and light up the LED for each degre. Let say (as I use) from 20 to 30, 11 led'd
one for each degre. I am sure it can be done, but I do not have the knowlage
to figure it how. If someone can help out to start, it would be very ohh so nice :-)
Thank you


5 months ago

I do not have any DS18b20 sensor, but I do have plenty of BPM180,
how to rewrite the code to read the BMP180.
Thank you
This is a nice project, and I can see to add another meter to display the
barometric pressure.
Hope somebody can help with the code to read the BMP180.

Happy new year!

Eric Brouwer

2 years ago

Excellent project. Thanks for sharing.

Have a look at MeterBasic. This little program will help you to create a new faceplate for the meter in a couple of minutes.

1 reply
Billd39ETEric Brouwer

Reply 9 months ago

Thnx for the link, great utility, I made a custom template in about 15 minutes.



9 months ago on Step 7

Thnx, nice project.

You mention . . . "Actually designing the face took me much more time than building the project itself, so in order to save your time I will attach the file in this Instructable."

Can you include the display template please?




1 year ago

Hi, it is very nice and simple project.

I hope, Arduino Uno could be replaced by Attiny 85, to make it more economical and smaller. There are only 2 pins (except voltage) : pin 9 which is PWM, it could be physical pin 5 or 6 on Attiny and pin 2 (serial communication to sensor), this could be physical pin 2 or 3 on Attiny. What do you think?


1 year ago

Help! I am new to the Arduino world and although I have managed to install the Dallas Temperature Library into the Arduino IDE (I see it when I search the library) I am not sure what to do with the PWM_Temperature.ino file. I have downloaded and saved the file and I can open it but when I try and compile it I get the following error message:

Arduino: 1.6.13 (Mac OS X), Board: "Arduino/Genuino Uno"

/Users/donaldphilbin/Downloads/FZV04A0J0COTWWW/FZV04A0J0COTWWW.ino:1:21: fatal error: OneWire.h: No such file or directory

#include <OneWire.h>


compilation terminated.

exit status 1

Error compiling for board Arduino/Genuino Uno.

This report would have more information with

"Show verbose output during compilation"

option enabled in File -> Preferences.



2 years ago

Hi, great project. I made this one and it works perfectly. Just what I was looking for. One question: is it possible to expand to 3 analog meters and ofcource 3 tempsensors, but using only one Arduino? As a novice to Arduino, I would apreciate some input on this issue!

Thank you for the instructable!


2 years ago

Hi, Thanks for sharing this Instructable. I am pretty new to Arduino. Is there a way to get this to display temp in degrees F??

2 replies
paolo marinelobakichmg

Reply 2 years ago

Hi !

No need to change the code, you have just to switch the value on the panel meter face from °C to °F. (°F = °C x 1,8 +32)

Or use a online converter.

bakichmgpaolo marinelo

Reply 2 years ago

Thanks for the reply. I am going to try this project out.


2 years ago

Hi educ8s,

This is a nice build and I really enjoy the look of these old fashioned displays. However, from a technical perspective, while your display appears to look like an analog signal, it is still a digital signal that you display on it. Which means that you have a specific amount of temperature steps that you are showing and not a true analog sliding display. In my eyes the looks of your build are much nicer than a 7-segment display so I might use the same strategy you are using in some of my future builds. Thanks for posting.