A threshold-based algorithm for the development of inertial sensor-based systems to perform real-time cow step counting in free-stall barns