Odometry is one of most-used techniques used in mobile robotics and autonomous vehicles, especially when the indoor navigation is required or when robot or vehicle moves inside the tunnel. The output of the odometer is usually a count of pulses corresponding to the distance run by given wheel. Due to the quantization noise, estimation of the velocity (first derivative of the distance) is challenging. This paper is focused on curve-fitting filter used for the speed estimation and optimization of its parameters, considering the physical constraints of the robot, sampling frequency of the system and the quantization step. The paper proposes an empirical formula for estimating the optimal parameters of the curve fitting filter. The optimized filter has been evaluated using both simulation and real experiment and compared with several standard differentiation methods.