RaspAstro Web – Displaying Interesting Astro Info…

Either the Moon has be bright or the skies have been cloudy so I have not had the opportunity to get out and observe in the past week. I have been working on the RaspAstro project. I initially started this project as a way to automate the builds of different software packages I use for observing on the Raspberry Pi but recently I have been tinkering with using python to display interesting (IMHO) and useful (again IMHO) astronomical data. I am calling this part of the project the “RaspAstro Web”.

You can download my RaspAstro project from here. If you do not want to install all the RaspAstro dependencies you will need the following python modules: gps3, ephem, Flask, and folium.

I created two classes: AstroData from raspastroinfo.py, and ISSData from raspissinfo.py. The classes use PyEphem to set up the observer information and compute the astronomical data for the Sun, Moon, and Planets (AstroData) and the ISS information (ISSData). I could do all of this using just PyEphem with out creating classes, but this simplified the code in my other scripts a fair bit and makes it easier to reuse data and functions.

There is a set of functions in rasp_calc_func.py to do things like convert UTC time to local time (to_local(time)), convert meters to miles (meters_to_miles(meters)), convert a timestamp to be more human readable (time_to_human(time)), and convert decimal degrees to degrees, minutes, seconds (convert_dd_to_dms(dd)). I have a few more things which are repeated that I will likely move here. I need to add some more comments and docstrings to the functions, I’ll get to it. There are likely better/easier/less complicated ways to do most of these things, but I am learning and I tend to overthink/complicate simple processes.

Currently RaspAstro Web requires GPS data obtained from GPSD, I am going to update it so you can specify a static GPS location and not use GPS. It also requires access to INDI Web Manager (can be local or remote), but I am going to work to make that optional as well.

There is an examples.py that shows how the classes and functions are used.

I used Flask to create a web application to display the data generated by the AstroData and ISSData classes. I currently have the data broken out into three categories: Observer, Solar System, and ISS. Each of these categories is represented by a button. Since most of the data (most… more on that in a bit) is static from the time the page was loaded the Refresh Data button refreshes all the data across all the categories.

To install just clone the raspastro project using git:

mkdir -p ~/Projects
cd ~/Projects
git clone https://github.com/herseyc/raspastro.git

To start the web application run:

cd ~/Projects/raspastro/status
python3 raspastro-web.py

This starts the web application on port 5000. Once running it can be accessed from a browser at http://IPofRaspBerryPi:5000/. I am still working out how to get this to start and run as a service.

The Observer page displays information about the current observer with a folium generated map with a marker showing the observer’s current location. The location information is obtained from GPSD using agps3 from gps3 module. The observer data and map is static and only updates if you click the “Refresh Data” button.
RaspAstro - Observer and INDI Information
This page also displays the current INDI server status. This data is obtained from the INDI Web Manager API. The INDI Web Manager can be running locally (default is http://localhost:8624) or on remotely accessible server (this is configured by setting INDIWEBMANAGER_API_ENDPOINT in raspastro-web.py).

The INDI Status information is in an iframe which refreshes every 30 seconds. Currently it displays if the INDI server is running, the active profile, and the running drivers. I am probably going to add the ability to start a Profile and restart a driver at some point, both of these actions are available in the INDI Web Manager API.

The Solar System page shows information about the current altitude of the Sun (a negative altitude means it is below the horizon), sunset and sunrise, next equinox and solstice, the altitude and phase of the Moon, next Full and New Moons, and some information about each of the planets. The data on the solar system page is all static and only updates if the “Refresh Data” button in pressed.
RaspAstro Solar System Data - Sun, Moon, and Planets
As with the Sun, a negative altitude means the Moon or planet is below the horizon. The planets also show the current distance from the Sun and the Earth in AU. I plan to add if the Sun and Moon is setting or rising.

The ISS page displays information about the ISS and upcoming passes which will be visible from the observer’s location (visible means at night and not in the Earth’s shadow). I am getting the TLE data for the ISS from Celestrak.org once per day and writing it to a file (isstle.data). Then reading that tle data into PyEphem to compute the ISS location information.
RaspAstro - ISS Data - ISS Position and Upcoming Visible Passes
The ISS information is displayed in an iframe which refreshed every 30 seconds. The map is generated using folium with markers for the observer’s location (from GPSD using the gps3 module) and the current geocentric location of the ISS (computed by ISSData).

The visible passes over the observer’s location are displayed for the configured number of days (PASSDAYS in raspastro-web.py the default is 5). I am using the Sun’s altitude to determine if the pass is at night, if the altitude is >0 then the Sun is above the horizon and the pass would be in the daylight.

I will might work on adapting the ISS page to be public facing… at some point… maybe… I probably should do some better error and exception checking first so when things go sideways the web application doesn’t just crash… so much to probably do it should keep me busy when the skies are no good.

Pretty happy with how this part of the RaspAstro project came together and I learned a lot doing it. As I learn more I will continue to add to and improve it. If you happen to give it a try please let me know down in the comments or if you run into issues post it on the RaspAstro github issues page.

RaspAstro is completely free to use, copy, modify, distribute, whatever. With that said, I have done a fair bit of testing but use at your own risk.

Check it out, would love to hear what you think.

Leave a Reply

Your email address will not be published. Required fields are marked *

one × 1 =