Sensor for automatic sewing