Free time projects

  • Nick's Planetarium
    A fork project based on Stuart Lowe's Virtualsky.
    I've added some new features:
    • Interactive side menu
    • Major stars labels (color coded)
    • 41057 stars (up to Mag.8) from Hipparcos catalogue
    • Sun and Planets surfaces
    • Image for each star from Aladin Sky Atlas
    • Whole Messier's and NGC's object catalogue, with image as well
    • Ceres and Pallas asteroids
    • Some major Comet
    • Jupiter's Galileian moons position (at any time)
    • Earth's Moon phases (at any time)
    • Desktop layout only (responsive design still to do, sorry)

    See it in action!
  • Jupiter's Galilean Satellites
    A brand new U.I. and some new features for the Sky and Telescope utility:
    • Enhanced graphics
    • Satellites images and data
    • More clear transit and occultation
    • Time autoplay in different speeds (forward and reverse)
    • Night view (red color)
    • Desktop layout only (responsive design still to do, sorry)

    See it in action!
  • Moon's phases
    Project based on Salvatore Ruiu's astro.js library:
    • Enhanced graphics
    • Moon's data
    • Next 4 phases
    • Forward/Reverse Manual Time
    • Desktop/Smartphone layout

    See it in action!
  • When is I.S.S. visible over my head?
    I had the opportunity to teach a lesson about programming to teenager boys and girls at a school meeting showing Raspberry power.
    The following script is the result of the 2 hour lesson: it puts together some interesting things you can do with Pyhton language.

    If people you're teaching to aren't skilled enough you can show one/two task per lesson.

    • First task: retrieve information about the International Space Station position at current time by public API service (also log it in a file).
    • Second task: given the ISS position, check if it's in a visible range by observer's latitude and longitude position.
    • Third task: plot on a world map the approximate position by using coordinates.
    • Fourth task: send an alert email to the observer with attached plotted map image.

    Note that the script also retrieves crew members number and astronauts names.

    To make the code running you have to put it in crontab: we scheduled it every 3 minutes (yep, ISS is very fast!)
    Here is the code, feel free to get it.
    If you are a teacher and you show it in a lesson... please let me know what the attendants say ;-)

    Copy to clipboard
    import os, requests, email, smtplib, ssl, time, datetime, logging, matplotlib
    import matplotlib.pyplot as plt
    from matplotlib.patches import Circle
    from email import encoders
    from email.mime.base import MIMEBase
    from email.mime.multipart import MIMEMultipart
    from email.mime.text import MIMEText
    from email.mime.application import MIMEApplication
    from logging.handlers import TimedRotatingFileHandler
    #Retrieve ISS position from Open JSON
    ISS = ""
    r = requests.get(ISS)
    lat = float(r.json()['iss_position']['latitude'])
    lon = float(r.json()['iss_position']['longitude'])
    #Retrieve ISS crew from Open JSON
    crew = ""
    c = requests.get(crew)
    crew_number = int(c.json()['number'])
    people = (c.json()['people'])
    crew_names = ""
    for p in people:
            crew_names += str(p['name']) + ", "
    crew_names = crew_names[:-2]
    #Set lat/lon for YOUR_LOCATION
    home_lat = *YOUR_LAT*
    home_lon = *YOUR_LON*
    #get datetime
    now =
    #set email sender configuration
    server_host = *YOUR_SMTP_SERVER*
    server_port = *YOUR_SERVER_PORT*
    sender_account = *SENDER_ACCOUNT*
    sender_email = " *SENDER_EMAIL* "
    senderpwd = *SENDER_PASSWORD*
    receivers = ["*RECEIVER_EMAIL_1*","*RECEIVER_EMAIL_2*"]
    #rotating log setup
    logger = logging.getLogger("Rotating Log")
    logfile = " *PATH_TO_LOG* /ISSdata.log"
    handler = TimedRotatingFileHandler(logfile, when="midnight", interval=1)
    handler.suffix = "%Y%m%d"
    #if ISS is in range, plot image and send email with attachment and log position
    if ( lat >= (home_lat-7) and lat <= (home_lat+4) and lon >= (home_lon-7) and lon <= (home_lon+4) ):
            #set temporary image by reading bluemarble file
            bluemarble = plt.imread(' *PATH_TO_IMG* /blue_marble_800.gif')
            fig,ax = plt.subplots(1)
            #crop white space around the image
            #set coordinates for temporary image and plot a dot at current ISS position
            ax.imshow(bluemarble, zorder=0, extent=[-180, 180, -90, 90])
            ax.add_patch(Circle((lon,lat), 2, color='red'))
            #save temporary image
            plt.savefig('ISSposition.png', dpi=125, bbox_inches='tight', pad_inches=0)
            #record data in log file
  "%Y-%m-%d;%H:%M:%S") + ";" + str(lat) + ";" + str(lon) + ";Y")
            #set email parameters
            srv = smtplib.SMTP(server_host, server_port)
            subject = "ISS at " + str(lat) + ", " + str(lon)
            body = "International Space Station is flying over your head at these coordinates:\n"
            body += "Latitude: " + str(lat) + " Longitude: " + str(lon) + "\n\n"
            body += "Crew: " + str(crew_number) + "\n"
            body += str(crew_names) + "\n\n"
            body += "Have a nice view!\n\nISS Monitor"
            #set email content
            message = MIMEMultipart()
            message['Subject'] = subject
            message['From'] = sender_email
            message['Bcc'] = "," .join(receivers)
            message.attach(MIMEText(body, "plain"))
            #set email attachment file
            filename = ' *PATH_TO_IMG* /ISSposition.png'
            with open(filename, 'rb') as f:
                    contents =
            part = MIMEApplication(contents)
            part.add_header('Content-Disposition', 'attachment; filename="%s"' % os.path.basename(filename))
            text = message.as_string()
            #send email
                    #print("ISS is close by, an email was successfully sent!")
            except Exception as e:
                    f = open("  *PATH_TO_LOG* /ISSerror.log","a+")
                    f.write(now.strftime("%Y-%m-%d %H:%M:%S")+ " > " + e + "\r\n")
    #if ISS is out of range, just log the position
    		#you can omit this line if you don't want to log ISS position
  "%Y-%m-%d;%H:%M:%S")+ ";" + str(lat) + ";" + str(lon) + ";N")
    #delete temporary image
    if os.path.exists('ISSposition.png'):
  • Next Moon phase email alert
    The following Python script is crontab scheduled to be executed every day at 6 a.m. by one of my RaspberryPi.
    It sends an email alert to each element (email) of the receivers array whenever a Moon phase is going to happen within the next 24 hours.
    Ephem, Smtplib and Ssl libraries are needed to run.

    Copy to clipboard
    import ephem, datetime, email, smtplib, ssl
    from email import encoders
    from email.mime.base import MIMEBase
    from email.mime.multipart import MIMEMultipart
    from email.mime.text import MIMEText
    from email.mime.application import MIMEApplication
    def days_between(d1, d2):
    	return abs(d2 - d1)
    def twodigits(n):
    	if len(n)<2:
    		n = '0' + n
    	return n
    #set sender configuration: change values between asterisks accordingly
    sender_account = *SENDER_LOGIN* 
    sender_email = *SENDER_EMAIL*
    sender_pwd = *SENDER_PASSWORD*
    receivers = ["*EMAIL_1@DOMAIN.COM*","*EMAIL_2@DOMAIN.COM"]
    theDate = ephem.Date(
    nextfirst = ephem.next_first_quarter_moon(theDate)
    nextfull = ephem.next_full_moon(theDate)
    nextlast = ephem.next_last_quarter_moon(theDate)
    nextnew = ephem.next_new_moon(theDate)
    msg = ''
    if int(days_between(theDate,nextfirst)) == 0:
    	msg = 'First quarter:'
    	nextphase = nextfirst
    if int(days_between(theDate,nextfull)) == 0:
    	msg = 'Full moon:'
    	nextphase = nextfull
    if int(days_between(theDate,nextlast)) == 0:
    	msg = 'Last quarter:'
    	nextphase = nextlast
    if int(days_between(theDate,nextnew)) == 0:
    	msg = 'New Moon:'
    	nextphase = nextnew
    if len(msg) > 5:
    	(yy, mm, dd, h, m, s) = nextphase.tuple()
    	msg =   (msg+' '+
    			twodigits(str(yy))+' '+
    			' UTC')
    	message = MIMEMultipart()
    	message['Subject'] = 'Moon phase change'
    	message['From'] = sender_email
    	message['Bcc'] = "," .join(receivers)
    	message.attach(MIMEText(msg, "plain"))
    	text = message.as_string()
    	except Exception as e:
  • Contribution to BOINC
    I'm a proud contributor to some science research using distributed computing to analyse huge amount of data.
    I set up 4 different Raspberry models (1B, 2B, 3B, 4B) stacked in a pile with fans in order to keep temperature as low as possible, and 1 additional separate Zero2W, for a total 5 boards working for the project.
    My aim is to make these RPi's running the open source BOINC software and help for these projects:

    For my contribution - on March 3rd, 2022 - I was chosen as the User of the Day by the Universe@Home project:

    Universe@Home User of the Day

    Here is my current BoincStats ranking:

    Bitstream's BOINC ranking

    Please consider helping too.
  • Streaming & Music Player
    When it came out I had the opportunity to buy 2 new Raspberry Zero 2W and I suddenly put them in "production".

    The first one has been added to others contributing to my Distributed Computing project, the second one has been paired to a Pirate Audio Line-Out. The latter is a powerful HAT board with a high-quality I2S DAC that I wanted to use as a player for listening to streaming music through the PC speakers.

    To make it possible I downloaded and installed Volumio OS on the PiZero2W, then I connected the Pirate Audio lineout to the PC line-in and finally set the PC mixer up to give the right output.

    Volumio OS desktop
Questo sito usa i cookies: per continuare a navigare è necessario accettarne l'utilizzo. Altre info.    ACCETTO