loading

Hello, all !!

This is my project of a digital clock with RTC (Real Time Clock) using a LED display of 04 digits and 07 segments including features of temperature and humidity.

To control the display I have used an Arduino Uno and 02 chips 74HC595 (8 bit shift register with output latches).

There are two modules: one for the sensor of temperature (ºC - Celsius / ºF - Fahrenheit degrees) and humidity (% - in percentage) and another module for the RTC.

The assembly is very simple but you need take care with the wiring.

Be patient, follow the schematics and enjoy it.

(See VIDEO)

Step 1: Material

Material list:

- 01 x DS1307 (Real Time Clock)

- 01 x DHT11 (Temperature and Humidity sensor)

- 02 x 74HC595 (8 bit shift register with output latches - 3 state)

- 08 x Resistors of 150 Ohms (Brown, Green, Brown)

- 01 x FYQ-5642BX (Common Anode LED Display 04 digits and 07 segments or equivalent but take care with the pins numbers)

- 01 x Arduino Uno

- 01 x Breadboard

- 01 x Kit of jumpers

Step 2: Assembly

The assembly of components is very easy but you need to follow the schematics with care about the wiring connections.

If you want to use another LED display, check the datasheet to update the output wiring (jumpers) of 74HC595.

Step 3: Programming

To run the program on Arduino you need to have the following libraries:

  1. Time (library for date & time)
  2. DS130RTC(library for the Real Time Clock)
  3. Wire (library used to support the RTC)
  4. dhtt11 (library for the sensor of Temperature and Humidity)

For the numbering (0 to 9), I have created a table with binary representation of each segment (A to G) that forms the digit as following:

  • B01111110 - 0
  • B00110000 - 1
  • B01101101 - 2
  • B01111001 - 3
  • B00110011 - 4
  • B01011011 - 5
  • B01011111 - 6
  • B01110000 - 7
  • B01111111 - 8
  • B01111011 - 9

To show in the LED display the data in sequence of time, temperature and humidity, I have used a "timer" with functions millis() and while().

In this case, each information is presented on the display and after 3 seconds moves to the next one.

Simple and very efficient.

You can apply this function millis() in several different ways to manage the time during the program running.

In many situations you can use it in the place of some timer library.

Another usefull function is digitalWrite(). With this function you can simplify the writting of data into the shift registers.

Take a look on it in the Arduino's home page at http://arduino.cc/en/Reference/DigitalWrite

- How to setup the time of internal clock of RTC module:

1 - To update or setup the time of RTC module, load the program "SetTime" that you can find here or in the library/example of DS1307RTC on Arduino Software.

2 - Recompile and reload the program of Digital_Clock on Arduino.

With this procedure, the RTC module will keep the right time due its battery pack attached and you do not need to recompile the Digital_Clock program every time you turn it on.

Step 4: Conclusion

The main lesson for me in this project is related to the logic to manage the display (data multiplexing) using shift registers and also the combination of different sensors in same application.

I hope you have enjoyed this project where I also had the opportunity to contribute to you with a little bit more information about Arduino programming.

Best regards.

LAGSILVA

March 22, 2015

(Last update: 10.Feb.2016)

<p>Display CC (FYQ-5642AX/)?</p>
<p>Hello,</p><p>Sorry for my delay to answer you and thank you for your question. <br></p><p>This information was missing and I will update it on Instructables.</p><p>The display is CA as you can see in the image below.</p><p>The code number of display is just for reference but you can use another similar one.</p><p>Regards,</p><p>Lu&iacute;s Antonio</p>
<p>Great work! I built my own version in an hour and your code worked perfectly.</p><p>I have one small issue though. I'm using two 2-digit displays instead of one 4-digit, so I don't have the central dots between hour and minute. Instead, a single decimal point lights for the second digit. I guess this is set by this part of the code:</p><p>shiftOut(dataPin, clockPin, LSBFIRST, ~B10000000); //Set LEDs of double dots</p><p>Is there any way to also make the decimal point for digit to also light at this time? That way I can rotate my second 2-digit display by 180 degrees to recreate the double dots.</p>
<p>Grrrmachine,</p><p>Thank you very much!!</p><p>Please, post a photo of your project here.</p><p>If your display are with the LEDs not inclined some degrees, I think it is feasible to put one of them upside down. If not, the result could be a little bit strange due to the different angles of inclination of both displays when you rotate one of them by 180 degrees.</p><p>The logic of sequence to control the LED of the displays of my project is:</p><p><strong>Dot - A - B - C - D - E - F - G</strong></p><p>For your project you must consider the transfer function for the 2nd. display:</p><p><strong>Dot - E - F - G - A - B - C - D</strong></p><p>I see you have two ways to apply this logic:</p><p>1) Change wire connection of 2nd display according with 2nd sequence.</p><p>2) Create a second <strong>byte num2[ ] </strong>with new sequence to be applied in the 2nd display and update the code (in this case you can mantain same wiring connection of original project).</p><p>//Digits Matrix - 0 to 9 - <strong style="">For 1ST. Display</strong></p><p>byte <strong>num1</strong>[] = {</p><p> B01111110, // Zero</p><p> B00110000, // One</p><p> B01101101, // Two</p><p> B01111001, // Three</p><p> B00110011, // Four</p><p> B01011011, // Five</p><p> B01011111, // Six</p><p> B01110000, // Seven</p><p> B01111111, // Eight</p><p> B01111011, // Nine</p><p>};</p><p>//Digits Matrix - 0 to 9 - <strong>For 2ND. Display</strong></p><p>byte <strong>num2</strong>[] = {</p><p>B01101111, // </p><p>B00000110, // </p><p>B01011101, // </p><p>B00011111, // </p><p>B00110110, // </p><p>B00111011, // </p><p>B01111011, // </p><p>B00001110, // </p><p>B01111111, // </p><p>B00111111, // </p><p>};</p><p>Good luck and keep me posted on your progress!</p><p>Regards,</p><p>LAGSILVA</p><table><br> </table>
<p>Sir Lagsilva i have a question, can i not include the sensor temperature and humidity sensor?.... Will it affect the circuit or not?.. Thank you</p>
<p>Hello, Ed Marsjosef,</p><p>I am understanding you want only the clock function running, without the temperature and humidity information been displayed.</p><p>Yes, you can delete the sensor and the circuit will be not affected.</p><p>Without the sensor, the code will consider as 0 (zero) the values of temperature and humidity.</p><p>Regards,</p><p>LAGSILVA</p>
<p>Thank you sir</p>
<p>Hi Lagsilva, </p><p>I really enjoy your projects and can tell you are a real enthusiast by the way you respond to fellow builders especially beginners like myself! I'll be following your builds with interest. You have a real talent for explaining things and should do some full build videos which I'm sure would be popular! Keep the projects coming! </p><p>Davy</p>
<p>Hello, Davy,</p><p>Thank you very much for your feedback!</p><p>I am not a specialist, I am really an enthusiast of this technology that help us to learn more, to be curious, to be inventive, to be better than yesterday!</p><p>Everyone is a beginner in something because we do not know everything. </p><p>But we can learn!! All the time!</p><p>Regards,</p><p>Lu&iacute;s</p>
It's your enthusiasm that shines through! Keep it up! ;-)<br>
<p>Hello.</p><p>Thank you so mutch for a great idea. :-)<br>Bought the parts yesterday, and assembled today.</p><p>BUT, i get this errorcode trying to verify the script. </p><p>Could you help?</p><p>______________________</p><p>In file included from C:\Users\arnes\Downloads\Digital_Clock_V1_English\Digital_Clock_V1_English.ino:13:0:</p><p>C:\Users\arnes\Documents\Arduino\libraries\DS1307RTC/DS1307RTC.h:19:22: error: 'tmElements_t' has not been declared</p><p>static bool read(tmElements_t &amp;tm);</p><p>^</p><p>C:\Users\arnes\Documents\Arduino\libraries\DS1307RTC/DS1307RTC.h:20:23: error: 'tmElements_t' has not been declared</p><p>static bool write(tmElements_t &amp;tm);</p><p>^</p><p>Digital_Clock_V1_English:16: error: 'dht11' does not name a type</p><p>dht11 DHT; //Define the name DHT for the sensor of Temperature and Humidity</p><p>^</p><p>C:\Users\arnes\Downloads\Digital_Clock_V1_English\Digital_Clock_V1_English.ino: In function 'void setup()':</p><p>Digital_Clock_V1_English:50: error: 'setSyncProvider' was not declared in this scope</p><p>setSyncProvider(RTC.get); // Update the time with data of RTC (Real Time Clock)</p><p>^</p><p>C:\Users\arnes\Downloads\Digital_Clock_V1_English\Digital_Clock_V1_English.ino: In function 'void loop()':</p><p>Digital_Clock_V1_English:63: error: 'hour' was not declared in this scope</p><p>hora = hour();</p><p>^</p><p>Digital_Clock_V1_English:64: error: 'minute' was not declared in this scope</p><p>minuto = minute();</p><p>^</p><p>C:\Users\arnes\Downloads\Digital_Clock_V1_English\Digital_Clock_V1_English.ino:92:53: warning: large integer implicitly truncated to unsigned type [-Woverflow]</p><p>shiftOut(dataPin, clockPin, LSBFIRST, ~B10000000); //Set LEDs of double dots</p><p>^</p><p>Digital_Clock_V1_English:102: error: 'DHT' was not declared in this scope</p><p>chk = DHT.read(DHT11_PIN); //Read data of sensor DHT11</p><p>^</p><p>exit status 1</p><p>'dht11' does not name a type</p>
<p>Hello, Veigrillen,</p><p>Thank you !! I hope you have success with this project.</p><p>It sounds me there is some missing library.</p><p>Did you install the following libraries into your Arduino folder ?</p><ol><br><li>Time (library for date &amp; time)<li>DS130RTC (library for the Real Time Clock)<li>Wire (library used to support the RTC)<li>dhtt11 (library for the sensor of Temperature and Humidity)</ol><p>If you have done that, please try the following:</p><p>1) Download again the file &quot;Digital_Clock_V1_English.ino&quot;.</p><p>2) Open it on a word editor (WordPad, for example) and copy all the text.</p><p>3) Create a new file on Arduino Software.</p><p>4) Clean all the statements of new file and paste the text you have cop&iacute;ed on item #2.</p><p>5) Recompile the program and inform me the results.</p><p>Good luck!!</p>
<p>Thank you so mutch. :)<br>I finally got rid of the error codes, but encountered another problem.</p><p>I got the wrong RTC module. I got an DS3231N, and not the DS1307, so im not able to complete the &quot;mission. </p><p>Unless there is an easy workaround?</p><p>Thanks again.</p>
<p>Good news, Veigrillen !!</p><p>I do not see any issue if you use the DS3231 RTC. </p><p>Both modules use I2C bus and you can apply same library.</p><p>In fact the DS3231 is much more accurate than DS1307 !!</p><p>Just take care with corresponding connections SDA, SCL, Vcc and GND.</p><p>Take a look on this tutorial:</p><p><a href="http://tronixstuff.com/2014/12/01/tutorial-using-ds1307-and-ds3231-real-time-clock-modules-with-arduino/">http://tronixstuff.com/2014/12/01/tutorial-using-d...</a></p><p>Let me know about your tests.</p>
<p>Well, i got everything uploaded, and my led lights up, but i recon theres something wrong.. :)</p><p><a href="https://youtu.be/FXtVAHPSeSc" rel="nofollow">https://youtu.be/FXtVAHPSeSc</a></p>
<p>Hello, Veigrillen,</p><p>Any progress ?</p><p>Did you revise the connections and find out what is the issue ?</p>
<p>Uhm,, im a complete newbie, and didnt know that i could just reverse the connectors, so I just ordered a new led display with Common Anode. (They havnt arrived yet)</p><p>I feel kinda stupid now ;-)</p><p>Do you know if there is a &quot;walkthroug&quot; to reverse them?</p><p>Right now i got an SMA420564 display</p><p>Thanks in advance </p>
<p>Yes, it is possible to use a Common Cathode display, but you need to update all instructions of the program.</p><p>With right programming, you can control this hardware as you want!</p><p>For example, the following statements to set the Display #1 must be updated.</p><p><strong>From:</strong></p><p>digitalWrite(latchPin, LOW);</p><p> shiftOut(dataPin, clockPin, LSBFIRST, 8); //Set DISPLAY 1 </p><p> shiftOut(dataPin, clockPin, LSBFIRST, <strong>~</strong>num[dezenaHora]); //Set the Hour </p><p> digitalWrite(latchPin, HIGH);</p><p><strong>To:</strong></p><p>digitalWrite(latchPin, LOW);</p><p>shiftOut(dataPin, clockPin, LSBFIRST, <strong>~</strong>8); //Set DISPLAY 1 </p><p>shiftOut(dataPin, clockPin, LSBFIRST, num[dezenaHora]); //Set the Hour </p><p>digitalWrite(latchPin, HIGH);</p><p>The sign <strong>~ </strong>inverts the signal from HIGH to LOW or vice versa.</p><p>Try to update all statements related to setup of the digits of display.</p>
<p>Hi buddy, and thanks for taking the time to help me.</p><p>Your last post really helped, and Im almost there..</p><p>Three of the four digits are working almost perfect, </p><p>As you can se of the video, there are some issues, and i'we gone over the connectors and cables, and all seem to be correct.</p><p><a href="https://youtu.be/6ZX0xNYYdic" rel="nofollow">https://youtu.be/6ZX0xNYYdic</a></p><p>Here is the code that i'we used:</p><p>/* Digital Clock</p><p> Digital Clock with LED Display - 4 Digits x 7 Segments</p><p> Display Time, Temperature and Relative Humidity</p><p> V1.1 - 10.Fev.2016</p><p> *** Notes of revision V1.1 *** </p><p> - Translated the remarks/comments into English</p><p> - Added optional statements to show the Temperature in Fahrenheit Degrees (&ordm;F)</p><p>*/</p><p>#include &lt;Time.h&gt; //Time Library</p><p>#include &lt;DS1307RTC.h&gt; //Real Time Clock Library</p><p>#include &lt;Wire.h&gt; //Auxiliary Library for DS1307RTC (Real-Time Clock) - Pins to Arduino UNO: A4 (SDA), A5 (SCL)</p><p>#include &lt;dht11.h&gt; //Temperature and Humidity Library</p><p>dht11 DHT; //Define the name DHT for the sensor of Temperature and Humidity</p><p>#define DHT11_PIN 11 //Sensor DHT11 conected to the pin 11 on Arduino</p><p>int clockPin = 8; // Pin 8 of Arduino connected in the pin 11 of 74HC595 (Clock)</p><p>int latchPin = 9; // Pin 9 of Arduino connected in the pin 12 of 74HC595 (Latch)</p><p>int dataPin = 10; // Pin 10 of Arduino connected in the pin 14 of 74HC595 (Data)</p><p>int hora, minuto, temp, umid;</p><p>int unidadeHora, unidadeMinuto, dezenaHora, dezenaMinuto;</p><p>int unidadeTemp, dezenaTemp, unidadeUmid, dezenaUmid;</p><p>unsigned long ti;</p><p>int chk; //Variable to read the sensor DHT11</p><p>//Digits Matrix - 0 a 9</p><p>byte num[] = {</p><p> B01111110, // Zero</p><p> B00110000, // One</p><p> B01101101, // Two</p><p> B01111001, // Three</p><p> B00110011, // Four</p><p> B01011011, // Five</p><p> B01011111, // Six</p><p> B01110000, // Seven</p><p> B01111111, // Eight</p><p> B01111011, // Nine</p><p>};</p><p>void setup() {</p><p> pinMode(latchPin, OUTPUT); // Define the 3 digital pins as output</p><p> pinMode(clockPin, OUTPUT);</p><p> pinMode(dataPin, OUTPUT);</p><p> setSyncProvider(RTC.get); // Update the time with data of RTC (Real Time Clock)</p><p> //setTime(15, 05, 00, 13, 02, 2016);</p><p>}</p><p>void loop() {</p><p> ti = millis(); // Initial time for the Timer of Hour/Time</p><p> while ((millis() - ti) &lt; 3000) { //Timer of 3 seconds to show the Hour</p><p> hora = hour();</p><p> minuto = minute();</p><p> unidadeHora = hora % 10;</p><p> dezenaHora = hora / 10;</p><p> unidadeMinuto = minuto % 10;</p><p> dezenaMinuto = minuto / 10;</p><p> digitalWrite(latchPin, LOW);</p><p> shiftOut(dataPin, clockPin, LSBFIRST, ~8); //Set DISPLAY 1 (top view from left to right)</p><p> shiftOut(dataPin, clockPin, LSBFIRST, num[dezenaHora]); //Set the Hour (ten)</p><p> digitalWrite(latchPin, HIGH);</p><p> digitalWrite(latchPin, LOW);</p><p> shiftOut(dataPin, clockPin, LSBFIRST, ~4); //Set DISPLAY 2</p><p> shiftOut(dataPin, clockPin, LSBFIRST, num[unidadeHora]); //Set the Hour (unit)</p><p> digitalWrite(latchPin, HIGH);</p><p> digitalWrite(latchPin, LOW);</p><p> shiftOut(dataPin, clockPin, LSBFIRST, ~2); //Set DISPLAY 3</p><p> shiftOut(dataPin, clockPin, LSBFIRST, num[dezenaMinuto]); //Set the Minute (ten)</p><p> digitalWrite(latchPin, HIGH);</p><p> digitalWrite(latchPin, LOW);</p><p> shiftOut(dataPin, clockPin, LSBFIRST, ~1); //Set DISPLAY 4</p><p> shiftOut(dataPin, clockPin, LSBFIRST, num[unidadeMinuto]); //Set the Minute (unit)</p><p> digitalWrite(latchPin, HIGH);</p><p> digitalWrite(latchPin, LOW);</p><p> shiftOut(dataPin, clockPin, LSBFIRST, ~4); //Set LED of dots</p><p> shiftOut(dataPin, clockPin, LSBFIRST, B10000000); //Set LEDs of double dots</p><p> digitalWrite(latchPin, HIGH);</p><p> digitalWrite(latchPin, LOW);</p><p> shiftOut(dataPin, clockPin, LSBFIRST, ~1); //Set DISPLAY 4</p><p> shiftOut(dataPin, clockPin, LSBFIRST, 255); //Reset the DISPLAY 4 (to avoid some flicking)</p><p> digitalWrite(latchPin, HIGH);</p><p> }</p><p> delay(500); //Wait for half second before go ahead to show the next feature</p><p> chk = DHT.read(DHT11_PIN); //Read data of sensor DHT11</p><p> ti = millis(); //Initial time for the Timer of Temperature</p><p> temp = DHT.temperature; //Reading the Temperature in Celsius degree (&ordm;C)</p><p> //Optional calculation of Temperature in Fahrenheit degrees (&ordm;F). Remove the comments (&quot;//&quot;) of following statement to use it.</p><p> //temp = (temp*18+5)/10+32; </p><p> while ((millis() - ti) &lt; 3000) { //Timer of 3 seconds for the Temperature</p><p> unidadeTemp = temp % 10;</p><p> dezenaTemp = temp / 10;</p><p> digitalWrite(latchPin, LOW);</p><p> shiftOut(dataPin, clockPin, LSBFIRST, ~8); //Set DISPLAY 1 (top view from left to right)</p><p> shiftOut(dataPin, clockPin, LSBFIRST, num[dezenaTemp]); //Set the Temperature (ten)</p><p> digitalWrite(latchPin, HIGH);</p><p> digitalWrite(latchPin, LOW);</p><p> shiftOut(dataPin, clockPin, LSBFIRST, ~4); //Set DISPLAY 2</p><p> shiftOut(dataPin, clockPin, LSBFIRST, num[unidadeTemp]); //Set the Temperature (unit)</p><p> digitalWrite(latchPin, HIGH);</p><p> digitalWrite(latchPin, LOW);</p><p> shiftOut(dataPin, clockPin, LSBFIRST, ~2); //Set DISPLAY 3</p><p> shiftOut(dataPin, clockPin, LSBFIRST, B01100011); //Set the degree symbol [&ordm;]</p><p> digitalWrite(latchPin, HIGH);</p><p> //Show the Temperature in Celsius degrees (&ordm;C)</p><p> //Set the following statements as comments with &quot;//&quot; to show the Temperature in Fahrenheit (&ordm;F)</p><p> digitalWrite(latchPin, LOW);</p><p> shiftOut(dataPin, clockPin, LSBFIRST, ~1); //Set DISPLAY 4</p><p> shiftOut(dataPin, clockPin, LSBFIRST, B01001110); //Set the symbol of Celsius [C]</p><p> digitalWrite(latchPin, HIGH);</p><p> //Show the Temperature in Fahrenheit degrees (&ordm;F)</p><p> //Remove the indication of comments &quot;//&quot; on following statements to show the Temperature in Fahrenheit (&ordm;F) </p><p> //digitalWrite(latchPin, LOW);</p><p> //shiftOut(dataPin, clockPin, LSBFIRST, 1); //Set DISPLAY 4</p><p> //shiftOut(dataPin, clockPin, LSBFIRST, ~B01000111); //Set the symbol of Fahrenheit [F]</p><p> //digitalWrite(latchPin, HIGH);</p><p> digitalWrite(latchPin, LOW);</p><p> shiftOut(dataPin, clockPin, LSBFIRST, ~1); //Set DISPLAY 4</p><p> shiftOut(dataPin, clockPin, LSBFIRST, 255); //Reset the DISPLAY 4 (to avoid some flicking)</p><p> digitalWrite(latchPin, HIGH);</p><p> }</p><p> delay(500); //Wait for half second before go ahead to show the next feature</p><p> ti = millis(); //Initial time for the Timer of Humidity</p><p> umid = DHT.humidity; //Reading the Humidity</p><p> while ((millis() - ti) &lt; 3000) { //Timer of 3 seconds for the Humidity</p><p> unidadeUmid = umid % 10;</p><p> dezenaUmid = umid / 10;</p><p> digitalWrite(latchPin, LOW);</p><p> shiftOut(dataPin, clockPin, LSBFIRST, ~8); //Set DISPLAY 1</p><p> shiftOut(dataPin, clockPin, LSBFIRST, num[dezenaUmid]); //Set the Humidity (ten)</p><p> digitalWrite(latchPin, HIGH);</p><p> digitalWrite(latchPin, LOW);</p><p> shiftOut(dataPin, clockPin, LSBFIRST, ~4); //Set DISPLAY 2</p><p> shiftOut(dataPin, clockPin, LSBFIRST, num[unidadeUmid]); //Set the Humidity (unit)</p><p> digitalWrite(latchPin, HIGH);</p><p> digitalWrite(latchPin, LOW);</p><p> shiftOut(dataPin, clockPin, LSBFIRST, ~2); //Set DISPLAY 3</p><p> shiftOut(dataPin, clockPin, LSBFIRST, B01100011); //Set the upper symbol of percentage [%] of Humidity</p><p> digitalWrite(latchPin, HIGH);</p><p> digitalWrite(latchPin, LOW);</p><p> shiftOut(dataPin, clockPin, LSBFIRST, ~1); //Set DISPLAY 4</p><p> shiftOut(dataPin, clockPin, LSBFIRST, B00011101); //Set the lower symbol of percentage [%] of Humidity</p><p> digitalWrite(latchPin, HIGH);</p><p> digitalWrite(latchPin, LOW);</p><p> shiftOut(dataPin, clockPin, LSBFIRST, ~1); //Set Display 4</p><p> shiftOut(dataPin, clockPin, LSBFIRST, 255); //Reset the DISPLAY 4 (to avoid some flicking)</p><p> digitalWrite(latchPin, HIGH);</p><p> }</p><p> delay(500); //Wait for half second before to restart</p><p>}</p>
<p>Great progress!!! I am really happy with that!!</p><p>Please, update the following statement for all these instances in the program:</p><p>.........</p><p>shiftOut(dataPin, clockPin, LSBFIRST, <strong>~255</strong>); //Reset the DISPLAY 4 (to avoid some flicking)</p><p>.........</p><p>In fact, ~255 means 0 (zero). You can replace by this if you prefer!</p><p>I think it will work this time ! :)</p>
<p>Don't worry!</p><p>You are almost there! :-)</p><p>You need use a <strong>Common Anode</strong> LED display.</p><p>Please, confirm this information and check again the wiring connections.</p>
<p>Veigrillen,</p><p>Just another remind. </p><p>Take a look at your module specification if the Vcc is 5V or 3.3V to avoid any problem when you connect it on Arduino.</p>
<p>where can I found dht11 library</p>
<p>Download of <strong>dht11 </strong>library:</p><p><a href="https://github.com/adalton/arduino/blob/master/projects/Dht11_Library/Dht11.cpp">https://github.com/adalton/arduino/blob/master/pro...</a></p>
<p>If i use 2 separate 4 digit 7 segment displays how can i change change the connections and program. Please guide me.</p>
<p>Akilal,</p><p>You must use two additional 74HC595 (shift registers IC) in cascade and also the corresponding resistors. </p><p>Each shift register output #9 must be connected to the serial data input #14 of next IC.</p><p>The program must be updated to manage the data in the right sequence to control the segments of displays.</p><p>Remember that you are transferring serial data to paralell output.</p><p>An easier way is to use a display of 8 digits x 7 segments as I did in my stopwatch project:</p><p><a href="https://www.instructables.com/id/Stopwatch-Lap-Time-With-Arduino-Nano-and-Maxi-7219/">https://www.instructables.com/id/Stopwatch-Lap-Time...</a></p>
thank you very much for your reply. In my case im using 02 numbers of 4 digit 7 segment displays. My requirement is to display separately time &amp; date together and Temp&amp; hum. together. So that i will try as you said before. Is there any change required for program i mean sketch?
<p>First attempt, and thumb up for me :-). Thank you sir for this project. 7 segment display is LG5643DH.</p>
<p>Great job!! Congrats and thank you !!</p>
<p>Greetings, and thank you so much for your work on this project. What I am trying to do, is something very simular, however I have obtained a small LED 7 seg display with a 4 pin input made by Catalex. the pins are clk - DIO - VCC and GND. I currently have it running it's demo clock program, but what I wish to do is to hook it up through a real time clock module on my Arduino Uno, to go in a project box that will hold my clock and electronic compass for our Motorhome while we explore our nation. It will also hold an altimeter so I can keep track of the altitude and Barometer. Any thoughts on how I could use this little device with your project?</p>
<p>sorry sir, can you help me to write the program in english , </p>
<p>Hello Fitri Pujir,</p><p>Today I have translated to English the comments of Digital_Clock program and I have added too some statements to show the Temperature in Fahrenheit degrees (&ordm;F) as an optional feature.</p><p>Thank you for your request. We always can improve something !</p><p>I hope you enjoy it !</p><p>Best regards,</p><p>LAGSILVA</p>
<p>Are you talking about the comments in the program ?</p>
<p>i tried to assemble your project multiple times with the YSD-439AB4B-35 7segment but it simply does not work....</p>
<p>Hello Vags,</p><p>According with the Datasheet of YSD-439AB4B-35 the pin numbers are completely different of the display I have applied in my project.</p><p>Please, check the differences and set the correponding pin numbers according with my display.</p><p>For example: Pin 11 = Pin 14 (in your display) / Pin 12 = Pin 1 ....</p><p>Please try this solution and tell me the results.</p>
<p>Hi<a href="https://www.instructables.com/member/lagsilva" rel="nofollow">lagsilva</a><br> </p><p>thank you for your time.</p><p> Yes i have tried the pins from the datasheet many times but still nothing... </p>
<p>Hi :D<br>Ive been working on a similar display. Im using the sparkfun display (only mine is red, not blue), and Im using 2 shift registers similar to the way this is set up. <br>Mine uses the first 4 (q0-q3) pins of the second shift register for the digit pins instead of the last 4 (q4-q7) though.<br>Mine is not working yet with the Digital_Clock_V1 program, but I do have it working with another program that uses the shift registers using LSB, and this is my number map.</p><p>// My segment bits, turn low (0) to light a segment<br>// ABCDEFGDP<br> B00000011, // 0<br> B10011111, // 1<br> B00100101, // 2<br> B00001101, // 3<br> B10011001, // 4<br> B01001001, // 5<br> B01000001, // 6<br> B00011111, // 7<br> B00000001, // 8<br> B00011001, // 9<br><br>Im trying to modify this code to work with my setup, its not exactly the same as his though, and the program isnt working right yet with my number map.</p>
<p>Hi, HippyNerd,</p><p>Considering you are using a Common Anode Display and the first (q0-q3) with LSBFIRST, um must set the following for each digit:</p><p>- Digit 1 (from left to right on your display): </p><p>shiftOut(dataPin, clockPin, LSBFIRST, 128); //Set LED 1</p><p>- Digit 2 (from left to right on display): </p><p>shiftOut(dataPin, clockPin, LSBFIRST, 64); //Set LED 2</p><p>- Digit 3 (from left to right on display): </p><p>shiftOut(dataPin, clockPin, LSBFIRST, 32); //Set LED 3</p><p>- Digit 4 (from left to right on display): </p><p>shiftOut(dataPin, clockPin, LSBFIRST, 16); //Set LED 4</p><p>And due the fact you are using the segment map with inverted logic from mine, please change the following:</p><p>From: shiftOut(dataPin, clockPin, LSBFIRST, ~num[dezenaHora]); //Show our (ten)</p><p>To: shiftOut(dataPin, clockPin, LSBFIRST, num[dezenaHora]); //Show our (ten)</p><p>Note that the command &quot;~&quot; is to invert each bit from &quot;0&quot; to &quot;1&quot;.</p><p>Finally, update all statements related to shift register as shown below as example:</p><p>...</p><p>digitalWrite(latchPin, LOW);</p><p> shiftOut(dataPin, clockPin, LSBFIRST, 128); //Set LED 1</p><p> shiftOut(dataPin, clockPin, LSBFIRST, num[dezenaHora]); //Show our (ten)</p><p> digitalWrite(latchPin, HIGH);</p><p>digitalWrite(latchPin, LOW);</p><p> shiftOut(dataPin, clockPin, LSBFIRST, 64); //Set LED 2</p><p> shiftOut(dataPin, clockPin, LSBFIRST, num[unidadeHora]); //Show the hour (unit)</p><p> digitalWrite(latchPin, HIGH);</p><p>...</p><p>Best regards,</p><p>lagsilva</p>
<p>Hi lagsilva,<br>I worked on converting your code most of yesterday, and its still not working for me. I figured out the digit pins, and changed them (just exactly the way you did), and I even tried binary (B10000000 instead of 128, ...) <br>I found the tilde (~), and didnt know what they did, so I removed them, thanks for explaining those, thats a neat trick that I will probably use sometime.<br>I spent a lot of time with google translate to help read your comments, but sometimes it didnt make sense. <br>I commented out the sections for temp and humidity since I dont have that hardware, but that didnt change anything.<br>Im still confused why I cant get your code working though. Even though they hardware is not exactly the same, they are very close to the same, and should be easy to convert.<br>I have 2 very simple display test programs one does MSBFIRST, the other does LSBFIRST. I prefer LSB because the data is easier for me to read.<br>Maybe I will start over with your program, now that I understand about the ~, and leave that part alone (except for moving the DP bit to q7. <br>Can I send you my modified code to look at and try?</p>
<p>Hi HippyNerd,</p><p>Please, send me a message with your code to take a look.</p><p>Probably is some small detail.</p>
<p>Hello Vags,</p><p>Thanks for your review and comments ! </p><p>You are the first person talking about some issue and you are right!</p><p>My apologies because I did a mistake in the schematics and I will update the documentation of this project.</p><p>It was missing a wiring connection between pin #10 of 74HC595 (first one / left side) and the positive +5V (see picture bellow). </p>
<p>better if the added push switch on in order to control the hours and minutes</p>

About This Instructable

28,287views

56favorites

License:

Bio: I am a Mechanical Engineer and an enthusiastic Maker. I like to develop new ideas combining electronics and programming.
More by lagsilva:Talking Clock with Arduino Stopwatch with Lap Time Counter Tri-Mode Digital Clock with ATtiny85 / UNO R3 and RTC 
Add instructable to: