Best microcontroller for timekeeping

Thread Starter

Manmeet Singh

Joined May 21, 2008
37
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
 

hgmjr

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

hgmjr
 

thatoneguy

Joined Feb 19, 2009
6,359
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.
 

maxpower097

Joined Feb 20, 2009
816
Which PIC16 has an RTCC in hardware?
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.
 

Thread Starter

Manmeet Singh

Joined May 21, 2008
37
@ 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?
 

John P

Joined Oct 14, 2008
2,026
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.
 

t06afre

Joined May 11, 2009
5,934
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.
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
 

thatoneguy

Joined Feb 19, 2009
6,359
@ 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?
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.
 

Thread Starter

Manmeet Singh

Joined May 21, 2008
37
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
 

thatoneguy

Joined Feb 19, 2009
6,359
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
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.
 

John P

Joined Oct 14, 2008
2,026
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!
 

thatoneguy

Joined Feb 19, 2009
6,359
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:
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
The DS1307 also needs a crystal.

How do you plan to set the clock?
 
Top