# RE: Programming question - dish angle

```Phil,

I'd suggest the same method for any situation where you need to derive a
formula from a set of related data.  I describe it in my paper on the W6OAL
EME elevation controller in the AMSAT Journal last year.  In short you are
going to measure the elevation angle and build a table that relates the
angle to the counts, then drop that table into a curve fitting program and
let it tell you the formula.  Put that into your mpu and you can have a
readout of angle.  This is the same method of end to end calibration I use
for satellite telemetry.
(The paper is also at
After publication we did the calibration and it turned out to be linear.)

Start with the dish at one end of the elevation range, say 0.  Write down
the counts in a table.
Put a device on the dish that reads out the angle, a protractor with a
string and weight works fine.
Move it up a few degrees while using the mpu to count the pulses.  Make
that a table row, angle vs. counts.
Add several more data points in the same way, up through your highest
elevation, building more rows of the table. You will want at least 10
points, preferably more.

Type the table into Curve Expert.
Click on the button to fit the curve.  You may find it's linear but more
likely it will be a curve of some sort.  Usually a 2nd order quadratic will
fit these mechanical situations nicely.  So click on the Curve Expert
button that does a quadratic fit.  It will show you your data points and
the curve it fit to them.  If it's a good fit you are home free.  Click on
Info to see the formula and coefficients.  Click on copy to grab the data,
and paste it into some doc.  Those will be the coefficients a, b and c in y
= a + bx +cx^2.
Program the mpu to calculate the angle from the counts using that formula
and you have it.

If a 2nd order won't fit it well have Curve Expert try a 3rd order.  If
that doesn't fit you probably did something wrong gathering the data.

A tip, when programming the formula it's not necessary to use the square (^
in C) function.  Do it this way:
angle = a + (b*x) + (c*(x*x))

TVRO controllers do this the same way.  Some (like my 4DTV box) will even
let you find one satellite near the E end of the arc and another near the W
end and it will calculate the correct pulse count to point the dish at
every satellite in the arc.  Essentially when you tell it where two birds
are in terms of the actuator counts, it knows the formula for finding every
other position in the arc.  In the case of a BUD it's linear so it's dead
easy for the controller.

Jim

>Phil:
>
>Read up on CORDIC angle computations.  All
>rotations done using only +/-'s.  Tailor
>made for this.  However, I think your
>job might be easily done by a table lookup
>if you can store a large enough table lookup.
>I take it you can not do multiply's?  If so,
>then you could use a smaller table and do
>linear or cubic spline interpolation.
>
>Bob
>N4HY
>
>
>-----Original Message-----
>From: owner-AMSAT-BB@AMSAT.Org [mailto:owner-AMSAT-BB@AMSAT.Org]On
>Behalf Of Phil
>Sent: Tuesday, October 07, 2003 6:51 AM
>To: amsat-bb@AMSAT.Org
>Subject: [amsat-bb] Programming question - dish angle
>
>
>Hello everyone,
>
>I'm looking for ideas. I have some code that counts the azimuth and
>elevation
>pulses from my dish rotator and then displays the positions on a 2 line 16
>character LCD display.
>
>There is a direct correlation between counted pulses for azimuth position
>but
>not for elevation. I apply the cos rule to get the dish angle based on the
>length of the actuator arm. So far so good.
>
>It seems like a good idea to have a PIC take over the roles of pulse
>counting
>and display because the CPU is already pretty busy with Doppler correction
>tasks. However, I can't think of any way to calculate the elevation angle
>using the PIC's instruction set.
>
>How do pulse counting controllers usually accomplish this feat? Look-up
>tables
>maybe?
>
>--
>Regards,
>Phil.
>
>
>----
>Sent via amsat-bb@amsat.org. Opinions expressed are those of the author.
>Not an AMSAT member? Join now to support the amateur satellite program!
>To unsubscribe, send "unsubscribe amsat-bb" to Majordomo@amsat.org
>
>
>----
>Sent via amsat-bb@amsat.org. Opinions expressed are those of the author.
>Not an AMSAT member? Join now to support the amateur satellite program!
>To unsubscribe, send "unsubscribe amsat-bb" to Majordomo@amsat.org

----
Sent via amsat-bb@amsat.org. Opinions expressed are those of the author.
Not an AMSAT member? Join now to support the amateur satellite program!
To unsubscribe, send "unsubscribe amsat-bb" to Majordomo@amsat.org

```

AMSAT Home