element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Arduino
  • Products
  • More
Arduino
Arduino Forum DS1307 with seven segment display
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Arduino to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Not Answered
  • Replies 6 replies
  • Subscribers 393 subscribers
  • Views 791 views
  • Users 0 members are here
  • arduino
Related

DS1307 with seven segment display

Former Member
Former Member over 10 years ago

hello everyone,

Am a follower of Jeremy Blum tutorials and his book exploring arduino is the one assist me to know element14 arduino community.

 

my problem is how i can use DS1307 to track time for counting days and display it on seven segment display. i want counter to counting up days from 00 day to 99 days i.e counting up ( incrementing by one number) at the interval of 24hrs. However i manage to count with the use of  millis() but problem comes as i introduce RTC.....i want to use RTC for assisting counting number of days because millis() is messing on me once the arduino power is off.

i have

1. Arduino Uno

2. RTC-ds1307

3. crystal 32.768kHz

4. 2 pull up resistor each 2.2k

5. 2 Seven Segment Displays(Common Cathode)

6. 2 shift register, 74HC595

7. 16 resistor of 680Ohm for connection between shift registers and seven segment displays

 

 

i attachment of my diagram and arduino sketch for counting, anyone with the help in both diagram and arduino sketch i will appriciate.

 

[code]

#define LATCH 12

#define CLK 13

#define DATA 11

 

 

int i,j;

int digitOne[10] = {63,6,91,79,102,109,125,7,127,103};

int digitTwo[10]= {63,6,91,79,102,109,125,7,127,103};

 

 

//other stuff

unsigned long startTime;

 

 

void setup()

{

  startTime = now.unixtime();

  pinMode(LATCH, OUTPUT);

  pinMode(CLK, OUTPUT);

  pinMode(DATA, OUTPUT);

}

  void loop()

{

  int dayCount = (now.unixtime() - startTime)/ 86400;

  displayDaycount(dayCount);

}

displayDaycount(int numberOfDays)

{

  for(int i=0; i<10; i++){

    for(int j=0; j<10; j++){

      digitalWrite(LATCH, LOW);

      shiftOut(DATA, CLK, MSBFIRST, ~digitTwo[j]); // digitTwo

      shiftOut(DATA, CLK, MSBFIRST, ~digitOne[i]); // digitOne

      digitalWrite(LATCH, HIGH);

     

        }

  }

}

 

[/code]

 

here is my diagram:

 

image

  • Sign in to reply
  • Cancel
  • najath
    0 najath over 10 years ago

    see this nice tutorial on DS1307 and Arduino:

    https://learn.adafruit.com/ds1307-real-time-clock-breakout-board-kit

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 10 years ago in reply to najath

    thanks najath for your quick reply, i had those tutorial from adafruits and they are very helpfull and its the one taking me this point

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • najath
    0 najath over 10 years ago in reply to Former Member

    so are you able to read/write to the RTC chip through I2C interface, and display data read from it on to seven segment display?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 10 years ago in reply to najath

    Not real najath, i just got basic knowledge from adafruit. So now the issue is to use those ideas to implement in seven segment display

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • najath
    0 najath over 10 years ago in reply to Former Member

    can you a bit more specific on what is working for you and what is not?

    are you able to display numbers on the display?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • clem57
    0 clem57 over 10 years ago

    Walter,

         Let's break this down to smaller problems. ok?

    1. Write a sketch to display "0" on the top control. If works try next one.
    2. Write a sketch to display "0" on the bottom display. If works try next one.
    3. Write a sketch to display "1" on the top display and "0" on the bottom display at the same time. tougher, but should show how to combine  top and bottom as well as display a new digit.
    4. Now write a sketch to write "1" top top and "0" to bottom. after a delay of 1 second, switch them to make "0" on the top and "1" on the bottom.
    5. Write a sketch to count "1" to "9" on the top and "0" to "9" on the bottom every second.

     

    By working step by step, you can learn to get where you want to go. The last step is to sample the time on the RTC chip and display the correct number of seconds doing this every second like before! Now pat yourself on the back for finishing this up.

     

    Clem

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube