As motion artefacts are a major problem with electromyography sensors, a new algorithm is developed to differentiate artefacts to contraction EMG. The performance of myoelectric prosthesis is increased with this algorithm. The implementation is done for an ultra-low-power microcontroller with limited calculation resources and memory. Short Time Fourier Transformation is used to enable real-time application. The sum of the differences (SOD) of the currently measured EMG to a reference contraction EMG is calculated. The SOD is a new parameter introduced for EMG classification. The satisfactory error rates are determined by measurements done with the capacitively coupling EMG prototype, recently developed by the research group.