Hi, welcome to Arduino tutorial from Robojax. this video we are going to
learn how we can use this dual digits LED display with decimal points with Arduino. you can get the
code for this by clicking at the link below the video in the description which
will take you to the www.robojax.com/learn/arduino
let's get started with this.
My name is Ahmad Shamshiri and I am presenting this tutorial from Canada.
this is the first time that we see module is available with two-digit
display with decimal points and simple connectivity for Arduino. finally this is based on
74HC595 shift register. and two digits have been arranged and the module
something like this when you buy it. there will be no pins attached to it.
sample there are two surface mount devices all the LEDs have been arranged
with the bias with their resistors so you don't have to worry about the resistor.
you all the pins label label here and as you can see you can cascade it also if
you have other they just attach to this but for now this too will be enough
because we have 4 digits and 8 digit display already available.
this two digits has its own application. in many cases you will need it to.just
display digits between 0 to 99. You don't have to worry about the display if it is common cathode or
common anode because it already been arranged. The power supply, it
works with 5 volts. and you need to connect 3 ping that is required for this
74HC595 data, clock and latch which changes the state of the movement of
data to move from one digit to the other one. the digits are here 0.5 inch. the
length of the module is 1.5 inch or 38.1 millimeters the width is 25.8mm
or 1.01 inch. the depth is 0.58 inch
or 12.2 millimeters. so the pins have have been labeled VCC ground SDI
and SEL K which is clock and then LOAD. this is the input. They put also an arrow
and also p1 and this arrow shows you can continue the other way for example if
this was your first one and if you want to connect the next one you can wire
The code and library I provided is not handling 3 digits. You can use it for 2 digits for now.
the code that I'm providing will work only with two digits in the future I
might update the code so it can work with multiple digits. but there is no
need for it as we are really have four digit display which I have separate
video lecture on (TM1637) those the link will be below this video.
Wiring Explained
wiring diagram for this project is available as part of my Arduino Course at udemy.com
the link to my Arduino course is below this video.
now let me explain the wiring. the this pin connected to 5 volts of Arduino
here at this point gray is a ground it has been connected to this pin of
Arduino. we have DATA CLOCK and LOAD pins. and I've arranged them accordingly. data
is a white one connected to pin 7 CLOCK is connected to pin 6 and then LOAD
is connected to pin 5.
Arduino code explained
let me explain the code. I've taken the code from this web address that has a
lot of issues and I've cleaned it up and made it easy to be used. this is the
library you need to download the zip file
I've also fix it. Arduino IDE was not accepting it. I made some modifications
so it can work. once you download the zip file you can go to Sketch-> include
library and add dot zip library I prefer this method because I know what I'm
doing and where it is being saved rather than using my document so it's saved
in my own folder. here's let's say this is a zip file just click open and it
will be done and this is a code that that will work. the cool example that is
whether it might not work. I've modified this for this purpose we are defining
SDI pin, pin 7, clock 6 and load pin 5.digits set to 2.for now it works
only with two digits. but in the future that might you might be able to add
cascade many of these. and then we are creating an instance of that this class
and we call it SR and we pass all these four parameters here to this. Do not
change this. Change these numbers if you don't have those pins available except
the DIGITS which is 2.
and these hree and four are not available but I've just
left them from the original code this. array had some issue with digits X and
digit nine which was which was not shown properly these are each segment of the
seven segment display for example for the zero you need to turn and this is a
b c d e f and g and this is the last pin or h AG of clockwise from A to F and
then G and then it goes to DP. for zero everything will be turned on except this
pin so that is this one this is a b c d e f and then this is g because this is
common anode you need to send 0 to turn them ON for all other digits. inside
the setup we don't do anything inside the loop in order to display a number
let's say you want to display 18 just i've written this function to
make it easy show number and 18 it keeps it two seconds waiting and then i said
let me have fun from 0 to 99 this is a for loop and we put show number the same
way as this except this time i is getting 1 2 3 and every time i changes
this prints it. within 100 millisecond it prints again 2 3 up to 99 and then i
give it to second. this time i starts from 99 up to 0 and decrementing. here it
was incrementing going from 0 to 99. this goes from 99 to 0 and printing it and
then give it two seconds delay and it continuously doing the same thing. so for
your application we just use this and put your number between 0 to 99. now show
number is a function that I have written here show number and number or digit
that you pass will be here and it will be called num and this is a modulus
method you divided by 10 to get the last digit and we call it digit 2
and here this is getting the digit 1 from those two nom divided by 10 and
then modulus 10 modulus means remainder. and the remainder of this will be
the first digit and here we have numberToPrint this is a value and we pass we
get one digit and two digit from the array so digit one comes here and it
goes inside the digits array this array that is holding the say if it was two it
will pick this up and stores it as an array this area will have two values
first value second value and it goes to this source and then set all this will
print which is taken care of by a library. to display a decimal point on a
digit if you look here this last bet is to keep this off 1min of all these ones
to turn it on change it to zero if I upload the code you will see that
whenever it is 2 you will see that it will display this one point two you saw
it and then two again to here every time it is to you see that it shows the
decimal point.
Demonstration of displaying digits
and headed a close up demonstration it shows first eighteen and then we go from
0 to 99 and then we wait two seconds when it reaches 99 the first hundred
millisecond between and when it goes down I put 50 millisecond so it goes
very quick and then two seconds stops and it goes back to this number. at the
moment I've activated that decimal point this decimal point if I this was zero
and the code at the moment at the moment I've activated is a seven point
if I change this back to one and upload the code you will see that it will not
show that digit 2 with a decimal point.
I would like to thank my patrons from Patreon.com
Subtitle typed on August 22, 2020
I did my part to help you learn. Now it is your turn.
You can subscribe to my channel, thumb up 👍 the video and type a comment by saying thank you.
If you don't skip ads it will also help you .
My PayPal Account link is in the description if you want to make cash donation. Thank you
thank you for watching this for how to use to digital and segment display
with Arduino with easy code if you learned something and found this useful please
thumb up 👍 as this will help my video in a search algorithm of YouTube. if you
have comment our question please leave the comment below the video in this in
the comment section I try to answer and reply to get updates of my upcoming
videos you may subscribe now