hi welcome to an Arduino step-by-step course by Robojax
in this lecture we are going to see how we can use this mcp9808 temperature sensor to display
the temperature on this uh seven segment display based on tm1637 in a separate lecture we have
through all the specification code and explanation of this and also with another lecture we have gone
through this tm1637 smaller and larger version the value beyond the decimal point will be discarded
and we are going to round it in this video we are going directly to combine both of these to
display the temperature as you are aware that this does not have the decimal point and here
is the wiring diagram of mcp9808 temperature sensor with this four-digit tm1637 display
we have uh from the top of this one we have the clock have been connected to pen five digital data
and out dio have been connected with a pink 2.6 blue is ground have been connected to the ground
and 5 volts is green have been connected to 5 volts here from here vcc have been
connected to 3.3 volts ground have been connected using an orange wire to the ground
scl is connected to a5 and sda have been connected using a red wire to a4 this is the wiring for mcp
9808 the left wire has been connected to 3.3 volts instead of 5 volts in a previous
lecture the ground have been connected using orange to the ground
and this pen scl have been connected using red wire to a5 SDA have been connected using this
brown to a4 and here is for the led display tm1637 the top one is the clock using brown wire have
been connected to five the purple wire is the digital in-out have been connected to pen six
blue is ground have been connected to ground of Arduino
and here and green is 5 volts which have been connected to 5 volts here in Arduino
let me now explain the code for the mt-1637 with the mcp9808
we have included the math this is a library that is needed to round because the led display does
not display the decimal point so we want to use round and for round we need to include
math this is needed wire is part of ide these two are part of id this is however you have to include
it and I’ve provided you the link in the tutorial follow the instruction this is exactly the same
from here we have the start and this is the end of tm1637 this is exactly as before
this is part of the library Arduino this is you need to download this t1637
zip file library define the pen five for the clock and print sex for the digital
and out and then we use a from this class we create an instance we call it display and we
pass these two clock and digital and out as I’ve explained it before this is just creating a blank
for four digits we put 0x 0 the 0 means 0 of hexadecimal value for 4 digits we could
create 0 and we call it blank so we can use it this is the serial monitor setup and we're using
display.set brightness 0x0f we set the display brightness to maximum and here this was as
explained in the actual module it just sends this error in case if there is an issue with it
inside the loop this was exactly as before I’ve explained it and here we use display.segment
set segment blank this blank is an array above which with the zero values to it clears the screen
because the display will continuously read and then this is the method or function that I’ve
explained that gets the Celsius value which is below and then before that we use round,
round can be used this way we put open close parenthesis and you put your value and
it will round it for you and we are getting the Celsius and we are
rounding it and then using the display show number decimal to display it on the screen
and then we wait three seconds this time we use Fahrenheit with f and we wait second and the
code repeats continuously displaying Celsius and Fahrenheit I’ve also enabled and kept the
serial monitor in case if you want to play with it otherwise you can read this
this was how to use this tm1637 display with mcp9808 temperature sensor
thanks for watching please make sure to subscribe by clicking at the subscribe button
in here thank you thank you for watching tutorial from Robojax if you learned something and found
this useful please thumb up as this will help my video in the search algorithm of YouTube
if you have comment or question please post it at the comment section below
I try to answer and reply and don't forget subscribe so you get updates on my upcoming videos