Forum Menu




 


Log in Problems?
New User? Sign Up!
AVR Freaks Forum Index

Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
Geronimo
PostPosted: Jun 19, 2012 - 03:59 PM
Hangaround


Joined: Dec 22, 2006
Posts: 300
Location: Odense, Denmark

Hey guys! I'm building an alarm clock of sorts, but I am thinking about if I should use an external RTC or do one in software on my Atmega48 that I'm going to use..!

I have some DS1307 RTCs and some others laying around, but it will take up a little more space a thing which I will not have a lot of! Though something as small as a DS1307 will not be a problem, but the backup-battery (which is optional though) might be a bit of a problem...

Programming a RTC in software will take up a bit more program code and more time to implement, but I don't really mind spending the extra time and 4K flash should be more than enough I am fairly certain.
(Things I will be using on the mega48 is; character LCD, 3 buttons, one PWM channel)

So basically what I'm asking is, what would you do, and why? Pros and cons?
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
clawson
PostPosted: Jun 19, 2012 - 04:02 PM
10k+ Postman


Joined: Jul 18, 2005
Posts: 62345
Location: (using avr-gcc in) Finchingfield, Essex, England

I'd use the Maxim-Dallas: Likely more accurate and likely easier to isolate power usage (you can even have its alarm interrupt the AVR to wake it up). If you go with AVR+watch crystal how will you handle battery backup if you want to use that?

_________________
 
 View user's profile Send private message  
Reply with quote Back to top
JohanEkdahl
PostPosted: Jun 19, 2012 - 04:06 PM
10k+ Postman


Joined: Mar 27, 2002
Posts: 18576
Location: Lund, Sweden

Quote:
If you go with AVR+watch crystal how will you handle battery backup if you want to use that?

I have this sketch in my vaults from an earlier discussion here at AVRfreaks:

 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
david.prentice
PostPosted: Jun 19, 2012 - 04:25 PM
10k+ Postman


Joined: Feb 12, 2005
Posts: 16323
Location: Wormshill, England

The accuracy of the RTC will depend on the watch crystal whether you use a DS1307 or AVR.

The battery backup is simpler and easier with a a coin cell and DS1307.
However good you are at sending the AVR to sleep, I doubt you will compete with the DS1307. So you probably need more than a coin cell for backup.

If you never lose power, both solutions are ok.

David.
 
 View user's profile Send private message Send e-mail  
Reply with quote Back to top
Geronimo
PostPosted: Jun 19, 2012 - 04:27 PM
Hangaround


Joined: Dec 22, 2006
Posts: 300
Location: Odense, Denmark

For the accuracy I would use the DS1307, but I could not find anything about accuracy using the AVR, shouldn't it be the same if I'm using the same 32KHz crystal for either?

With regards to battery backup, this is just a hobby project and is only ever going to be used by me, and where I live there is rarely a power outage! Actually I can't recall the last time, I think it is probably less than once a year on average. So I can manage without.

JohanEkdahl: Are those diodes Schottkys? Anyway I think this extra circuitry will probably take up as much space as the DS1307 and 2 pull-up resistors for I2C! Smile

_________________
- Brian
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
jayjay1974
PostPosted: Jun 19, 2012 - 04:46 PM
Raving lunatic


Joined: Oct 30, 2002
Posts: 5720
Location: The Netherlands

Unfortunately Atmel didn't include a separate power pin for timer 2; the NXP LPC213x/214x do have a real RTC onboard with separate power pin.

A seperate RTC will be easier on power, always. You don't have to run a MCU core with ten thousands of transistors while a RTC only has a few to increment a few counters.
 
 View user's profile Send private message  
Reply with quote Back to top
mnehpets
PostPosted: Jun 19, 2012 - 09:49 PM
Hangaround


Joined: Nov 09, 2011
Posts: 402


How much board space do you have for the backup battery? And how long do you want the backup to last? One option would be a supercap. Typical coin-cell supercaps (e.g. taiyo yuden PAS series or panasonic EP series) take about 5mm x 4mm of board space. You will also need to add a charging circuit (maybe a linear regulator + diode). The DS1307 claims a load of 500nA using the backup battery. With around 60mF of capacitance, and a discharge voltage delta of 1V, you can easily get a day or more of backup out of those supercaps.

- S
 
 View user's profile Send private message  
Reply with quote Back to top
Geronimo
PostPosted: Jun 19, 2012 - 09:56 PM
Hangaround


Joined: Dec 22, 2006
Posts: 300
Location: Odense, Denmark

Okay so I have found a pretty small rechargeable battery that I could use... (MS series)
http://www.abcde.de/data/seiko-microbatteries.pdf

But as I read the datasheet the battery should not drop below 2V. Does anyone one know how the DS1307 acts when voltage drops below 2V, which is the minimum for Vbat? Does it turn off or will it try to keep running thus draining and potentially ruining the battery?

I could also use a regular non-rechargeable lithium, but this is going in a pretty small box which will be a pain to disassemble hence my reluctance to use batteries in the first place! (Size and trouble replacing it)
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
js
PostPosted: Jun 19, 2012 - 11:28 PM
10k+ Postman


Joined: Mar 28, 2001
Posts: 20387
Location: Sydney, Australia (Gum trees, Koalas and Kangaroos, No Edelweiss)

Quote:
For the accuracy I would use the DS1307
Accuracy does NOT depend on the chip but the accuracy of the clock used. If you have an accurate clock then even simple shift registers would be accurate.

Something like a DS32KHz driving a DS1307 would be pretty accurate (I have used that combination) but more expensive than a DS3231 with evrything built in.

_________________
John Samperi
Ampertronics Pty. Ltd.
www.ampertronics.com.au
* Electronic Design * Custom Products * Contract Assembly
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
Geronimo
PostPosted: Jun 20, 2012 - 11:42 AM
Hangaround


Joined: Dec 22, 2006
Posts: 300
Location: Odense, Denmark

mnehpets wrote:
How much board space do you have for the backup battery? And how long do you want the backup to last? One option would be a supercap. Typical coin-cell supercaps (e.g. taiyo yuden PAS series or panasonic EP series) take about 5mm x 4mm of board space. You will also need to add a charging circuit (maybe a linear regulator + diode). The DS1307 claims a load of 500nA using the backup battery. With around 60mF of capacitance, and a discharge voltage delta of 1V, you can easily get a day or more of backup out of those supercaps.

- S


My box is 110*65*24mm (4.3"*2.6"*0.9") and the box leaves room for a PCB of approximately 105*60mm and components up to 15mm height on top side or 4mm on bottom side.

But then the LCD takes up a lot of space so I think I can only fit a PCB of 30*60mm! It is going to be double layer though. Maybe I can do something beneath the LCD but it would have to be components with very small height though (or mounted on bottom side which has 4mm room)

Maybe I should look at a super-cap? 24 hours of backup should be plenty and I don't have to worry about too deep discharge with a super cap, and I will never have to change it! 24 hours of backup time should be plenty!
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT + 1 Hour
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2006 The PNphpBB Group
Credits