Syncing 2 sprite animations

I have 2 sprite animations a wheel and a knob inside the wheel.

The wheel speed change from time to time and based on its animation speed I set the knob animation speed.

The problem is after some time the wheel and the knob go out of sync.
Is there a technique to fix this?