Tracking Space Objects With Python!

Introduction

I’m in the process of building a long range FPV plane (article to come eventually) and one part of the radio link that always fascinated me was the antenna tracker. This setup will utilize a highly directional antenna for the telemetry link but the problem is the plane will always be changing locations. How can we make sure the antenna is always pointed at the right location? The solution is to use the plane location data from the telemetry log and compare it with the location of our antenna. Then we can calculate which direction to point the antenna and how high via some simple math and stepper motors. I could purchase an off the shelf antenna tracker for this but where would be the fun in that? So I set off to build my own pan tilt mechanism and only got partially, majorly distracted along the way.

Up, Up, Down, Down, Left, Right…

Before building a pan tilt mechanism for my real antenna (it weights about 10lbs) I want to build a smaller proof of concept for testing code. I also want to utlize parts that are already in my junk bin so I opted to design it for nema 17 stepper motors since I had a few of these laying around. I found some lazy susan bearings on Amazon that made execellent slew rings and also picked up a slip ring so I can infinitely pan in either direction without worrying about twisting wires. A couple hours and cups of coffee later in fusion360 I had a prototype pan tilt mechanism. A few hours later the printer spit out all the parts ready for assembly.

pantilt

3dprint Tree supports are cool.

Custom Hardware Side Quest

The brains of this project is the trusty old Raspberry Pi. The Pi commands the steppers via two EasyDriver v4.5s. These drivers are easy to use (Their name is no joke) and support 18 micro stepping. I bet you’re asking now “I thought we were tracking space stuff?”. You are correct! This is where I got very distracted. The problem is my plane is no where finished which makes testing tracking code pretty hard. This is where Stellarium saves the day. Stellarium is a program that shows you in real time the locations of various astronomical objects. Anything from planets and galaxies to just about any satellite you can think of. It even makes this information available in a easy to consume API. All we need is an object name, it’s azimuth, and altitude. I won’t get into the weeds of the code but essentially if we “calibrate” our tracker by pointing it at 0 degrees or “True North” we can then convert the azimuth and altitude of our target to steps for our stepper motors. The algorithm will then track the object until it goes over the horizon.

SpaghettiMess

As you can see the wiring is pretty messy. This really bothered me which led to the idea of building a pcb hat for the Pi that would then house the EasyDrivers. A few hours in KiCAD later and this was the result. About two weeks later they arrived from JLCPCB and worked wonderfully!

Hat

Hat2

Does it work?

Well, good question. I calibrated the pan tilt with the compass on my phone. After comparing the movement of the tracker with the movement indicated in stellarium it appears to track pretty well. I have tested with some slow moving objects and did notice some drift (maybe 10 degrees) after a few hours. This could be remediated with some drivers that have smaller micro stepping or a stepper with a gear reduction drive. Overall I am content with the performance of this as it is way beyond what will be required for maintaining a com link. Stay tuned for part 2 where we build a full scale tracker for the 1.3ghz pepper box antenna!

As always you can get the code for this project here: https://github.com/BuckarewBanzai/Open-Star-Tracker

 
comments powered by Disqus