Difference between revisions of "Laser-Pointer-Tracker-Abob"
(New!) |
(No difference)
|
Revision as of 14:47, 9 March 2016
Problem Statement
I teach classes where we build amsat antennas and try to listen to satellites and the International Space Station. It is really hard to point to nothing at all, so I thought this would help (at least, during the night). It also has the handy dandy feature that it can be used to point out astronomical items if you modify the pyephem script barely.
Arduino Code
I used an uno to do this with a polalu stepper driver (one that takes steps and direction pulses) I also used a futaba servo. I also used the highest microstepping, which I believe is 1/16th microstepping.
Python Code
#!/usr/bin/env python #Laser tracker thinger using pyephem to send serial alt-az commands to the arduino. #remember to set your ground station GPS coordinates!!! #The line looks kinda like this => solution.lon, solution.lat = '-111.717379', '33.401926' import time import datetime import ephem import optparse import sys import serial filename = "TLE.txt" try: fo = open("/home/pi/" + filename, "r") except: print "TLE file not found - error" print filename sys.exit(1) #Read the first three lines of TLE.txt line1=fo.readline() line2=fo.readline() line3=fo.readline() fo.close #port = serial.Serial("/dev/ttyAMA0", baudrate=115200, timeout=3.0) #Pi pins port = serial.Serial("/dev/ttyACM0", baudrate=115200, timeout=3.0) #Arduino USB sat = ephem.readtle(line1, line2, line3) solution = ephem.Observer() solution.lon, solution.lat = '-111.717379', '33.401926' #solution.date = '2015-10-19 13:44:51.4584'; while True: solution.date = datetime.datetime.utcnow() sat.compute(solution) #defaults to NOW pi = 3.14159265359 if sat.alt < 0: out_altitude = (180.0/pi)*sat.alt ser_altitude = int(0) out_azimuth = (180.0/pi)*sat.az ser_azimuth = int((180.0/pi)*sat.az*10) else: out_altitude = (180.0/pi)*sat.alt ser_altitude = int((180.0/pi)*sat.alt*10) out_azimuth = (180.0/pi)*sat.az ser_azimuth = int((180.0/pi)*sat.az*10) print("Alt:{0:.1f} Az:{1:.1f}".format(out_altitude, out_azimuth)) port.write("{0},{1}\n".format(ser_altitude, ser_azimuth)) port.flushInput() #this might be why the thing is crashing, input buffer fills up?? #print("Alt:{0} Az:{1}".format(ser_altitude, ser_azimuth)) time.sleep(1)
TLE
A sample TLE file would look like this, but note that the code will only load the FIRST THREE LINES but it is nice to have them all in one spot, so I just shuffle them up to the top as needed.
NOAA 19 [+] 1 33591U 09005A 16069.53289067 .00000138 00000-0 10001-3 0 9994 2 33591 99.0285 25.5538 0014613 136.4662 223.7665 14.12048620365077 Saudisat 1C 1 27607U 02058C 16069.10105181 .00000444 00000-0 83508-4 0 9996 2 27607 64.5542 106.6305 0076860 237.5124 121.8533 14.75091549710503 NOAA 15 [B] 1 25338U 98030A 16068.51495196 .00000095 00000-0 58860-4 0 9997 2 25338 98.7831 72.4648 0011644 115.9718 244.2663 14.25708308926640