---
title: "Configure tracking for CNC mills and lathes"
description: "Set up part counting on a machining center whose cycle time changes with the part. Mount the SenseAi near the spindle, measure a typical cycle by hand, create the part with one operation per thing the machine does, set the operation's algorithm to Discrete Analysis, then assign every operation the machine runs to it at once from the Auto-Detect modal's Discrete tab, which is multi-select. Validate against a hand count, expect 40 to 85% uptime depending on how much of the cycle an operator carries, and read setup time out of the Downtimes report."
category: "Configure by machine type"
source_url: "https://www.iotflows.com/docs/production/cnc-machines/"
---
# Configure tracking for CNC mills and lathes

Count parts on a machine whose cycle time changes with the job.

A CNC mill, lathe, grinder or machining center runs a different cycle for every part, anywhere from 30 seconds to 30 minutes. [Discrete Analysis](/docs/production/choose-an-algorithm/#discrete) is the algorithm for that case: it counts the cycles it detects rather than dividing running time by a fixed number, so one operation stays accurate when the part changes. Allow 30 to 45 minutes for the first machine.

**Before you start**

- A SenseAi or SenseAi Embedded tied to the machine. Contact IoTFlows to tie your sensors to an asset, see [Get support](/docs/get-started/get-support/).
- Sign in as an Organization Owner or Organization Administrator, see [Roles reference](/docs/admin/roles-reference/).

## Why Discrete Analysis fits a CNC
Four things about machining point at the same algorithm.

- **Cycle times vary with the part.** Discrete Analysis counts detected cycles, so it never assumes they are equal.
- **The machine idles between parts.** Loading, inspection and tool changes drop the trace back to the stopped level, and that fall is what ends a cycle.
- **Cutting has a vibration signature.** The algorithm reads the shape of the burst instead of the clock.
- **Operators pace the work.** Short pauses inside a cycle merge back into it rather than splitting one part into two.

**You do not need a second sensor to count parts.** SenseAi derives part counts and cycle times from the same vibration trace that produces the running and stopped state.

**Choose [Continuous Analysis](/docs/production/choose-an-algorithm/#continuous) instead when the trace never falls back to the stopped level between parts.** A bar-fed lathe running one job unattended sits closer to that case than to a machining center that stops for every load.

## Mount the sensor on the machine
![A SenseAi magnet-mounted on the sheet-metal housing beside the work envelope of a vertical machining center](/images/production/prod-cnc-01.webp)

*SenseAi on a machining center, mounted on the spindle housing.*

1. Mount as close as you can get to the spindle, the tool changer or the main motor housing.
2. Pick flat ferrous metal mechanically tied to the parts that move. A guard door holds the magnet and passes on its own ringing rather than the driveline's, see [Choose a mounting location](/docs/hardware/install-senseai/#mounting).
3. Keep the device out of the coolant spray path. Where coolant is unavoidable, use [SenseAi Embedded](/docs/hardware/senseai-embedded/), which is sealed and mounts at the motor.
4. Connect power and put the device on Wi-Fi, see [Connect a device to Wi-Fi](/docs/hardware/connect-to-wifi/).
5. Run 5 to 10 complete machining cycles while you calibrate, so the thresholds are set against real cutting rather than a spindle warm-up, see [Calibrate SenseAi and SenseAi Embedded](/docs/hardware/calibrate-senseai/).

Verify the mount rather than judging it by eye. Run the machine cutting, then let it idle, and confirm the two read differently.

## Measure a typical cycle time
Discrete Analysis adapts to variation, and you still enter a cycle time. The algorithm does not read it to count. The shift goal and the parts gauge do, see [Set cycle times and downtime filters](/docs/production/cycle-times-and-filters/).

1. Pick a part you run often.
2. Time 5 to 10 complete cycles by hand, from part load to part unload.
3. Average them. For example, 4:15, 4:30, 4:10, 4:25 and 4:20 average to 4:20.
4. Note the range as well as the average. Simple parts at 2 to 3 minutes and complex ones at 10 to 15 minutes on the same machine are normal, and Discrete Analysis handles the spread.

## Create the part and its operations
1. Open **Parts List** at `/production?select=parts_list`.
2. Click **+ Add Part**.
3. Enter a **Part Name**, for example `Aluminum Bracket`. **Part Description** is optional.
4. Under **Assign Operations**, name the first operation `OP10` and describe it, for example `Rough mill, vertical`.
5. Enter **Operation Cycle Time** in the h, m and s boxes. For the 4:20 average, that is 4 in the m box and 20 in the s box.
6. Enter a standard deviation in the boxes beside it. Leaving either at zero blocks the part with **Cycle time and standard deviation must be greater than zero**.
7. Add the machines that run this operation.
8. Click **Add another operation** for each further thing the machine does differently, then **Add Part**.
9. Back on the Parts List, expand the part, click the operation's **Algorithm** cell and choose **Discrete Analysis**. It saves as you pick it.
10. Set **QTY/OP** to the parts one cycle makes. One is usual on a CNC. Raise it only when the setup runs several identical parts at once.

Create one operation per thing the machine does differently, not one per step on the router, see [Create parts and operations](/docs/production/parts-and-operations/). The table shows no **Downtime Filter** column here: that column belongs to Continuous Analysis alone, so a Discrete operation has nothing to leave blank.

## Assign the operations to the machine
1. Open **Assets** at `/assets` and click the machine.
2. Click **Auto-Detect** to open **Select Auto-Detect Operations**.
3. Stay on the **Discrete** tab. A SenseAi machine shows the **Discrete** and **Continuous** tabs only, because Counter is BeamTracker's algorithm.
4. Check every discrete operation this machine runs. The list is checkboxes, not a single choice.
5. Click **Auto-Detect**. The dashboard confirms with **Discrete Auto-classification Set**.

Selecting discrete operations clears any continuous operation the machine was set to, and the modal says so above the list. The full flow, including detected cycle times and the Parts List entry point, is on [Detect operations automatically](/docs/production/auto-detect-operations/).

## Run more than one part on the same machine
Because the Discrete tab is multi-select, **assign every part the machine runs at once and leave them assigned.** Nobody touches the dashboard at a changeover, and each part's output is reported separately, see [Compare production over weeks and months](/docs/production/historical-production/).

| Your situation | What to do | What it costs |
|---|---|---|
| A handful of parts you run repeatedly | Create an operation for each and assign them all | Nothing. This is the normal setup |
| A job shop where every job is new | Create one generic operation, for example `CNC-MILL-GENERAL`, at an average cycle time | Counts stay accurate. The goal and the parts gauge run against an average, so both are approximate |

## Validate the count
1. Let the machine run normally for two to four hours.
2. Open **Shift Production** at `/production?select=part` and read the count for the operation.
3. Compare it with a hand count over the same window. Twenty parts made should read 20, give or take one or two.
4. Open **Downtimes** at `/assets?select=downtimes` and check that real stops are there while measuring and chip clearing are not filling the list.
5. Change to a part with a different cycle time and confirm the count stays right.

Accuracy bands and what to do at each one are on [Choose a production tracking algorithm](/docs/production/choose-an-algorithm/#validate).

## What to expect from a CNC
*Uptime* is availability: the share of the window the machine spent running, see [Uptime](/docs/monitoring/metrics-reference/#uptime). How much of the cycle an operator carries sets the ceiling, so a manual machine and a lights-out cell are not comparable.

| How the machine runs | Uptime to expect | Goal to set |
|---|---|---|
| Manual, operator-intensive | 40 to 60% | 45 to 60% |
| Semi-automatic, operator loads and unloads | 50 to 70% | 60 to 75% |
| Fully automatic | 75 to 85% | 75 to 85% |
| Lights-out with automation | — | 85 to 90% |

Set the goal on [Set OEE and utilization goals](/docs/monitoring/oee-goals/). **Start from your own baseline plus 5 to 10%, not from the table.** A goal the machine has never met teaches operators to ignore the number.

## Track setup and changeover
Setup is usually the largest single loss on a CNC, and it is invisible until stops carry reasons.

1. Create a **Setup / Changeover** category, see [Create a category](/docs/monitoring/downtime-categories/#create). Add **Tool Change** and **Tool Breakage** while you are there.
2. Have operators classify the stop at a job change, see [Classify a downtime event](/docs/monitoring/classify-downtime/).
3. After two to four weeks, read the total off the Pareto chart on the [Downtimes report](/docs/monitoring/downtimes/#pareto).
4. Work the setup time down, then watch the same chart month over month.

**You do not need operators to classify every stop.** Set the short-stop cutoff first so measuring and chip clearing never reach the list, and what is left is worth someone's attention, see [Handle short stops](/docs/hardware/calibrate-senseai/#short-stops).

## Troubleshoot a CNC
| Symptom | Cause | Fix |
|---|---|---|
| Parts missing from the count | Short or gentle cycles the sensor does not separate from idle | Lower the **Running Threshold**, or move the sensor closer to the spindle, see [Set the running and stopping thresholds](/docs/hardware/calibrate-senseai/#thresholds) |
| Count runs high | Tool changes or probe touches read as cycles | Raise the **Running Threshold**, and recalibrate against full cycles rather than a tool change |
| Uptime looks wrong while the count is right | The entered cycle time no longer matches what the machine runs | Re-time the current parts and update **Ideal Operation Cycle Time**. Discrete Analysis reads it for goals, not for counting |
| The downtime list fills with one-minute stops | Measuring and chip clearing are reaching the record | Set **Downtime Threshold** with **Treat short downtimes as uptime** on, see [Handle short stops](/docs/hardware/calibrate-senseai/#short-stops) |

Counts that are wrong in a way no threshold fixes are on [Troubleshoot inaccurate part counts](/docs/production/troubleshoot-part-counts/).

## See also
- [Choose a production tracking algorithm](/docs/production/choose-an-algorithm/)
- [Set cycle times and downtime filters](/docs/production/cycle-times-and-filters/)
- [Troubleshoot inaccurate part counts](/docs/production/troubleshoot-part-counts/)
- [Calibrate SenseAi and SenseAi Embedded](/docs/hardware/calibrate-senseai/)
- [Configure tracking for injection molding](/docs/production/injection-molding/)
