Dear friends welcome to another Arduino project
video!
Today we are going to modify this analog Voltmeter
and convert into an Analog Thermometer using
Arduino and a DS18B20 temperature sensor.
Without any further delay, let’s get started!
Hello guys, I am Nick and welcome to educ8s.tv
a channel that is all about DIY electronics
projects with Arduino, Raspberry Pi, ESP8266
and other popular boards.
You can subscribe to our channel by clicking
on this button.
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.
Let’s now see how to achieve that result.
The parts that we are going to need today
are the following:
• An Arduino Uno
• A DS18B20 temperature sensor
• A DC analog voltmeter with a range from
0 to 5V
• Some wires
The cost of the project is around $9.
You can find link for all the parts I use
in the description of the video below.
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!
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 the description of the video.
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!
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.
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 these variables.
The smaller the gap between these two values,
the bigger the resolution the panel meter
will offer.
As always the code of the project can be found
in a link, in the description of the video.
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
the video if you find it interesting.
Thanks!
If you are new to the channel, I would love
to have subscribed by clicking on the channel
icon here, because every Saturday I post a
new video about DIY electronics and robot
projects.
I hope you will join our community.
Until next Saturday, watch, learn, build!
[ Translating these subtitles? Add your name here! ]
