loading

DS1307 Real Time Clock are widely available low cost I2C RTC modules. They come with a clock and a small battery, and when connected to Arduino, can keep track of real time even when the Arduino board is not powered. I already made Instructable on how to use them with Arduino Nano . Some of you have asked, how you can display the time with LED Display.

In this Instructable, I will show you how to connect DS1307 I2C RTC Module, and the MAX7219 controlled 7 Segment LED Display to Arduino, read and display the time, and program all this with Visuino. I will use the Tiny RTC Module that I have, but it should be very much the same with any other DS1307 Module.

Step 1: Components

  1. One Arduino compatible board (I use Arduino Nano, because I have one, but any other will be just fine)
  2. One DS1307 Real Time Clock Module (I used Tiny RTC Module but any other DS1307 Module will be just fine)
  3. One 8 digits 7 Segment Display module with MAX7219 controller (Picture 2 shows the backside of the module with the MAX7219 controller)
  4. One small Breadboard (Any breadboard can be used, or any other way to connect 3 wires together)
  5. 3 Female-Male jumper wires
  6. 7 Female-Female jumper wires

Step 2: Connect the Real Time Clock to Arduino

  1. Connect the Female end of a Female-Male5V VCC Power(Red wire) to the DS1307 RTC Module (Picture 1)
  2. Connect Female-Female wires - Ground(Black wire), SCL(Orange wire), and SDA(Blue wire), to the DS1307 RTC Module (Picture 1)
  3. Connect the other end of the SDA wire(Blue wire) to SDA/Analog pin 4 of the Arduino Nano board (Picture 2)
  4. Connect the other end of the SCL wire(Orange wire) to SCL/Analog pin 5 of the Arduino Nano board (Picture 2)
  5. Connect the other end of the Ground wire(Black wire) to Ground pin of the Arduino Nano board (Picture 3)
  6. Picture 4 shows where are the Ground, SDA/Analog pin 4, and SCL/Analog pin 5, pins of the Arduino Nano

Step 3: Connect the LED Module to the Arduino

  1. Connect the Female end of a Female-Male 5V VCC Power(Red wire) to theLED Module (Picture 1)
  2. Connect Female-Female wires - Ground(Black wire), DIN(Green wire), CS(Gray wire), and CLK(Yellow wire) to theLED Module (Picture 1)
  3. Connect the other end of the Ground wire(Black wire) to Ground pin of the Arduino Nanoboard (Picture 2)
  4. Connect the other end of the CLK wire(Yellow wire) to the Digital 13 pin of the Arduino Nanoboard (Picture 3)
  5. Connect the other end of the DIN wire(Green wire) to the Digital 11 pin of the Arduino Nanoboard (Picture 4)
  6. Connect the other end of the CS wire(Gray wire) to the Digital 10 pin of the Arduino Nanoboard (Picture 4)
  7. Picture 5 shows In Red where are the Ground, Digital 10, 11, and 13, pins of the Arduino Nano. In Blue are shown the connections done in the previous step

Step 4: Connect the Power Wires to the Arduino Board

  1. Connect another Female-Male Power wire(Red wire) to the 5V Power pin of the Arduino board(Picture 1), and leave the Male end unconnected
  2. Connect the Male ends of the 3 Power wires(Red wires) - from the Display, the Clock Module, and the Arduino together as example with the help of a Breadboard (Picture 2) - In my case I used a small Breadboard
  3. Picture 3 shows In Red where is the 5V Power, pin of the Arduino Nano. In Blue are shown the connections done in the previous steps

Step 5: Start Visuino, and Select the Arduino Board Type

To start programming the Arduino, you will need to have the Arduino IDE installed from here: http://www.arduino.cc/.

Please be aware that there are some critical bugs in Arduino IDE 1.6.6.

Make sure that you install 1.6.7 or higher, otherwise this Instructable will not work!

The Visuino: https://www.visuino.com also needs to be installed.

  1. Start Visuino as shown in the first picture
  2. Click on the "Tools" button on the Arduino component (Picture 1) in Visuino
  3. When the dialog appears, select "Arduino Nano" as shown in Picture 2

Step 6: In Visuino: Add and Connect Maxim MAX7219 LED Component

  1. Type "led" in the Filter box of the Component Toolbox then select the "Maxim Led Controller SPI MAX7219/MAX7221" component (Picture 1), and drop it in the design area
  2. Connect the "Out" pin of the LedController1 component to the to the "In" pin of the SPI channel of the Arduino component (Picture 2)
  3. Connect the "ChipSelect" pin of the LedController1 component to the "Digital" input of the "Digital[ 10 ]" channel of the Arduino component (Picture 3)

Step 7: In Visuino: Add Integer Display 7 Segments Element to the Maxim LED Controller Component

The LedController1 component can control LEDs in many different ways. How the LEDs are organized and controlled depends on what Elements will be added to the component. Here we will add 3 Integer elements each with 2 digits, and 2 Unsigned Bit Pixel elements. The time will be displayed in the integer elements, and the bit pixels elements will be used for the separators between hours, minutes, and seconds:

  1. Click on the "Tools" button of the LedController1 component (Picture 1) to open the elements editor
  2. In the "Elements" editor, select the "Integer Display 7 Segments" on the right, and click on the "+" button on the left to add one element to the component (Picture 2)
  3. In the Object Inspector, set the value of the "CountDigits" property of the newly added "Integer Display 7 Segments1" element to 2 (Picture 3)
  4. In the Object Inspector, set the value of the "LeadingZeroes" property of the newly added "Integer Display 7 Segments1" element to "True" (Picture 4)

Step 8: In Visuino: Add the Rest of the Elements to the Maxim LED Controller Component

  1. In the "Elements" editor, select the "Unsigned Bit Pixels" on the right, and click on the "+" button on the left to add one element to the component (Picture 1)
  2. In the Object Inspector, set the value of the "CountPixels" property of the newly added "Unsigned Bit Pixels1" element to "8" (Picture 3)
  3. In the Object Inspector, set the value of the "InitialValue" property of the newly added "Unsigned Bit Pixels1" element to "1" (Picture 4). This will make the "-" (g) segment only active on the 7 segment digit
  4. Repeat the same steps from this and the previous Step 7 of the Instructable to add 2 more "Integer Display 7 Segments" elements, and one more "Unsigned Bit Pixels" element, and set their properties the same way (Picture 4)
  5. Close the "Elements" editor

Step 9: In Visuino: Add and Connect Decode Date/Time Component

We need to decode the Date/Time into separated Hour, Minute, and Second values. For this we will use "Decode Date/Time" component:

  1. Type "decode" in the Filter box of the Component Toolbox then select the "Decode Date/Time" component (Picture 1), and drop it in the design area
  2. Connect the "Out" pin of the RealTimeClock1 to the "In" pin of the DecodeDateTime1 (Picture 2)
  3. Connect the "Second" pin of the "Out" pin list of the DigitalToUnsigned1 to the "In" pin of the "PixelGroups.Integer Display 7 Segments1" element of the LedController1 component (Picture 3)
  4. Connect the "Minute" pin of the "Out" pin list of the DigitalToUnsigned1 to the "In" pin of the "PixelGroups.Integer Display 7 Segments2" element of the LedController1 component (Picture 4)
  5. Connect the "Hour" pin of the "Out" pin list of the DigitalToUnsigned1 to the "In" pin of the "PixelGroups.Integer Display 7 Segments3" element of the LedController1 component (Picture 5)

Step 10: In Visuino: Add and Connect T Flip Flop Component

To animate the "-" separator segments between the Hours, Minutes, and the Seconds, we will switch between "8", and "1" unsigned values every second. To do this we can use a Flip-Flop. The most convenient for this purpose is the Toggle(T)-FlipFlop:

  1. Type "flip" in the Filter box of the Component Toolbox then select the "Toggle(T) Flip-Flop" component (Picture 1), and drop it in the design area
  2. Connect the "Out" pin of the RealTimeClock1 to the "In" pin of the TFlipFlop1 component (Picture 2)

Step 11: In Visuino: Add, Configure, and Connect Digital to Unsigned Component

The Flip flop generates a Digital(Boolean) value. We need to convert it to unsigned values of "8", and "1". To do this we will use "Digital To Unsigned" converter:

  1. Type "digital" in the Filter box of the Component Toolbox then select the "Digital To Unsigned" component (Picture 1), and drop it in the design area
  2. In the Object Inspector, set the value of the "FalseValue" property of the DigitalToUnsigned1 element to "8" (Picture 2)
  3. Connect the "Out" pin of the TFlipFlop1 to the "In" pin of the DigitalToUnsigned1 component (Picture 3)
  4. Connect the "Out" pin of the DigitalToUnsigned1 to the "In" pin of the "PixelGroups.Unsigned Bit Pixels1" element of the LedController1 component (Picture 4)
  5. Connect the "Out" pin of the DigitalToUnsigned1 to the "In" pin of the "PixelGroups.Unsigned Bit Pixels2" element of the LedController1 component (Picture 5)

Step 12: Generate, Compile, and Upload the Arduino Code

  1. In Visuino, Press F9 or click on the button shown on Picture 1 to generate the Arduino code, and open the Arduino IDE
  2. In the Arduino IDE, click on the Upload button, to compile and upload the code (Picture 2)

Step 13: And Play...

Congratulations! You have made an LED clock with 7 Segments MAX7219 LED Display driver, and DS1307 Real Time Clock(RTC).

Picture 1, and the Video show the connected and powered up project.

If you power Arduino, you will see the time displayed on the 7 Segment Display.

On Picture 2 you can see the complete Visuino diagram.

Also attached is the Visuino project, that I created for this Instructable. You can download and open it in Visuino: https://www.visuino.com

<p>can i use a LEDs as my display?.. an form a seven segment</p>
If I understand correctly the idea, yes you can use LEDs to make your own display
<p>Everything work just fine except the two blinking digits D instead of G.</p><p>I tried to change some &quot;InitialValue&quot; and &quot;CountPixels&quot; values in 2 &quot;Unsign Bit Pixels&quot; but it getting worse.</p>
<p>Thank you!</p><p>You should not change the CountPixels in the &quot;Unsign Bit Pixels&quot;, but the InitialValue should be fine. To change the pixel you should set the values in the &quot;Digital To Unsigned&quot; for the True and False values.</p>
<p>.I did download the zip file and did the same hardware connects as the sample, and the result showing different blinking segments as the sample.</p><p>Is there any kind of that library explanation? Which value related to which segment, I have to keep doing try and error several time.</p><p>I finally made it anyway, </p><p>Thank you,</p>

About This Instructable

9,561views

66favorites

License:

More by BoianM:Assemble Kuman Wi-Fi Robot With Camera and Manipulator Arduino and Visuino: Long Distance Remote Light Sensor With RFM95W/RFM98W Makerfabs LoRa Shields  Arduino Nano and Visuino: Animate the Colors of RGB LED 
Add instructable to: