Sensor integrated with tool or machine