Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 00:01 29 Nov 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Brickwall for RTC on Micromite

     Page 2 of 2    
Author Message
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9308
Posted: 12:56pm 17 Feb 2014
Copy link to clipboard 
Print this post

Use an external RTC based on the DS3231 or DS3232 extremely accurate RTC, and never have to worry about 1307 drift ever again.

3231 Extremely Accurate RTC

They are more expensive then the 1307's, but only by about $2.(and they also have a 32K EEPROM onboard too)

I much prefer 3231's or 3232's for RTC's - they are so much more accurate over time, and for a couple of extra bucks....

  Quote  If you want minimum parts count, the internal clock is very useful.


Well, that is certainly true.


Edited by Grogster 2014-02-18
Smoke makes things work. When the smoke gets out, it stops!
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3196
Posted: 12:59pm 17 Feb 2014
Copy link to clipboard 
Print this post

  TassyJim said  Before I coupled the RTC to the uMite, I had my SETTICK interrupt tweaked to give timer drift as good as the typical RTC - a few seconds per day.

Would many people have the patience to do this?

The reason that I ask is that this particular PIC32 has the ability to tweak the clock speed up or down by a few percent. I was wondering if it was worth making this available as yet another option - so people could fine tune the clock for accuracy.

The internal clock is affected by temperature so the tweaking would only be effective at a certain temperature.

Geoff
Geoff Graham - http://geoffg.net
 
BobD

Guru

Joined: 07/12/2011
Location: Australia
Posts: 935
Posted: 01:50pm 17 Feb 2014
Copy link to clipboard 
Print this post

  Grogster said   Use an external RTC based on the DS3231 or DS3232 extremely accurate RTC, and never have to worry about 1307 drift ever again.

3231 Extremely Accurate RTC

They are more expensive then the 1307's, but only by about $2.(and they also have a 32K EEPROM onboard too)

I much prefer 3231's or 3232's for RTC's - they are so much more accurate over time, and for a couple of extra bucks....

  Quote  If you want minimum parts count, the internal clock is very useful.


Well, that is certainly true.



The DS3231 also has a tweaking register to allow you to adjust the accuracy and on board temperature compensation. It does not need an external crystal. I haven't looked but I suspect the code for the 8563 may work for that too. I bought one of these recently from DX which had a rechargeable lithium cell. It also has on board temperature measurement(although not great resolution).

edit: I bought mine at DX.com but it is identical to the one you linked Grogster.Edited by BobD 2014-02-18
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9308
Posted: 02:20pm 17 Feb 2014
Copy link to clipboard 
Print this post

How do the prices compare?
I like that module, as it has EEPROM on it too for data storage - all for five bucks!(in NZ money)

As I understand from the datasheet for the 3231/3232, the I2C address is fixed, just like the 1703, and it is the same address.
Smoke makes things work. When the smoke gets out, it stops!
 
BobD

Guru

Joined: 07/12/2011
Location: Australia
Posts: 935
Posted: 02:33pm 17 Feb 2014
Copy link to clipboard 
Print this post

  Grogster said   How do the prices compare?
I like that module, as it has EEPROM on it too for data storage - all for five bucks!(in NZ money)

currently US@4.63 but that's DX.com for you. Often just a little more than your eBay best price. I notice that eBay say they don't include the battery when shipped. DX.com has no such problems.
DX.com DS3231 RTC with EEPROM Edited by BobD 2014-02-19
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6101
Posted: 02:41pm 17 Feb 2014
Copy link to clipboard 
Print this post

  Geoffg said  
  TassyJim said  Before I coupled the RTC to the uMite, I had my SETTICK interrupt tweaked to give timer drift as good as the typical RTC - a few seconds per day.

Would many people have the patience to do this?

The reason that I ask is that this particular PIC32 has the ability to tweak the clock speed up or down by a few percent. I was wondering if it was worth making this available as yet another option - so people could fine tune the clock for accuracy.

The internal clock is affected by temperature so the tweaking would only be effective at a certain temperature.

Geoff


Where possible, I set my maximites from the PC as required (once a day usually) and the PC's are set from the Internet.

I will be using the uMite as standalone loggers and looking for low power drain so I will still go with the 8563 and it's interrupt.

In the meantime SETTICK 10018, tensecssub

is an easy way to get an adjustable 10 second interupt.

Having an official timer tweak would be useful as long as we understand that it will drift around.

Jim

VK7JH
MMedit   MMBasic Help
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9308
Posted: 02:59pm 17 Feb 2014
Copy link to clipboard 
Print this post

  BobD said  I notice that eBay say they don't include the battery when shipped. DX.com has no such problems.


Yeah, lots of traders on ebay I note, say that things using batteries won't ship with the batteries. I fully expect this is related to 9/11 and anti-terrorism, where batteries are used to try to set of bombs on planes etc, so by simply making it illegal to send anything with a battery in it, you go a long way towards ruling that kind of thing out.

My sister lives in Germany, and she got a new iPhone, but the supplier would not send it with the battery - she had to buy a battery at her local shop. Seems to be an almost standard thing now with battery powered bits of kit, if they have to hop onto a plane to get to you.
Smoke makes things work. When the smoke gets out, it stops!
 
Zonker

Guru

Joined: 18/08/2012
Location: United States
Posts: 761
Posted: 04:43pm 17 Feb 2014
Copy link to clipboard 
Print this post

Hey Grogster...

I downloaded the data sheet, then I started remembering that I might have one of these laying around.. (pause while rummaging).. I do have one... (nice) I think I got it with some other stuff from DX... Anyway, it would make an awesome little unit for the uMite.. (as you know, by the Pix I seen).. Does the code you have place 6 lines of text on the screen.? Since I guess you have to shift out the characters to the columns as you go. I guess a fixed array of bytes... not sure..

Sweet..! I like it. I try to get it hooked up..

 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9308
Posted: 05:13pm 17 Feb 2014
Copy link to clipboard 
Print this post

  Zonker said   Does the code you have place 6 lines of text on the screen.? Since I guess you have to shift out the characters to the columns as you go. I guess a fixed array of bytes... not sure..


I have not written anything for these modules, nor do I have any, but I am going to get some. I only wrote that I liked them, cos I do, not cos I have actually used them - perhaps I need to clarify that at this point!

I do love the cost, and the fact that the 3231/3232 is a much more accurate RTC then the 1307 in the first place. That, and we also have 32K of EEPROM memory to play with, all on the same module. Hard to beat that price-vs-features.

At Element 14, DS3232 SOIC chips are $20 EACH , just for the chip, to say nothing of a little board and extra EEPROM....

EDIT: I have purchased 10 of these modules. Will probably never need 10, but they are so cheap, and the exchange rate is so good at the moment, that I figured - what the hell!

Get ready, MOBI - once I get a hold of these things, I will start playing around with I2C in earnest, especially as I have an RTC and EEPROM on the same module. But as I have not really done anything at all with I2C, I might be in deep water for a start! Edited by Grogster 2014-02-19
Smoke makes things work. When the smoke gets out, it stops!
 
Zonker

Guru

Joined: 18/08/2012
Location: United States
Posts: 761
Posted: 07:47pm 17 Feb 2014
Copy link to clipboard 
Print this post

Sorry Sir...

I was talking about the LCD Display you had in the PIX... I was wondering how you wrote the code to drive it and if it is text only... It is a Good size for the uMite...!Edited by Zonker 2014-02-19
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9308
Posted: 08:23pm 17 Feb 2014
Copy link to clipboard 
Print this post

Not me!

You need to ask jman about that one - he was the guy with the LCD.
I agree though, they are ideal for the uM and so cheap, I just about bought some.

jman should start a thread about using that LCD - I am sure it would appeal to many.(hint, hint)
Smoke makes things work. When the smoke gets out, it stops!
 
MOBI
Guru

Joined: 02/12/2012
Location: Australia
Posts: 819
Posted: 11:14pm 17 Feb 2014
Copy link to clipboard 
Print this post

  grogster said  Get ready, MOBI - once I get a hold of these things, I will start playing around with I2C in earnest, especially as I have an RTC and EEPROM on the same module. But as I have not really done anything at all with I2C, I might be in deep water for a start!


Don't worry, You'll cope - it is dead simple
David M.
 
OA47

Guru

Joined: 11/04/2012
Location: Australia
Posts: 926
Posted: 11:18pm 19 Feb 2014
Copy link to clipboard 
Print this post

  jman said   Hi
Updated code for the MicroMite
Tested and working with a DS1307




ReadTime:
' I2C RTC based On DS1307 Secs,Mins,Hours,Day,Date,Month,Year,Control
Dim RTCbuff(8)
i2caddr = &h68 ' DS1307 I2C address
I2C open 100,100 ' Enable I2C
I2C write i2caddr, 0, 1, &h0
I2C Read i2caddr, 0, 8, RTCbuff(0)
I2C Close

sec$ = Str$(decimal)
BCDTEMP = RTCBuff(1)
BCDtoDec BCDTEMP

min$ = Str$(decimal)
BCDTEMP = RTCBuff(2)
BCDtoDec BCDTEMP

hours$ = Str$(decimal)
BCDTEMP = RTCBuff(4)
BCDtoDec BCDTEMP

day$ = Str$(decimal)
BCDTEMP = RTCBuff(5)
BCDtoDec BCDTEMP

month$ = Str$(decimal)
bcdtemp = rtcbuff(6)
BCDtoDec BCDTEMP

year$ = Str$(decimal + 2000 )
t$ = hours$+":"+min$+":"+sec$
D$ = day$+"/"+month$+"/"+year$
Time$ = T$
Date$ = D$
Return


'Convert to Decimal
Sub BCDtoDec (BCDTEMP)
Decimal = Fix(BCDTemp / 16) * 10
Decimal = Decimal + (BCDTEMP And &hF)
End Sub


Regards
Jman


Jman, is this code missing :
BCDTEMP = RTCBuff(0)
BCDtoDec BCDTEMP

prior to:

sec$ = Str$(decimal)

???????
 
jman

Guru

Joined: 12/06/2011
Location: New Zealand
Posts: 711
Posted: 11:49pm 19 Feb 2014
Copy link to clipboard 
Print this post

@ Graeme

Worse that that :)
Below is the correct code


' I2C RTC based On DS1307 Secs,Mins,Hours,Day,Date,Month,Year,Control
Dim RTCbuff(8)
i2caddr = &h68 ' DS1307 I2C address
I2C open 100,100 ' Enable I2C
I2C write I2caddr, 0, 1, 0
I2C Read i2caddr, 0, 8, RTCbuff(0)
I2C Close

BCDTEMP = RTCBuff(0)
BCDtoDec BCDTEMP
sec$ = Str$(decimal)

BCDTEMP = RTCBuff(1)
BCDtoDec BCDTEMP
min$ = Str$(decimal)

BCDTEMP = RTCBuff(2)
BCDtoDec BCDTEMP
hours$ = Str$(decimal)

BCDTEMP = RTCBuff(4)
BCDtoDec BCDTEMP
day$ = Str$(decimal)

bcdtemp = rtcbuff(5)
BCDtoDec BCDTEMP
month$ = Str$(decimal)

bcdtemp = rtcbuff(6)
BCDtoDec BCDTEMP
year$ = Str$(decimal + 2000 )

t$ = hours$+":"+min$+":"+sec$
D$ = day$+"/"+month$+"/"+year$
Time$ = T$
Date$ = D$
Print "Time has been set to ";Time$
Print"Date has been set to ";Date$
End

'Convert to Decimal
Sub BCDtoDec (BCDTEMP)
Decimal = Fix(BCDTemp / 16) * 10
Decimal = Decimal + (BCDTEMP And &hF)
End Sub


Regards
JmanEdited by jman 2014-02-21
 
MOBI
Guru

Joined: 02/12/2012
Location: Australia
Posts: 819
Posted: 12:27am 20 Feb 2014
Copy link to clipboard 
Print this post

How do you manually alter the time for daylight saving etc? Most RTC chips have alarm registers that can be altered.

Keypad and LCD display? i2c?

David M.
 
     Page 2 of 2    
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024