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 ▶ http://bit.ly/2kxEwgy

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 ▶ http://bit.ly/AnalogVoltmeter

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: https://github.com/milesburton/Arduino-Temperature-Control-Library

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 ▶ http://educ8s.tv/arduino-analog-thermometer

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!

<p>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!</p><p>Thank you for the instructable!</p>
<p>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??</p>
<p>Hi !</p><p>No need to change the code, you have just to switch the value on the panel meter face from &deg;C to &deg;F. (&deg;F = &deg;C x 1,8 +32)</p><p>Or use a online converter.</p>
<p>Thanks for the reply. I am going to try this project out.</p>
<p>Excellent project. Thanks for sharing.</p><p>Have a look at MeterBasic. This little program will help you to create a new faceplate for the meter in a couple of minutes.</p><p>http://www.tonnesoftware.com/meterbasicdownload.html</p>
<p> Hi educ8s, </p><p>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.</p>