For all common satellite attitude determination sensors, star trackers provide the most accurate measurement. However, these devices can be both large and expensive, and for some CubeSat applications it would not be suitable. Star trackers have in the past been successfully made for CubeSats. This paper investigates star tracker algorithms, implemented with a smartphone, so it may be used for testing attitude determination on a CubeSat. By testing through a proposed implementation, star centroids should be found by the moment method, stars should be identified by planar triangles, and QUEST should be used for attitude estimation. Smeared star images should be avoided and blurred images provide greater accuracy. Using these techniques, a star tracker using a smartphone may be constructed for attitude determination testing and software development, applied in the lost-in-space situation. This may be applied to QKD CubeSats, which require an attitude precision below 0.01°.