Best microcontroller for timekeeping

Discussion in 'Embedded Systems and Microcontrollers' started by Manmeet Singh, Nov 1, 2010.

  1. Manmeet Singh

    Thread Starter Active Member

    May 21, 2008
    37
    0
    Hello all,


    My application is to mimic the functionality of a digital power bar to activate a stepper motor, a servo and a pc fan. So what I need to be able todo is keep track of time and change the time in which my outputs should turn on (they all will turn on at the same time). What would you all recommend is the best way to get this done? I have some experience with the pic24 but wouldnt mind using the arduino to gain knowledge of another type of microcontroller.

    From what I have researched arduino has a built in time library so it looks tempting at the moment I couldnt find something similar for PICs. (http://www.arduino.cc/playground/Code/Time )

    Thanks
     
  2. hgmjr

    Moderator

    Jan 28, 2005
    9,030
    214
    Note that the Arduino application that you mentioned requires that the Arduino be connected to the Internet to get its time from NIST.

    hgmjr
     
  3. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    6,357
    718
    What is the application for?

    A Dallas RTC, PIC, LCD display (used to adjust time/date), and a couple buttons will keep good time, as long as the temperature isn't too severe.
     
  4. blueroomelectronics

    AAC Fanatic!

    Jul 22, 2007
    1,758
    98
    Since you're familiar with the PIC24 you may have noticed some of them have a built in RTCC.
     
  5. John P

    AAC Fanatic!

    Oct 14, 2008
    1,632
    224
    PIC16, too.
     
  6. blueroomelectronics

    AAC Fanatic!

    Jul 22, 2007
    1,758
    98
    Which PIC16 has an RTCC in hardware?
     
  7. maxpower097

    Well-Known Member

    Feb 20, 2009
    795
    388
    None. lol I'm working on a very time sensitive project right now and have worried about the internal RTCC on the pic24. No reason why but for the money I'm planning on throwing in a external Dallas or other RTC just to validate the time. I believe you can pull the time off of the radio(audio) too. So that may even be a 3 layer of safety.
     
  8. Manmeet Singh

    Thread Starter Active Member

    May 21, 2008
    37
    0
    @ hgmjr

    I did not realize that but that makes alot more sense since I had no clue how it could keep track of time on its own.
    @ thatoneguy
    The application is for a automatic fish feeder ( I know its overkill and cheaper to just buy one) but I wanted to get some experience making stuff myself.



    So what if I was to use a Dallas RTC, an arduino and an LCD? Dallas RTCs work with arduinos right?
     
  9. hgmjr

    Moderator

    Jan 28, 2005
    9,030
    214
    If you use the dallas DS1307 with your Arduino, you will find that there is a pretty good library of functions already written and available at www.arduino.cc.

    hgmjr
     
  10. John P

    AAC Fanatic!

    Oct 14, 2008
    1,632
    224
    The PIC processors don't have an internal clock, but some of them can be connected to a 32.768KHz watch crystal, which I assume gives you an accuracy the same as a digital watch. All counting of time intervals, obviously, has to be done by the processor. You can't just go to some memory location and read off hours/minutes/seconds.

    The 32.768K option isn't the same as the faster (but much less accurate) crystal that might run the processor for regular operation. It's an add-on item that uses one of the processor's internal timers.
     
  11. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    No some 24F series do have an onboard Real-Time Clock and Calendar hardware module. But this module will require an external 32.768KHz clock crystal. So with the correct setup you will be able to go to some memory locations and read off hours/minutes/seconds and also month year.
    Here you can read about it. I do not think this is implemented in any 16 or 18 series PIC.
    http://ww1.microchip.com/downloads/en/DeviceDoc/39696b.pdf
     
  12. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    6,357
    718
    Yes. There isn't a ton of difference between microcontrollers, both PIC and AVR are capable of SPI and other functions. PIC have a few more of the advanced interfaces such as USB and Ethernet, but the basics like ADC, CCP (PWM), SPI, Serial, general I/O are common to just about all controllers.

    An Arduino is an AVR uC with a bootloader and an onboard programming interface as well as some IO for a ready to go solution. Basic Stamp and the PicAxe are a couple PIC based boards of the same concept.

    It comes down to a preference of platform and ease of programming in the end to decide exactly what to use. The only limitation is speed when using a dev board with onboard programming/interpreter, but that isn't an issue for an application such as this.
     
  13. Manmeet Singh

    Thread Starter Active Member

    May 21, 2008
    37
    0
    Hmmm now the PIC option with a 32.768KHz crystal is looking quite viable as it was the PIC24HJ32GP that I have used before. Im going to be looking into the DS1307 module tonight and would appreciate if any body else could chime in on the setbacks of using DS1307 vs a crystal.

    Also what do digital powerbars use to perform all this logic? A simple microprocessor?

    Thanks for the speedy responses everyone
     
  14. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    6,357
    718
    For the cost of them, they could easily have a 60kHz radio reciever, RTC with backup battery, and a microcontroller running SSRs.

    Digital wall clocks that display moon phase, date and time that are set by WWVB are down to around $15 each retail, most of that being the display and case cost.

    A hobbyist ends up paying a bit more, as 10,000 unit builds aren't very common.
     
  15. John P

    AAC Fanatic!

    Oct 14, 2008
    1,632
    224
    t06afre--that's interesting, and I didn't know about those PIC processors with built in clock/calendar features. I've never progressed beyond the PIC16 types!
     
  16. maxpower097

    Well-Known Member

    Feb 20, 2009
    795
    388
    You should look into them. Price per chip is now pretty close to pic16 and pic18's.
     
  17. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    6,357
    718
    Without going the non-uC route, you could use a ripple counter IC with some logic gates to trigger roughly every 24 hours. With a little tweaking, a single 4060 IC connected to a relay would work, 24.00000 hr accuracy is something you'd need to tweak over a period of time, though. :D
     
    Last edited: Nov 7, 2010
  18. blueroomelectronics

    AAC Fanatic!

    Jul 22, 2007
    1,758
    98
    The DS1307 also needs a crystal.

    How do you plan to set the clock?
     
  19. Manmeet Singh

    Thread Starter Active Member

    May 21, 2008
    37
    0
  20. blueroomelectronics

    AAC Fanatic!

    Jul 22, 2007
    1,758
    98
    And how do you plan to set the clock and program the feeding? Keypad, display?
     
Loading...