Dwight
How are you getting the time? GPS?
Dwight
How are you getting the time? GPS?
Thanks and Regards;
Gadelhas
gadelhas,
from an ESP8266-01 wifi module.
Which is an amazing little wifi module that is connected to my home LAN.
check out my clock project here...
http://www.picbasic.co.uk/forum/showthread.php?t=20965
and check out my description of the ESP8266-01 module here...
http://www.picbasic.co.uk/forum/showthread.php?t=20957
The little ESP module is incredibly easy to work with and really interfaces to the PIC quite easily.
If you have more questions feel free to ask or PM me.
Dwight
These PIC's are like intricate puzzles just waiting for one to discover their secrets and MASTER their capabilities.
Unless you have a calendar you’d still want the data table anyway.
Any time you want to add or subtract time you need a calendar.
If the clock retrieves UTC time as 00:01 1st Jan 2016, and has to subtract one hour.
It has to know right down to days in month, leap years, the whole lot.
In my case I don't care about the date or year etc (other than to be used in the calculation to determine if DST is in effect or not)Unless you have a calendar you’d still want the data table anyway.
Any time you want to add or subtract time you need a calendar.
If the clock retrieves UTC time as 00:01 1st Jan 2016, and has to subtract one hour.
It has to know right down to days in month, leap years, the whole lot.
and my code does not require the year for the calculation. I just needed the month, date and day of week to run through my algorithm.
My clock simply displays HH:MM, the seconds are still tracked to know when to increment the minutes.
My code checks NTP time twice a day (at 0500 and 1500) and runs the calc.
The reason I don't check it 12 hours apart is because I want it to be most accurate first thing in the morning and when I get home from work.
The display is blank between 2200 and 0600.
As noted above the ESP module give me the time in STD time and then my code determines if I need to add 1 hour or leave the time as is.
So far it seems to be working correctly.
Dwight
These PIC's are like intricate puzzles just waiting for one to discover their secrets and MASTER their capabilities.
Dwight, Here is the code I flashed into the ESP8266-01 I use for NTP time service. It is NOT ESP8266Basic but the standard AT command set with an added set of commands to interface with the NTP pool.org for the NTP service. It also allows for all of the other AT commands to be used. I found the ESP8255Basic to be too unstable.
Dave Purola,
N8NTA
EN82fn
@Art
In my case, my clock does not keep track of the date or year.Unless you have a calendar you’d still want the data table anyway.
Any time you want to add or subtract time you need a calendar.
If the clock retrieves UTC time as 00:01 1st Jan 2016, and has to subtract one hour.
It has to know right down to days in month, leap years, the whole lot.
I only use the Day of Week, Month and Date to determine if DST is or is not in effect.
My ESP module gives me those three items along with the HH:MM:SS and my algorithm then determines whether or not I need to add 1 hour to the provided STD time. After that I don't bother with anything other than HH:MM:SS.
My code above seems to be working good so far and I did test for DST/STD crossing in both directions and it seems to work.
@Dave
Thanks for sharing your code, I'll take a look at it.
So far my module running ESPbasic has been running solid with this code loaded in the ESP module...
If you want to see the code running on the PIC in the clock just search the forum for "nixie".'================================================= ==========
'--- This is the code running on the ESP8266-01 module ---
'================================================= ==========
'''memclear
'''cls
'''timesetup(-7,0)
'''baudrate 9600
'''serialtimeout 2000
'''delay 1000
'''button "Exit" [Exit]
'''timer 100 [PicSer]
'''wait
''''
'''[PicSer]
'''serialflush
'''input picin
'''picin = mid(picin,1,5)
'''if picin == "Time?" then gosub [gettime]
'''wait
''''
'''[gettime]
'''bla = time()
'''dy = mid(bla,1,3) 'dow
'''mh = mid(bla,5,3) 'month
'''dd = mid(bla,9,2) 'date
'''hh = mid(bla,12,2) 'hour
'''mm = mid(bla,15,2) 'min
'''ss = mid(bla,18,2) 'sec
'''yr = mid(bla,21,4) 'year
''''
'''if dy == "Sun" then dow = "1/"
'''if dy == "Mon" then dow = "2/"
'''if dy == "Tue" then dow = "3/"
'''if dy == "Wed" then dow = "4/"
'''if dy == "Thu" then dow = "5/"
'''if dy == "Fri" then dow = "6/"
'''if dy == "Sat" then dow = "7/"
''''
'''if mh == "Jan" then mth = "01/"
'''if mh == "Feb" then mth = "02/"
'''if mh == "Mar" then mth = "03/"
'''if mh == "Apr" then mth = "04/"
'''if mh == "May" then mth = "05/"
'''if mh == "Jun" then mth = "06/"
'''if mh == "Jul" then mth = "07/"
'''if mh == "Aug" then mth = "08/"
'''if mh == "Sep" then mth = "09/"
'''if mh == "Oct" then mth = "10/"
'''if mh == "Nov" then mth = "11/"
'''if mh == "Dec" then mth = "12/"
''''
'''picout = dow & mth
'''picout = picout & dd
'''picout = picout & "/"
'''picout = picout & hh
'''picout = picout & mm
'''picout = picout & ss
''''
'''serialprintln picout
'''return
''''
'''[Exit]
'''end
I wonder if you were having problems with a certain version of the ESPbasic OS. Mike did seem to have a couple of versions that were a bit unreliable.
My ESP module is currently running Version 1.67 of the OS. I think he is up over 1.8x now and I think it is working pretty well also.
I think the problems were in the 1.7x region of his revisions. (not exact)
The ESPbasic is based (I believe) on the arduion IDE and the arduino/ESP foundation so if you are competent at the arduino C-like language then that is probably a good way to go.
I just like the built in IDE of the ESPbasic and it's (for me) easy to understand and no external IDE required.
thanks all!
Dwight
These PIC's are like intricate puzzles just waiting for one to discover their secrets and MASTER their capabilities.
Bookmarks