Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 16:33 16 May 2026 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 : Another question about ASTRO

Author Message
PhilP

Regular Member

Joined: 25/01/2017
Location: United Kingdom
Posts: 41
Posted: 08:19am 13 May 2026
Copy link to clipboard 
Print this post

Good morning. I have been following at a distance Peter's extremely clever astronomy developments. I have been trying to calculate sunrise and sunset times using various algorithms from NASA and TassyJim's previous programmes but none seem to give a sensible result. There was a simple version of the FotS but it isn't there any more.
I am assuming that the maths needed to do the sunrise/sunset calculations are in some form behind the scenes in the ASTRO function. My question is could ASTRO be used to calculate sunrise and sunset times? From my reading of the function I think I would have to do iterative calculations testing date and time at a LOCATION and look for a sun elevation of zero.
Thanks for any feedback
Phil
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 4321
Posted: 09:26am 13 May 2026
Copy link to clipboard 
Print this post

Do you know what it was called on FotS?  It may be on archive.org or someone may have a copy.

John
 
BarryH

Regular Member

Joined: 05/01/2025
Location: Australia
Posts: 41
Posted: 10:18am 13 May 2026
Copy link to clipboard 
Print this post

Quick & Dirty Daylight Indicator, perhaps
https://fruitoftheshed.com/wiki/doku.php?id=mmbasic:quick_and_dirty_daylight_indicator
BarryH
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 11319
Posted: 10:41am 13 May 2026
Copy link to clipboard 
Print this post

You can use the astro command to do this by iterating when the sun is at 5 degrees below the horizon
 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3751
Posted: 01:37pm 13 May 2026
Copy link to clipboard 
Print this post

I use this Annex Basic code. If it would give you a suitable answer, you should be able to modify it for MMBasic. I asked for the "civil_twilight" value.

dawndusk:
 aa1$="https://api.sunrise-sunset.org/json?"
 aa2$="lat=44.0&lng=-64.7&tzid=America/Halifax"
 aa$=wget$(aa1$+aa2$)
 dawn$="06:50:00" ' AM
 dusk$="17:37:00" ' PM
 if instr(aa$,"No Data") = 0 then
   dawn$=json$(aa$,"results.civil_twilight_begin")
   wlog "dawn: "+dawn$
   dusk$=json$(aa$,"results.civil_twilight_end")
   dusk$=str$(val(mid$(dusk$,1,1))+12)+mid$(dusk$,2) ' 12-hour clock
   wlog "dusk: "+json$(aa$,"results.civil_twilight_end")
 endif
 return


(wlog is print to a console)
PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on FOTS
 
PhilP

Regular Member

Joined: 25/01/2017
Location: United Kingdom
Posts: 41
Posted: 03:09pm 13 May 2026
Copy link to clipboard 
Print this post

Thanks everyone.
@JohnS - I thought it had sunset in its title and there doesn't appear to be  a title like that on FotS. However the file @BarryH pointed me at at was probably what i remembered.
@Peter - I want to try the ASTRO method but I have now found the old program I remember  from the Forum - attached.  I have adapted it to my location and the result is within a minute of the official sunset/sunrise times. I plan to run it on a MX170 but it is needed only once a day.
@lizby - thanks for the Annex code - I use them extensively for applications IoT projects monitoring parameters to upload to Thingspeak for example. I wanted the MX170 to be independent of the internet so the calculation method was the solution.
Phil

sunset_rise back shed original.zip
 
barewires
Newbie

Joined: 13/04/2015
Location: United Kingdom
Posts: 34
Posted: 03:11am 16 May 2026
Copy link to clipboard 
Print this post

I have been using the free BASIC programs from Sky and Telescope since the mid 80s.
https://skyandtelescope.org/astronomy-resources/basic-programs-from-sky-telescope/
 
Print this page


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

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2026