I have finally got the psa algorithm to match the NREL code. Not really sure why I got the errors in the previous post but I suspect it was to do with the inputs I gave the NREL calculator, and not with the simpler psa code. Anyway now I'm getting results that match within ~0.5deg. However I am still having issues with my rig drifting out of alignment over time.
I did a little experiment today and set up a sundial with a thin vertical stick in the centre. I marked the position of the shadow with the current calculated azimuth value and waited for the calculated angle to move 30deg (2hours from 1:30 to 3:30).
I have a new piece of code from gabriel over at http://www.cerebralmeltdown.com/, which works from tabulated data. I'll give that a go and hope for the best.