Building Something That Actually Tracks Angles Without Breaking the Bank
I built my first version of this out of laser-cut acrylic and a stepper motor from an old printer. It tracked elevation and azimuth angles with roughly two-degree accuracy. That was enough for mapping tree canopies in my backyard, but useless if you needed precision. The second iteration used a Raspberry Pi, two stepper motors mounted on a 3D-printed gimbal frame, and a cheap USB camera module. Cost came to about eighty dollars in parts if you already own basic tools. Accuracy improved to within half a degree at ranges under fifty meters. Beyond that, the camera resolution becomes your bottleneck, not the motor tolerances. The core principle is straightforward. You mount an angle sensor or a camera on a rotating platform. As the target moves, the platform pivots to keep it centered. Your microcontroller reads the motor shaft position and converts that into sine and cosine values, giving you the polar coordinates of whatever you are tracking. From there you can derive Cartesian coordinates if you know your distance baseline. Most hobby guides stop here and imply it is that simple. It is not.
What You Actually Need to Know Before Starting a Trigonometry Tracker Diy
You need three things: accurate angular measurement, a stable base, and a way to resolve distance. The first two are mechanical problems. The third is where most people fail. A tracker without distance information only gives you direction. Direction alone is not very useful unless you are just pointing at things. To get distance, you have options. You can use ultrasonic ranging, LiDAR, stereo cameras, or a known reference object of fixed size. Each has tradeoffs I will get to shortly. I learned this the hard way during a summer project where I built a tracker to monitor bird feeding stations. I used a Pan-tilt camera with no distance sensor. The system tracked movement beautifully across the field of view. It also completely failed the moment two birds landed on the same branch at slightly different depths. The controller could not determine which bird was which. It would oscillate between them and eventually lose both. I ended up adding a time-of-flight sensor pointing at the center of the frame. That solved the ambiguity, but it introduced a new problem with reflective surfaces. Birds have oily feathers that scatter infrared. The readings jumped around by thirty centimeters at range. I had to implement a simple median filter across five consecutive samples and the jitter mostly disappeared.
Component Selection and the Math Behind It
Your angular resolution depends on how finely you can measure rotation. A standard potentiometer on a servo gives you maybe one percent of a full rotation per step. At a forty-five degree angle, that translates to roughly three degrees of error. Not acceptable for anything beyond casual use. Absolute encoders solve this, but they are expensive. A budget workaround is using a magnet and a Hall effect sensor paired with a coded wheel. I printed a disc with alternating black and white segments, glued a neodymium magnet to the center, and mounted a KY-035 Hall sensor behind it. This gave me about five hundred pulses per revolution. At two hundred sixty-four steps per revolution for my stepper, I achieved roughly half a degree of angular resolution without spending more than twelve dollars on parts. The trigonometry itself is basic high school material, but applying it without understanding the failure modes will get you nowhere. When you convert polar coordinates from your tracker to a point in space, you are working with equations like x equals r times cosine of theta and y equals r times sine of theta. The problem is that r is rarely known precisely. If r has a ten percent error, your x and y values inherit that same ten percent error, and it compounds asymmetrically depending on your angle. At thirty degrees elevation, a small distance error shifts the horizontal position less than it would at eighty degrees. Beginners often miss this. They treat angular error and distance error as equivalent when they are not. Another thing nobody mentions in tutorials is the effect of mechanical backlash. When your motor reverses direction, there is a tiny dead zone where the motor turns but the output does not move immediately. For a hobby tracker, this is usually one to three degrees of play depending on your gear ratio. You can compensate for it by always approaching your target from the same direction, or by software calibrating the backlash offset into your control loop. I wrote a calibration routine that sweeps the motor back and forth and records the average offset. It takes about thirty seconds to run and saved me from hours of troubleshooting why my tracker kept missing the target after direction changes.
Get the Full Details

Assembly Notes From Someone Who Has Done This More Than Once
Mount everything on a rigid frame. I cannot stress this enough. I initially built mine on a wooden board and thought it was fine until I noticed the elevation axis drifted by a full degree over twenty minutes as the board warped from temperature changes. Swapping to aluminum extrusion and T-slots eliminated that problem entirely. The weight also increased, but stability matters more than portability for this kind of project. Power delivery is another gotcha. Stepper motors draw significant current during acceleration. If you are running two motors off a single USB-powered board, you will see voltage dips that cause missed steps. I solved this by powering the steppers from a separate 12-volt supply and keeping the logic board on its own 5-volt rail. A common ground between the two supplies is sufficient. Do not try to share the USB power line for both the logic and the motors. For the tracking algorithm itself, start simple. A proportional controller that adjusts motor position based on the camera feed error works fine for slow-moving targets. If your target moves quickly, add derivative control to dampen overshoot. I initially tried just proportional control and watched my tracker chase a squirrel around the yard with violent oscillations that made the footage unwatchable. Adding a derivative term smoothed it out completely. The full PID implementation took maybe an hour to tune because most microcontroller libraries have reasonable defaults.
The Trigonometry Tracker Diy Reality Check
This project works well for slow to moderate movement at ranges up to about thirty meters with consumer-grade sensors. Beyond that, accuracy degrades noticeably. Wind, temperature fluctuations, and sensor noise all compound. If you need tracking accuracy better than one degree at longer ranges, you are in professional equipment territory and a DIY approach will fight you every step of the way. In those cases, a commercial theodolite or a dedicated tracking system like a Star Tracker mounted on a go-to telescope mount makes more financial sense than trying to out-engineer industrial components with plywood and Arduino parts. The open-source code and wiring diagrams I reference from various forums are a decent starting point, but do not treat them as finished products. Every build required modifications. My latest version uses a modified PID library that accounts for the non-linear response of my specific stepper drivers, and I am still iterating on the distance estimation algorithm because stereo vision introduces parallax errors at close range that my current code does not handle gracefully. If you want to start, grab a dual-axis gimbal kit, a microcontroller, a camera, and an ultrasonic or ToF sensor. Breadboard the electronics first. Verify that your angle readings match physical measurements before writing any tracking code. Then write the simplest possible controller and watch it fail. Then fix the failures one at a time. That is how this project actually goes.