time-nuts@lists.febo.com

Discussion of precise time and frequency measurement

View all threads

GPS seconds conversion on an Arduino

CA
Chris Albertson
Sun, May 14, 2017 5:46 PM

On Sun, May 14, 2017 at 9:15 AM, Nick Sayer via time-nuts
time-nuts@febo.com wrote:

I wouldn’t expect floating point to enter into it.

The question here was about conversion to Siderial Time.  The mean
sidereal day is 23.9344699 hours but that is the MEAN.  The length of
the day continuously changes.  So depending on how accurate you need
to be this can use a LOT of 64-bit floating point math.

--

Chris Albertson
Redondo Beach, California

On Sun, May 14, 2017 at 9:15 AM, Nick Sayer via time-nuts <time-nuts@febo.com> wrote: > > I wouldn’t expect floating point to enter into it. The question here was about conversion to Siderial Time. The mean sidereal day is 23.9344699 hours but that is the MEAN. The length of the day continuously changes. So depending on how accurate you need to be this can use a LOT of 64-bit floating point math. -- Chris Albertson Redondo Beach, California
BH
Ben Hall
Sun, May 14, 2017 9:16 PM

Hi Chris and list,

My original goal was to duplicate, more or less, what the PackRat guys
did to get the TruePosition boards up and functional as described here:

http://www.packratvhf.com/A%20Packrat%20GPS%20Receiver%20Project.pdf

I did get in touch with them and they forwarded the HEX files.  I
haven't tried them yet, but another list member did try them without
success.

I figured, as a learning exercise, I'd program up my own interface.  The
boards do not talk NMEA...but output their own format of message.  One
message contains GPS time in seconds...plus the number of leap seconds
that have elapsed, so my goal there was to convert the GPS time from the
unit into normal UTC date and time.

On 5/14/2017 12:38 PM, Chris Albertson wrote:

Unless this is an educational exercise I'd move to a different processor.
One of those $3 Arm M3 units has enough  memory AND a more standard
development environment that you could use a standard library function to
do what you need.

It is an educational exercise...but I'm still going to look into this.
Another list member suggested a different Arduino board that had two
real serial ports, as right now the Uno board I'm using only has one
hardware serial port with a second duplicated in software.  (one port
talks to the TruePosition board...the other is debugging output port)

I did happen to recall that I included a Teensy-LC board (Cortex M0) in
a recent OSHPark PCB order...and it appears to have three hardware
serial ports...so this may be the way I go eventually.

One of the reasons I liked the Uno was due to all the tutorials and
example code floating around...plus the nice selection of libraries...as
I'm not a programmer.  My code would probably make a real programmer
lose his or her lunch.  :(

thanks much,
ben

Hi Chris and list, My original goal was to duplicate, more or less, what the PackRat guys did to get the TruePosition boards up and functional as described here: <http://www.packratvhf.com/A%20Packrat%20GPS%20Receiver%20Project.pdf> I did get in touch with them and they forwarded the HEX files. I haven't tried them yet, but another list member did try them without success. I figured, as a learning exercise, I'd program up my own interface. The boards do not talk NMEA...but output their own format of message. One message contains GPS time in seconds...plus the number of leap seconds that have elapsed, so my goal there was to convert the GPS time from the unit into normal UTC date and time. On 5/14/2017 12:38 PM, Chris Albertson wrote: > Unless this is an educational exercise I'd move to a different processor. > One of those $3 Arm M3 units has enough memory AND a more standard > development environment that you could use a standard library function to > do what you need. It is an educational exercise...but I'm still going to look into this. Another list member suggested a different Arduino board that had two real serial ports, as right now the Uno board I'm using only has one hardware serial port with a second duplicated in software. (one port talks to the TruePosition board...the other is debugging output port) I did happen to recall that I included a Teensy-LC board (Cortex M0) in a recent OSHPark PCB order...and it appears to have three hardware serial ports...so this may be the way I go eventually. One of the reasons I liked the Uno was due to all the tutorials and example code floating around...plus the nice selection of libraries...as I'm not a programmer. My code would probably make a real programmer lose his or her lunch. :( thanks much, ben
CA
Chris Albertson
Mon, May 15, 2017 6:22 AM

Are you still going for Sidereal time?  If so that is floating point

The ARM processor unlike the Arduino does not have fixed pin assignment.
Typically there are many UARTS, I2C interfaces, ADC units and so on more
than there are physical pins.  Within some limits you assign functions to
pins in software.    Some you don't need to make a special board at OSHPark
with three serial ports.  You can move the serial function to the pins you
like.

That said, moving functions to pins is an "advanced" software art.  So to
make it easy for normal people the development environment will have some
easy way to do this and some limits too.

You can program most ARM M boards using Arduino but that IDE while day to
use is limited.  The next step up is "mbed" which is much more capable and
lets you move some functions to some pins the IDE is web based so there is
no software to install.  (OK you can work locally if you like.  There are
several ways to do that.

This is my favorite under $2 boards now
http://www.ebay.com/itm/STM32F103C8T6
http://www.ebay.com/itm/STM32F103C8T6-ARM-STM32-Minimum-System-Development-Board-Module-For-Arduino-/192181979870?hash=item2cbef04ade:g:pBgAAOSwvihY8r-0
The specs are literally an order of magnitude over Arduino and at under $2
shipped thrice is right.  These are Arm Cortex M3 in the size of a large
1970's vintage DIP chip.  Google the P/N for loads of information    This
parts works on bed and arduino IDEs  as well as simply using the gcc arm
compiler.

The other one I use is Nucleo F401RE
These are $13 each and unlike the above have loads of 1st rate
documentations written by a US company ST Micro.
https://developer.mbed.org/platforms/ST-Nucleo-F401RE/
Yes you can snap off the programmer and reconnect it with jumpers or leave
it on.  Even if you leave it on you can use it to program the STM32F103.
Saves you from having to buy an Chinese clone ST-Link dongle.

TheF401RE is the "classic" part that most example programs have beed tested
on but I'd buy the F446RE for $1 more.  It's twice as fast and has more RAM.

The mbed IDE lets  you use most C source code you can find and it runs a
real time OS.    Arduino is still hands down the easiest environment to
learn and it runs at 5 volts.  I keep one for testing 5V hardware.  All the
arm stuff is 3v3

Most any ARM board can run with the Arduino IDE it some one wrote a boot
loader for it.  The mbed boards don't use bootloders.  They "look" like a
flash drive to your PC so all you do is drag and drop the BIN file to the
flash drive and the board then runs whatever case to dropped there.

One more bit of advice.  Buy a logic analyzer.  I was using one today and
mad it save a LOT of time debugging when you can see what data is on the
pins.  Logic analyzers used to be expensive but one god enough for this
kind of work is now under $10 for a Saleae clone
http://www.ebay.com/itm/24MHz-8CH-USB-Logic-Analyzer-24MHz-8-Channel-Compatible-to-Saleae
http://www.ebay.com/itm/24MHz-8CH-USB-Logic-Analyzer-24MHz-8-Channel-Compatible-to-Saleae-ARM-FPGA-M100-/272337085235?hash=item3f688e2333:g:RNcAAOSwPCVYBD2b
They work like a scope for digital and can do protocol decoding show the
data going over a cable.

On Sun, May 14, 2017 at 2:16 PM, Ben Hall kd5byb@gmail.com wrote:

Hi Chris and list,

My original goal was to duplicate, more or less, what the PackRat guys did
to get the TruePosition boards up and functional as described here:

http://www.packratvhf.com/A%20Packrat%20GPS%20Receiver%20Project.pdf

I did get in touch with them and they forwarded the HEX files.  I haven't
tried them yet, but another list member did try them without success.

I figured, as a learning exercise, I'd program up my own interface.  The
boards do not talk NMEA...but output their own format of message.  One
message contains GPS time in seconds...plus the number of leap seconds that
have elapsed, so my goal there was to convert the GPS time from the unit
into normal UTC date and time.

On 5/14/2017 12:38 PM, Chris Albertson wrote:

Unless this is an educational exercise I'd move to a different processor.
One of those $3 Arm M3 units has enough  memory AND a more standard
development environment that you could use a standard library function to
do what you need.

It is an educational exercise...but I'm still going to look into this.
Another list member suggested a different Arduino board that had two real
serial ports, as right now the Uno board I'm using only has one hardware
serial port with a second duplicated in software.  (one port talks to the
TruePosition board...the other is debugging output port)

I did happen to recall that I included a Teensy-LC board (Cortex M0) in a
recent OSHPark PCB order...and it appears to have three hardware serial
ports...so this may be the way I go eventually.

One of the reasons I liked the Uno was due to all the tutorials and
example code floating around...plus the nice selection of libraries...as
I'm not a programmer.  My code would probably make a real programmer lose
his or her lunch.  :(

thanks much,
ben


time-nuts mailing list -- time-nuts@febo.com
To unsubscribe, go to https://www.febo.com/cgi-bin/m
ailman/listinfo/time-nuts
and follow the instructions there.

--

Chris Albertson
Redondo Beach, California

Are you still going for Sidereal time? If so that is floating point The ARM processor unlike the Arduino does not have fixed pin assignment. Typically there are many UARTS, I2C interfaces, ADC units and so on more than there are physical pins. Within some limits you assign functions to pins in software. Some you don't need to make a special board at OSHPark with three serial ports. You can move the serial function to the pins you like. That said, moving functions to pins is an "advanced" software art. So to make it easy for normal people the development environment will have some easy way to do this and some limits too. You can program most ARM M boards using Arduino but that IDE while day to use is limited. The next step up is "mbed" which is much more capable and lets you move some functions to some pins the IDE is web based so there is no software to install. (OK you can work locally if you like. There are several ways to do that. This is my favorite under $2 boards now http://www.ebay.com/itm/STM32F103C8T6 <http://www.ebay.com/itm/STM32F103C8T6-ARM-STM32-Minimum-System-Development-Board-Module-For-Arduino-/192181979870?hash=item2cbef04ade:g:pBgAAOSwvihY8r-0> The specs are literally an order of magnitude over Arduino and at under $2 shipped thrice is right. These are Arm Cortex M3 in the size of a large 1970's vintage DIP chip. Google the P/N for loads of information This parts works on bed and arduino IDEs as well as simply using the gcc arm compiler. The other one I use is Nucleo F401RE These are $13 each and unlike the above have loads of 1st rate documentations written by a US company ST Micro. https://developer.mbed.org/platforms/ST-Nucleo-F401RE/ Yes you can snap off the programmer and reconnect it with jumpers or leave it on. Even if you leave it on you can use it to program the STM32F103. Saves you from having to buy an Chinese clone ST-Link dongle. TheF401RE is the "classic" part that most example programs have beed tested on but I'd buy the F446RE for $1 more. It's twice as fast and has more RAM. The mbed IDE lets you use most C source code you can find and it runs a real time OS. Arduino is still hands down the easiest environment to learn and it runs at 5 volts. I keep one for testing 5V hardware. All the arm stuff is 3v3 Most any ARM board can run with the Arduino IDE it some one wrote a boot loader for it. The mbed boards don't use bootloders. They "look" like a flash drive to your PC so all you do is drag and drop the BIN file to the flash drive and the board then runs whatever case to dropped there. One more bit of advice. Buy a logic analyzer. I was using one today and mad it save a LOT of time debugging when you can see what data is on the pins. Logic analyzers used to be expensive but one god enough for this kind of work is now under $10 for a Saleae clone http://www.ebay.com/itm/24MHz-8CH-USB-Logic-Analyzer-24MHz-8-Channel-Compatible-to-Saleae <http://www.ebay.com/itm/24MHz-8CH-USB-Logic-Analyzer-24MHz-8-Channel-Compatible-to-Saleae-ARM-FPGA-M100-/272337085235?hash=item3f688e2333:g:RNcAAOSwPCVYBD2b> They work like a scope for digital and can do protocol decoding show the data going over a cable. On Sun, May 14, 2017 at 2:16 PM, Ben Hall <kd5byb@gmail.com> wrote: > Hi Chris and list, > > My original goal was to duplicate, more or less, what the PackRat guys did > to get the TruePosition boards up and functional as described here: > > <http://www.packratvhf.com/A%20Packrat%20GPS%20Receiver%20Project.pdf> > > I did get in touch with them and they forwarded the HEX files. I haven't > tried them yet, but another list member did try them without success. > > I figured, as a learning exercise, I'd program up my own interface. The > boards do not talk NMEA...but output their own format of message. One > message contains GPS time in seconds...plus the number of leap seconds that > have elapsed, so my goal there was to convert the GPS time from the unit > into normal UTC date and time. > > On 5/14/2017 12:38 PM, Chris Albertson wrote: > >> Unless this is an educational exercise I'd move to a different processor. >> One of those $3 Arm M3 units has enough memory AND a more standard >> development environment that you could use a standard library function to >> do what you need. >> > > It is an educational exercise...but I'm still going to look into this. > Another list member suggested a different Arduino board that had two real > serial ports, as right now the Uno board I'm using only has one hardware > serial port with a second duplicated in software. (one port talks to the > TruePosition board...the other is debugging output port) > > I did happen to recall that I included a Teensy-LC board (Cortex M0) in a > recent OSHPark PCB order...and it appears to have three hardware serial > ports...so this may be the way I go eventually. > > One of the reasons I liked the Uno was due to all the tutorials and > example code floating around...plus the nice selection of libraries...as > I'm not a programmer. My code would probably make a real programmer lose > his or her lunch. :( > > thanks much, > ben > _______________________________________________ > time-nuts mailing list -- time-nuts@febo.com > To unsubscribe, go to https://www.febo.com/cgi-bin/m > ailman/listinfo/time-nuts > and follow the instructions there. > -- Chris Albertson Redondo Beach, California
JG
Jay Grizzard
Mon, May 15, 2017 6:44 AM

Also consider the $16 Chip Pro (https://getchip.com/pages/chippro),
which runs linux and thus lets you write normal code for the normal
things.

They also have a $9 more arduino-like version (still runs linux)

-j

On Sun, May 14, 2017 at 11:22:57PM -0700, Chris Albertson wrote:

Are you still going for Sidereal time?  If so that is floating point

The ARM processor unlike the Arduino does not have fixed pin assignment.
Typically there are many UARTS, I2C interfaces, ADC units and so on more
than there are physical pins.  Within some limits you assign functions to
pins in software.    Some you don't need to make a special board at OSHPark
with three serial ports.  You can move the serial function to the pins you
like.

That said, moving functions to pins is an "advanced" software art.  So to
make it easy for normal people the development environment will have some
easy way to do this and some limits too.

You can program most ARM M boards using Arduino but that IDE while day to
use is limited.  The next step up is "mbed" which is much more capable and
lets you move some functions to some pins the IDE is web based so there is
no software to install.  (OK you can work locally if you like.  There are
several ways to do that.

This is my favorite under $2 boards now
http://www.ebay.com/itm/STM32F103C8T6
http://www.ebay.com/itm/STM32F103C8T6-ARM-STM32-Minimum-System-Development-Board-Module-For-Arduino-/192181979870?hash=item2cbef04ade:g:pBgAAOSwvihY8r-0
The specs are literally an order of magnitude over Arduino and at under $2
shipped thrice is right.  These are Arm Cortex M3 in the size of a large
1970's vintage DIP chip.  Google the P/N for loads of information    This
parts works on bed and arduino IDEs  as well as simply using the gcc arm
compiler.

The other one I use is Nucleo F401RE
These are $13 each and unlike the above have loads of 1st rate
documentations written by a US company ST Micro.
https://developer.mbed.org/platforms/ST-Nucleo-F401RE/
Yes you can snap off the programmer and reconnect it with jumpers or leave
it on.  Even if you leave it on you can use it to program the STM32F103.
Saves you from having to buy an Chinese clone ST-Link dongle.

TheF401RE is the "classic" part that most example programs have beed tested
on but I'd buy the F446RE for $1 more.  It's twice as fast and has more RAM.

The mbed IDE lets  you use most C source code you can find and it runs a
real time OS.    Arduino is still hands down the easiest environment to
learn and it runs at 5 volts.  I keep one for testing 5V hardware.  All the
arm stuff is 3v3

Most any ARM board can run with the Arduino IDE it some one wrote a boot
loader for it.  The mbed boards don't use bootloders.  They "look" like a
flash drive to your PC so all you do is drag and drop the BIN file to the
flash drive and the board then runs whatever case to dropped there.

One more bit of advice.  Buy a logic analyzer.  I was using one today and
mad it save a LOT of time debugging when you can see what data is on the
pins.  Logic analyzers used to be expensive but one god enough for this
kind of work is now under $10 for a Saleae clone
http://www.ebay.com/itm/24MHz-8CH-USB-Logic-Analyzer-24MHz-8-Channel-Compatible-to-Saleae
http://www.ebay.com/itm/24MHz-8CH-USB-Logic-Analyzer-24MHz-8-Channel-Compatible-to-Saleae-ARM-FPGA-M100-/272337085235?hash=item3f688e2333:g:RNcAAOSwPCVYBD2b
They work like a scope for digital and can do protocol decoding show the
data going over a cable.

On Sun, May 14, 2017 at 2:16 PM, Ben Hall kd5byb@gmail.com wrote:

Hi Chris and list,

My original goal was to duplicate, more or less, what the PackRat guys did
to get the TruePosition boards up and functional as described here:

http://www.packratvhf.com/A%20Packrat%20GPS%20Receiver%20Project.pdf

I did get in touch with them and they forwarded the HEX files.  I haven't
tried them yet, but another list member did try them without success.

I figured, as a learning exercise, I'd program up my own interface.  The
boards do not talk NMEA...but output their own format of message.  One
message contains GPS time in seconds...plus the number of leap seconds that
have elapsed, so my goal there was to convert the GPS time from the unit
into normal UTC date and time.

On 5/14/2017 12:38 PM, Chris Albertson wrote:

Unless this is an educational exercise I'd move to a different processor.
One of those $3 Arm M3 units has enough  memory AND a more standard
development environment that you could use a standard library function to
do what you need.

It is an educational exercise...but I'm still going to look into this.
Another list member suggested a different Arduino board that had two real
serial ports, as right now the Uno board I'm using only has one hardware
serial port with a second duplicated in software.  (one port talks to the
TruePosition board...the other is debugging output port)

I did happen to recall that I included a Teensy-LC board (Cortex M0) in a
recent OSHPark PCB order...and it appears to have three hardware serial
ports...so this may be the way I go eventually.

One of the reasons I liked the Uno was due to all the tutorials and
example code floating around...plus the nice selection of libraries...as
I'm not a programmer.  My code would probably make a real programmer lose
his or her lunch.  :(

thanks much,
ben


time-nuts mailing list -- time-nuts@febo.com
To unsubscribe, go to https://www.febo.com/cgi-bin/m
ailman/listinfo/time-nuts
and follow the instructions there.

--

Chris Albertson
Redondo Beach, California


time-nuts mailing list -- time-nuts@febo.com
To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
and follow the instructions there.

Also consider the $16 Chip Pro (https://getchip.com/pages/chippro), which runs linux and thus lets you write normal code for the normal things. They also have a $9 more arduino-like version (still runs linux) -j On Sun, May 14, 2017 at 11:22:57PM -0700, Chris Albertson wrote: > Are you still going for Sidereal time? If so that is floating point > > The ARM processor unlike the Arduino does not have fixed pin assignment. > Typically there are many UARTS, I2C interfaces, ADC units and so on more > than there are physical pins. Within some limits you assign functions to > pins in software. Some you don't need to make a special board at OSHPark > with three serial ports. You can move the serial function to the pins you > like. > > That said, moving functions to pins is an "advanced" software art. So to > make it easy for normal people the development environment will have some > easy way to do this and some limits too. > > You can program most ARM M boards using Arduino but that IDE while day to > use is limited. The next step up is "mbed" which is much more capable and > lets you move some functions to some pins the IDE is web based so there is > no software to install. (OK you can work locally if you like. There are > several ways to do that. > > This is my favorite under $2 boards now > http://www.ebay.com/itm/STM32F103C8T6 > <http://www.ebay.com/itm/STM32F103C8T6-ARM-STM32-Minimum-System-Development-Board-Module-For-Arduino-/192181979870?hash=item2cbef04ade:g:pBgAAOSwvihY8r-0> > The specs are literally an order of magnitude over Arduino and at under $2 > shipped thrice is right. These are Arm Cortex M3 in the size of a large > 1970's vintage DIP chip. Google the P/N for loads of information This > parts works on bed and arduino IDEs as well as simply using the gcc arm > compiler. > > The other one I use is Nucleo F401RE > These are $13 each and unlike the above have loads of 1st rate > documentations written by a US company ST Micro. > https://developer.mbed.org/platforms/ST-Nucleo-F401RE/ > Yes you can snap off the programmer and reconnect it with jumpers or leave > it on. Even if you leave it on you can use it to program the STM32F103. > Saves you from having to buy an Chinese clone ST-Link dongle. > > TheF401RE is the "classic" part that most example programs have beed tested > on but I'd buy the F446RE for $1 more. It's twice as fast and has more RAM. > > The mbed IDE lets you use most C source code you can find and it runs a > real time OS. Arduino is still hands down the easiest environment to > learn and it runs at 5 volts. I keep one for testing 5V hardware. All the > arm stuff is 3v3 > > Most any ARM board can run with the Arduino IDE it some one wrote a boot > loader for it. The mbed boards don't use bootloders. They "look" like a > flash drive to your PC so all you do is drag and drop the BIN file to the > flash drive and the board then runs whatever case to dropped there. > > > One more bit of advice. Buy a logic analyzer. I was using one today and > mad it save a LOT of time debugging when you can see what data is on the > pins. Logic analyzers used to be expensive but one god enough for this > kind of work is now under $10 for a Saleae clone > http://www.ebay.com/itm/24MHz-8CH-USB-Logic-Analyzer-24MHz-8-Channel-Compatible-to-Saleae > <http://www.ebay.com/itm/24MHz-8CH-USB-Logic-Analyzer-24MHz-8-Channel-Compatible-to-Saleae-ARM-FPGA-M100-/272337085235?hash=item3f688e2333:g:RNcAAOSwPCVYBD2b> > They work like a scope for digital and can do protocol decoding show the > data going over a cable. > > > On Sun, May 14, 2017 at 2:16 PM, Ben Hall <kd5byb@gmail.com> wrote: > > > Hi Chris and list, > > > > My original goal was to duplicate, more or less, what the PackRat guys did > > to get the TruePosition boards up and functional as described here: > > > > <http://www.packratvhf.com/A%20Packrat%20GPS%20Receiver%20Project.pdf> > > > > I did get in touch with them and they forwarded the HEX files. I haven't > > tried them yet, but another list member did try them without success. > > > > I figured, as a learning exercise, I'd program up my own interface. The > > boards do not talk NMEA...but output their own format of message. One > > message contains GPS time in seconds...plus the number of leap seconds that > > have elapsed, so my goal there was to convert the GPS time from the unit > > into normal UTC date and time. > > > > On 5/14/2017 12:38 PM, Chris Albertson wrote: > > > >> Unless this is an educational exercise I'd move to a different processor. > >> One of those $3 Arm M3 units has enough memory AND a more standard > >> development environment that you could use a standard library function to > >> do what you need. > >> > > > > It is an educational exercise...but I'm still going to look into this. > > Another list member suggested a different Arduino board that had two real > > serial ports, as right now the Uno board I'm using only has one hardware > > serial port with a second duplicated in software. (one port talks to the > > TruePosition board...the other is debugging output port) > > > > I did happen to recall that I included a Teensy-LC board (Cortex M0) in a > > recent OSHPark PCB order...and it appears to have three hardware serial > > ports...so this may be the way I go eventually. > > > > One of the reasons I liked the Uno was due to all the tutorials and > > example code floating around...plus the nice selection of libraries...as > > I'm not a programmer. My code would probably make a real programmer lose > > his or her lunch. :( > > > > thanks much, > > ben > > _______________________________________________ > > time-nuts mailing list -- time-nuts@febo.com > > To unsubscribe, go to https://www.febo.com/cgi-bin/m > > ailman/listinfo/time-nuts > > and follow the instructions there. > > > > > > -- > > Chris Albertson > Redondo Beach, California > _______________________________________________ > time-nuts mailing list -- time-nuts@febo.com > To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts > and follow the instructions there.
TF
Tony Finch
Mon, May 15, 2017 9:34 AM

Tom Van Baak tvb@LeapSecond.com wrote:

32-bit integers is sufficient. Use days instead of seconds. Use MJD
instead of JD. Here's an example:

Step 1, convert calendar date to MJD, and then to GPS day:

Mark was asking for the reverse calculation, which is a bit trickier :-)

My version is at http://fanf.livejournal.com/93771.html

Wikipedia has a version
https://en.wikipedia.org/wiki/Julian_day#Julian_or_Gregorian_calendar_from_Julian_day_number

Tony.

f.anthony.n.finch  dot@dotat.at  http://dotat.at/  -  I xn--zr8h punycode
Shannon, South Rockall: Southerly becoming cyclonic in west, 5 to 7,
occasionally gale 8. Rough or very rough. Occasional rain. Moderate or poor,
occasionally good.

Tom Van Baak <tvb@LeapSecond.com> wrote: > > 32-bit integers is sufficient. Use days instead of seconds. Use MJD > instead of JD. Here's an example: > > Step 1, convert calendar date to MJD, and then to GPS day: Mark was asking for the reverse calculation, which is a bit trickier :-) My version is at http://fanf.livejournal.com/93771.html Wikipedia has a version https://en.wikipedia.org/wiki/Julian_day#Julian_or_Gregorian_calendar_from_Julian_day_number Tony. -- f.anthony.n.finch <dot@dotat.at> http://dotat.at/ - I xn--zr8h punycode Shannon, South Rockall: Southerly becoming cyclonic in west, 5 to 7, occasionally gale 8. Rough or very rough. Occasional rain. Moderate or poor, occasionally good.
BH
Ben Hall
Mon, May 15, 2017 8:49 PM

Hi Chris and list,

On 5/15/2017 1:22 AM, Chris Albertson wrote:

Are you still going for Sidereal time?  If so that is floating point

I'm not sure how Sidereal time came up...it wasn't one of my goals and
after reading the discussion, it's going to be way past what I think I
can understand, never mind program onto anything.  ;)

This is my favorite under $2 boards now - http://r.ebay.com/9UasSq

That blows my mind!  $1.62 shipped.  Amazing!  I read what you wrote on
different boards and I've got a lot of poking around and reading to do.
The idea of dropping a file onto a USB-looking drive is very appealing
to me.  And they seem to be very cheap.  To be honest, being more
towards the "idiot" end of the embedded programming spectrum, I'm really
thinking I should stay with slower, simpler, and more well documented
stuff.  If I knew what I was doing...I'd probably be ordering up some of
cheaper, more off-the-beaten-path stuff that's way less expensive.

One more bit of advice.  Buy a logic analyzer.  I was using one today and

I've been on the lookout for a dedicated bench one at a good price...but
nothing has tickled my fancy.  I'm going to order one of those $10
Saleae clones this evening.  That Saleae clone analyzer would be just
the ticket to see if the time information is coming from the serial port
before the 1PPS tick.  This is what is written in the little
TruePosition information we have and would be nice to verify.  :)

Thanks much and 73,
ben, kd5byb

Hi Chris and list, On 5/15/2017 1:22 AM, Chris Albertson wrote: > Are you still going for Sidereal time? If so that is floating point I'm not sure how Sidereal time came up...it wasn't one of my goals and after reading the discussion, it's going to be way past what I think I can understand, never mind program onto *anything*. ;) > This is my favorite under $2 boards now - http://r.ebay.com/9UasSq That blows my mind! $1.62 shipped. Amazing! I read what you wrote on different boards and I've got a lot of poking around and reading to do. The idea of dropping a file onto a USB-looking drive is very appealing to me. And they seem to be very cheap. To be honest, being more towards the "idiot" end of the embedded programming spectrum, I'm really thinking I should stay with slower, simpler, and more well documented stuff. If I knew what I was doing...I'd probably be ordering up some of cheaper, more off-the-beaten-path stuff that's way less expensive. > One more bit of advice. Buy a logic analyzer. I was using one today and I've been on the lookout for a dedicated bench one at a good price...but nothing has tickled my fancy. I'm going to order one of those $10 Saleae clones this evening. That Saleae clone analyzer would be just the ticket to see if the time information is coming from the serial port before the 1PPS tick. This is what is written in the little TruePosition information we have and would be nice to verify. :) Thanks much and 73, ben, kd5byb
CA
Chris Albertson
Mon, May 15, 2017 9:57 PM

That Chinese guy selling boards shipped for $1.67 is buying the boards,
paying for postage and 10% commission to eBay and STILL earning some
income.    It's an insane price and the unit is dramatically more powerful
than Arduino and $1.67 is so close to "free" that I don't care about the
difference.

But if you are looking for the simplest thing you can find, the genuine
made in Europe Arduino Uno for $30 is that.  All of the "how to use your
Arduino" examples assume you have an "Uno"  and those examples are targeted
at people who can't read schematics so they use pictures of components and
of the wire.  With an Uno you can match up the pictures to make say a LED
blink.    But then you pay $30 for a slow 8-bit computer with very little
memory.

This is the level of instruction you find with Arduino
http://fritzing.org/media/fritzing-repo/projects/l/led-blinking....
http://fritzing.org/media/fritzing-repo/projects/l/led-blinking-using-arduino/images/fritzing_bb.png

But on the "mbed" tutorial you'd expect this
https://developer.mbed.org/cookbook/Motor

Which level do you need?    I've used the $1.67 part with both Arduino and
mbed.

On Mon, May 15, 2017 at 1:49 PM, Ben Hall kd5byb@gmail.com wrote:

Hi Chris and list,

On 5/15/2017 1:22 AM, Chris Albertson wrote:

Are you still going for Sidereal time?  If so that is floating point

I'm not sure how Sidereal time came up...it wasn't one of my goals and
after reading the discussion, it's going to be way past what I think I can
understand, never mind program onto anything.  ;)

This is my favorite under $2 boards now - http://r.ebay.com/9UasSq

That blows my mind!  $1.62 shipped.  Amazing!  I read what you wrote on
different boards and I've got a lot of poking around and reading to do. The
idea of dropping a file onto a USB-looking drive is very appealing to me.
And they seem to be very cheap.  To be honest, being more towards the
"idiot" end of the embedded programming spectrum, I'm really thinking I
should stay with slower, simpler, and more well documented stuff.  If I
knew what I was doing...I'd probably be ordering up some of cheaper, more
off-the-beaten-path stuff that's way less expensive.

One more bit of advice.  Buy a logic analyzer.  I was using one today and

I've been on the lookout for a dedicated bench one at a good price...but
nothing has tickled my fancy.  I'm going to order one of those $10 Saleae
clones this evening.  That Saleae clone analyzer would be just the ticket
to see if the time information is coming from the serial port before the
1PPS tick.  This is what is written in the little TruePosition information
we have and would be nice to verify.  :)

Thanks much and 73,
ben, kd5byb


time-nuts mailing list -- time-nuts@febo.com
To unsubscribe, go to https://www.febo.com/cgi-bin/m
ailman/listinfo/time-nuts
and follow the instructions there.

--

Chris Albertson
Redondo Beach, California

That Chinese guy selling boards shipped for $1.67 is buying the boards, paying for postage and 10% commission to eBay and STILL earning some income. It's an insane price and the unit is dramatically more powerful than Arduino and $1.67 is so close to "free" that I don't care about the difference. But if you are looking for the simplest thing you can find, the genuine made in Europe Arduino Uno for $30 is that. All of the "how to use your Arduino" examples assume you have an "Uno" and those examples are targeted at people who can't read schematics so they use pictures of components and of the wire. With an Uno you can match up the pictures to make say a LED blink. But then you pay $30 for a slow 8-bit computer with very little memory. This is the level of instruction you find with Arduino http://fritzing.org/media/fritzing-repo/projects/l/led-blinking.... <http://fritzing.org/media/fritzing-repo/projects/l/led-blinking-using-arduino/images/fritzing_bb.png> But on the "mbed" tutorial you'd expect this https://developer.mbed.org/cookbook/Motor Which level do you need? I've used the $1.67 part with both Arduino and mbed. On Mon, May 15, 2017 at 1:49 PM, Ben Hall <kd5byb@gmail.com> wrote: > Hi Chris and list, > > On 5/15/2017 1:22 AM, Chris Albertson wrote: > >> Are you still going for Sidereal time? If so that is floating point >> > > I'm not sure how Sidereal time came up...it wasn't one of my goals and > after reading the discussion, it's going to be way past what I think I can > understand, never mind program onto *anything*. ;) > > This is my favorite under $2 boards now - http://r.ebay.com/9UasSq >> > > That blows my mind! $1.62 shipped. Amazing! I read what you wrote on > different boards and I've got a lot of poking around and reading to do. The > idea of dropping a file onto a USB-looking drive is very appealing to me. > And they seem to be very cheap. To be honest, being more towards the > "idiot" end of the embedded programming spectrum, I'm really thinking I > should stay with slower, simpler, and more well documented stuff. If I > knew what I was doing...I'd probably be ordering up some of cheaper, more > off-the-beaten-path stuff that's way less expensive. > > One more bit of advice. Buy a logic analyzer. I was using one today and >> > > I've been on the lookout for a dedicated bench one at a good price...but > nothing has tickled my fancy. I'm going to order one of those $10 Saleae > clones this evening. That Saleae clone analyzer would be just the ticket > to see if the time information is coming from the serial port before the > 1PPS tick. This is what is written in the little TruePosition information > we have and would be nice to verify. :) > > Thanks much and 73, > ben, kd5byb > > _______________________________________________ > time-nuts mailing list -- time-nuts@febo.com > To unsubscribe, go to https://www.febo.com/cgi-bin/m > ailman/listinfo/time-nuts > and follow the instructions there. > -- Chris Albertson Redondo Beach, California
CA
Chris Albertson
Mon, May 15, 2017 10:01 PM

On Mon, May 15, 2017 at 1:49 PM, Ben Hall kd5byb@gmail.com wrote:

Hi Chris and list,

On 5/15/2017 1:22 AM, Chris Albertson wrote:

Are you still going for Sidereal time?  If so that is floating point

I'm not sure how Sidereal time came up...it wasn't one of my goals and
after reading the discussion, it's going to be way past what I think I can
understand, never mind program onto anything.  ;)

This is my favorite under $2 boards now - http://r.ebay.com/9UasSq

That blows my mind!  $1.62 shipped.  Amazing!  I read what you wrote on
different boards and I've got a lot of poking around and reading to do. The
idea of dropping a file onto a USB-looking drive is very appealing to me.
And they seem to be very cheap.  To be honest, being more towards the
"idiot" end of the embedded programming spectrum, I'm really thinking I
should stay with slower, simpler, and more well documented stuff.  If I
knew what I was doing...I'd probably be ordering up some of cheaper, more
off-the-beaten-path stuff that's way less expensive.

One more bit of advice.  Buy a logic analyzer.  I was using one today and

I've been on the lookout for a dedicated bench one at a good price...but
nothing has tickled my fancy.  I'm going to order one of those $10 Saleae
clones this evening.  That Saleae clone analyzer would be just the ticket
to see if the time information is coming from the serial port before the
1PPS tick.  This is what is written in the little TruePosition information
we have and would be nice to verify.  :)

Thanks much and 73,
ben, kd5byb


time-nuts mailing list -- time-nuts@febo.com
To unsubscribe, go to https://www.febo.com/cgi-bin/m
ailman/listinfo/time-nuts
and follow the instructions there.

--

Chris Albertson
Redondo Beach, California

On Mon, May 15, 2017 at 1:49 PM, Ben Hall <kd5byb@gmail.com> wrote: > Hi Chris and list, > > On 5/15/2017 1:22 AM, Chris Albertson wrote: > >> Are you still going for Sidereal time? If so that is floating point >> > > I'm not sure how Sidereal time came up...it wasn't one of my goals and > after reading the discussion, it's going to be way past what I think I can > understand, never mind program onto *anything*. ;) > > This is my favorite under $2 boards now - http://r.ebay.com/9UasSq >> > > That blows my mind! $1.62 shipped. Amazing! I read what you wrote on > different boards and I've got a lot of poking around and reading to do. The > idea of dropping a file onto a USB-looking drive is very appealing to me. > And they seem to be very cheap. To be honest, being more towards the > "idiot" end of the embedded programming spectrum, I'm really thinking I > should stay with slower, simpler, and more well documented stuff. If I > knew what I was doing...I'd probably be ordering up some of cheaper, more > off-the-beaten-path stuff that's way less expensive. > > One more bit of advice. Buy a logic analyzer. I was using one today and >> > > I've been on the lookout for a dedicated bench one at a good price...but > nothing has tickled my fancy. I'm going to order one of those $10 Saleae > clones this evening. That Saleae clone analyzer would be just the ticket > to see if the time information is coming from the serial port before the > 1PPS tick. This is what is written in the little TruePosition information > we have and would be nice to verify. :) > > Thanks much and 73, > ben, kd5byb > > _______________________________________________ > time-nuts mailing list -- time-nuts@febo.com > To unsubscribe, go to https://www.febo.com/cgi-bin/m > ailman/listinfo/time-nuts > and follow the instructions there. > -- Chris Albertson Redondo Beach, California
AR
Andrew Rodland
Tue, May 16, 2017 8:40 AM

On Sat, May 13, 2017 at 9:58 PM, Mark Sims holrum@hotmail.com wrote:

Converting GPS seconds to Gregorian date/time on the Arduino will be an arduous task.  You take GPS seconds and add it to the GPS starring epoch to get a Julian date.  Then add in the number of leap seconds as a fraction of a day to get UTC and possibly add in a time zone offset for local time.  Don't forget to do daylight savings time conversion...  Then convert the result to Gregorian date/time for display.

The problem is the Arduino floating point library is single precision only and does not have the resolution needed to handle the numbers involved.  Doing it with integer arithmetic (long longs) opens up a whole new can of worms.

My old Arduino NTP server (the new one is built on an ARM chip)
converted from GPS time to NTP time (which is a 32.32 bit unsigned
fixed point format, at least for v3) without any particular trouble.
Given GPS week, (integer) GPS TOW, fractional seconds, and UTC
difference in separate variables, the code amounted to:

  1. Start with 2,524,953,600 (the number of seconds between the NTP
    epoch (1900-01-01) and the GPS epoch (1980-01-06); for the Unix epoch
    of 1970-01-01 you would need 315,964,800 instead.)
  2. Subtract the current GPS-UTC difference (leap second count).
  3. Add 604,800 times the GPS week.
  4. Add the TOW.
  5. Store this value in the upper 32 bits of the output.
  6. Convert fractional seconds from whatever units they're in, to units
    of 2^-32 second using an appropriate fixed-point multiply, and store
    the result in the lower 32 bits of the output.

Calendrical stuff is of course its own pain, but it's still true that
you can work with whole seconds (or even whole days) there, and deal
with fractions separately, without ever touching floating-point.
Fixed-point is extra work, but if you make the right choices it's
not much extra work. Depending on your application, you can of
course lose some (or all) of the lower bits in the fractional part,
and if you have the ability to choose your epoch to be relatively
close to the present, you can lose upper bits of the integer part.
It's worth noting that since the AVR is fundamentally an 8-bit
processor and all arithmetic on larger quantities has to be
synthesized from 8-bit operations anyway, AVR-GCC helpfully provides
__int24 and __uint24 types, as there's no good reason not to. That
means that if you want to do 24.8 fixed-point, you can.

On Sat, May 13, 2017 at 9:58 PM, Mark Sims <holrum@hotmail.com> wrote: > Converting GPS seconds to Gregorian date/time on the Arduino will be an arduous task. You take GPS seconds and add it to the GPS starring epoch to get a Julian date. Then add in the number of leap seconds as a fraction of a day to get UTC and possibly add in a time zone offset for local time. Don't forget to do daylight savings time conversion... Then convert the result to Gregorian date/time for display. > > The problem is the Arduino floating point library is single precision only and does not have the resolution needed to handle the numbers involved. Doing it with integer arithmetic (long longs) opens up a whole new can of worms. My old Arduino NTP server (the new one is built on an ARM chip) converted from GPS time to NTP time (which is a 32.32 bit unsigned fixed point format, at least for v3) without any particular trouble. Given GPS week, (integer) GPS TOW, fractional seconds, and UTC difference in separate variables, the code amounted to: 1. Start with 2,524,953,600 (the number of seconds between the NTP epoch (1900-01-01) and the GPS epoch (1980-01-06); for the Unix epoch of 1970-01-01 you would need 315,964,800 instead.) 2. Subtract the current GPS-UTC difference (leap second count). 3. Add 604,800 times the GPS week. 4. Add the TOW. 5. Store this value in the upper 32 bits of the output. 6. Convert fractional seconds from whatever units they're in, to units of 2^-32 second using an appropriate fixed-point multiply, and store the result in the lower 32 bits of the output. Calendrical stuff is of course its own pain, but it's still true that you can work with whole seconds (or even whole days) there, and deal with fractions separately, without ever touching floating-point. Fixed-point *is* extra work, but if you make the right choices it's not *much* extra work. Depending on your application, you can of course lose some (or all) of the lower bits in the fractional part, and if you have the ability to choose your epoch to be relatively close to the present, you can lose upper bits of the integer part. It's worth noting that since the AVR is fundamentally an 8-bit processor and all arithmetic on larger quantities has to be synthesized from 8-bit operations anyway, AVR-GCC helpfully provides __int24 and __uint24 types, as there's no good reason not to. That means that if you want to do 24.8 fixed-point, you can.
TS
Tim Shoppa
Tue, May 16, 2017 10:29 AM

Since future leap seconds aren't known very far in advance, how wise is it
to even claim to handle any possible leap second or time scale conversion,
in a firmware-controlled device that cannot download future leap second
information from the Internet?

The GPS itself presumably knows how to handle leap seconds at the moment
with possibly minor glitches.

If you can connect to the Internet, then I think you're good for maybe the
next few decades until the current concepts of "web" and "URL" and
"internet" become as hopelessly outdated as Telex addresses. I think the
URL concept probably has at least a decade left in it, and that's
considerably longer than the couple-times-a-year possibility of a leap
second, so leap second file downloads from IETF would seem to make sense if
you claim to handle such conversions.

The "future-proofing" of your time conversion is not a new issue. When I
read century-old articles about gear ratios for converting solar to
sidereal time (*) , they note that you should not try to get too many
digits of precision because they knew that the length of the solar day had
real and unpredictable variances even back then. One author notes that if
you want your gear ratio to work well for the next 100 years, you should
use the ratio appropriate for 50 years into the future, not today.

Now admittedly, microcontrollers generally don't last as long as a set of
gears :-)

Tim

On Sat, May 13, 2017 at 9:58 PM, Mark Sims holrum@hotmail.com wrote:

Converting GPS seconds to Gregorian date/time on the Arduino will be an
arduous task.  You take GPS seconds and add it to the GPS starring epoch to
get a Julian date.  Then add in the number of leap seconds as a fraction of
a day to get UTC and possibly add in a time zone offset for local time.
Don't forget to do daylight savings time conversion...  Then convert the
result to Gregorian date/time for display.

The problem is the Arduino floating point library is single precision only
and does not have the resolution needed to handle the numbers involved.
Doing it with integer arithmetic (long longs) opens up a whole new can of
worms.


time-nuts mailing list -- time-nuts@febo.com
To unsubscribe, go to https://www.febo.com/cgi-bin/
mailman/listinfo/time-nuts
and follow the instructions there.

Since future leap seconds aren't known very far in advance, how wise is it to even claim to handle any possible leap second or time scale conversion, in a firmware-controlled device that cannot download future leap second information from the Internet? The GPS itself presumably knows how to handle leap seconds at the moment with possibly minor glitches. If you can connect to the Internet, then I think you're good for maybe the next few decades until the current concepts of "web" and "URL" and "internet" become as hopelessly outdated as Telex addresses. I think the URL concept probably has at least a decade left in it, and that's considerably longer than the couple-times-a-year possibility of a leap second, so leap second file downloads from IETF would seem to make sense if you claim to handle such conversions. The "future-proofing" of your time conversion is not a new issue. When I read century-old articles about gear ratios for converting solar to sidereal time (*) , they note that you should not try to get too many digits of precision because they knew that the length of the solar day had real and unpredictable variances even back then. One author notes that if you want your gear ratio to work well for the next 100 years, you should use the ratio appropriate for 50 years into the future, not today. Now admittedly, microcontrollers generally don't last as long as a set of gears :-) Tim On Sat, May 13, 2017 at 9:58 PM, Mark Sims <holrum@hotmail.com> wrote: > Converting GPS seconds to Gregorian date/time on the Arduino will be an > arduous task. You take GPS seconds and add it to the GPS starring epoch to > get a Julian date. Then add in the number of leap seconds as a fraction of > a day to get UTC and possibly add in a time zone offset for local time. > Don't forget to do daylight savings time conversion... Then convert the > result to Gregorian date/time for display. > > The problem is the Arduino floating point library is single precision only > and does not have the resolution needed to handle the numbers involved. > Doing it with integer arithmetic (long longs) opens up a whole new can of > worms. > _______________________________________________ > time-nuts mailing list -- time-nuts@febo.com > To unsubscribe, go to https://www.febo.com/cgi-bin/ > mailman/listinfo/time-nuts > and follow the instructions there. >