A high precision controller using two synchronization photodiodes or phototransistors is used to compensate the errors introduced by the position sensor of the galvanometer and its electronic driving circuit. Errors of gain, offset, and phase of a periodic waveform are easily compensated using this technique. This paper will describe the approach used. A comparison with the conventional method of reading the signal directly from the position sensor will also be made. Experimental results will be presented.