Tutorial: CNC Machines (Mills & Lathes)
Optimize monitoring for CNC machining centers with variable cycle times using Discrete Analysis algorithm.
Overview
CNC machines (mills, lathes, grinders, machining centers) have variable cycle times depending on the part being produced. The Discrete Analysis algorithm is designed specifically for this scenario, automatically adapting to different cycle times while accurately counting completed parts.
What you'll learn:
- Why Discrete algorithm is perfect for CNC machines
- How to configure for variable cycle times
- Handling job changes and setup time
- Optimizing for manual vs. automatic operation
Time required: 30-45 minutes for complete setup
Why Discrete Algorithm for CNC Machines?
CNC machining centers have characteristics that make Discrete Analysis the ideal choice:
✅ Variable cycle times: Different parts have different machining times (30 seconds to 30 minutes)
✅ Natural idle periods: Machine stops between parts for loading, inspection, or tool changes
✅ Pattern-based detection: Vibration patterns indicate when a cycle starts and ends
✅ Operator-paced: Semi-automatic operation with natural pauses
The Discrete algorithm:
- Detects individual machining cycles from vibration patterns
- Merges small pauses (tool changes, measurements) into the cycle
- Adapts automatically to different part cycle times
- Counts actual completed parts, not time-based estimates
Step-by-Step Setup
Step 1: Install and Calibrate SenseAi
Mount SenseAi on CNC machine
Attach close to the spindle, tool changer, or main motor housing:
- Metal-to-metal contact for best vibration detection
- Avoid areas with coolant spray
- Position where it won't interfere with operation
Power and connect
Connect USB-C power and pair to WiFi using the IoTFlows mobile app
Calibrate with machine running
Run the CNC through several complete machining cycles (5-10 parts) during calibration. This teaches SenseAi the vibration signature of your machine.
Verify detection
Check Devices Tab to confirm SenseAi is detecting cycles correctly
See the full SenseAi Installation Guide for detailed instructions.
Step 2: Measure Typical Cycle Times
Even though Discrete adapts to variation, you still need an estimated cycle time for OEE goals.
Run a typical part
Select a representative part that you produce frequently
Time several cycles
Manually time 5-10 complete cycles (from part load to part unload)
Calculate average
Average your measurements. For example:
- Cycle 1: 4:15
- Cycle 2: 4:30
- Cycle 3: 4:10
- Cycle 4: 4:25
- Cycle 5: 4:20
- Average: 4:20 (4 minutes 20 seconds)
Note cycle time range
Understand your minimum and maximum cycle times:
- Simple parts: 2-3 minutes
- Complex parts: 10-15 minutes
- Discrete algorithm handles this variation automatically
Step 3: Create Operation in Parts List
Navigate to Parts List
Go to Production Tab → Parts List
Click '+ Add Part'
Create a new operation
Fill in operation details
- Operation Name: e.g., "CNC-MILL-BRACKET-A"
- Part/Material: e.g., "Aluminum Bracket"
- Description: e.g., "Vertical mill producing aluminum brackets"
Select Discrete Analysis algorithm
From the Algorithm dropdown, choose Discrete Analysis
Enter estimated cycle time
Input the average cycle time you measured (e.g., 00:04:20 for 4 minutes 20 seconds)
Important: This is used for OEE goals and estimates, NOT for counting. The algorithm counts actual detected cycles.
Set Quantity Per Cycle
- Typically 1 for CNC machines (one part per cycle)
- If your setup produces multiple identical parts simultaneously, adjust accordingly
Leave Downtime Filter empty
Discrete algorithm automatically merges small pauses. No downtime filter needed.
Save the operation
Click Save
Unlike Continuous algorithm, Discrete does NOT use the cycle time for counting. It's only used for OEE target calculations and production estimates.
Step 4: Assign Operation to Machine
Navigate to Assets Tab
Go to Assets Tab → Overview
Click on your CNC machine
Open the machine detail view
Click 'Auto-Detect'
Opens the operation selection modal
Select your operation
Choose the CNC operation you just created (e.g., "CNC-MILL-BRACKET-A")
Confirm assignment
The machine now tracks production using Discrete algorithm
Step 5: Validate and Monitor
Run for 2-4 hours
Let the CNC machine run normally with typical production
Compare counts
Go to Production Tab → Shift Production and check the part count.
Validation:
- Manually count parts produced: 20 parts
- IoTFlows count: Should show 20 parts (±1-2 parts)
Review downtime events
Go to Assets Tab → Downtimes and verify:
- Real downtimes captured (tool changes, setup, breaks)
- Brief pauses (measuring, chip removal) are merged into cycle time
Test with different parts
Change to a different part with a different cycle time and verify accurate counting continues
Handling Job Changes
CNC machines often run different jobs with different cycle times. Here's how to manage this:
Option 1: Multiple Operations (Recommended for frequent jobs)
Create a separate operation for each frequently-run part:
Create operations for each part
- "CNC-BRACKET-A" (4:20 cycle time)
- "CNC-BRACKET-B" (6:15 cycle time)
- "CNC-SHAFT-100" (2:45 cycle time)
Use Auto-Detect to switch
When changing jobs, use Auto-Detect button to select the appropriate operation
Track production separately
Each part's production is tracked independently in Historical Production reports
Option 2: Single Generic Operation (For highly variable jobs)
Create one generic operation that adapts to all parts:
Create generic operation
- Name: "CNC-MILL-GENERAL"
- Cycle time: Average across all typical parts (e.g., 5:00)
Use for all jobs
Keep this operation assigned regardless of part being run
Accept less precise OEE
OEE calculation will be based on average cycle time, not actual. Part counting remains accurate.
Manual vs. Automatic CNC Operation
Fully Automatic Operation (Lights-Out)
Setup:
- Discrete algorithm works perfectly
- Leave cycle time as measured
- Expect 75-85% utilization (downtime for maintenance, tool changes, part inspection)
Best Practices:
- Set realistic OEE goals (80%+)
- Monitor for unexpected downtimes
- Use downtime classification to track reasons for stops
Semi-Automatic (Operator Loads/Unloads)
Setup:
- Discrete algorithm handles operator pace variation
- Cycle time includes average load/unload time
- Expect 50-70% utilization (operator pacing, breaks, multi-tasking)
Best Practices:
- Don't expect lights-out utilization levels
- Focus on reducing setup/changeover time
- Track "Waiting for Operator" as a downtime category
Manual Operation (Operator-Intensive)
Setup:
- Discrete still works but expect high variation
- Cycle time is very approximate
- Expect 40-60% utilization
Best Practices:
- Use as a baseline to understand current state
- Focus on eliminating non-value-added time
- Consider fixture or automation improvements
Common Issues & Solutions
Best Practices for CNC Monitoring
1. Track Setup/Changeover Time
Setup and changeover are often the biggest losses in CNC operations:
Create 'Setup' downtime category
In Organization Settings → Auto-Downtime Classification
Train operators to classify
When changing jobs, classify downtime as "Setup/Changeover"
Measure baseline
After 2-4 weeks, use Downtimes page to see total setup time
Implement SMED (Single-Minute Exchange of Die)
Work to reduce setup time systematically
Track improvement
Monitor setup time reduction month-over-month
2. Optimize Tool Life
Track when tool-related downtimes occur:
- Create "Tool Change" and "Tool Breakage" downtime categories
- Monitor frequency of tool-related stops
- Optimize tool change schedules to minimize unplanned stops
3. Balance Multiple Machines
If an operator runs multiple CNCs:
- Monitor utilization of each machine independently
- Identify machines that are idle waiting for operator
- Optimize operator workflow to maximize total utilization
4. Set Realistic Goals
CNC machines have inherent variation and downtime:
Typical OEE targets:
- Manual operation: 45-60%
- Semi-automatic: 60-75%
- Fully automatic: 75-85%
- Lights-out with automation: 85-90%
Start with current baseline + 5-10% improvement goal.
Real-World Example
Company: Precision Machining Inc. Machine: Haas VF-2 Vertical Mill Operation: Aluminum aerospace brackets Cycle time: 6:30 (varies 5:00 - 8:00 depending on part complexity)
Configuration:
- Algorithm: Discrete Analysis
- Cycle Time (estimated):
00:06:30 - Quantity Per Cycle: 1
Results:
- Before IoTFlows: Unknown utilization, frequent untracked downtime
- Week 1: 58% utilization, 12-15 downtime events/day
- Month 1: Identified setup time as #1 loss (35% of downtime)
- Month 3: Reduced setup time from 25 minutes to 12 minutes (SMED improvements)
- Month 6: 68% utilization achieved
- ROI: 10% production increase = $28K annual value
Next Steps
Analyze Downtimes
Use Pareto analysis to find improvement opportunities
Track Historical Production
Monitor production trends by part type
Advanced Report
Generate monthly or quarterly performance reports
Questions about CNC monitoring setup? Contact support@iotflows.com for personalized guidance!
Complete guide to monitoring injection molding machines using Continuous algorithm for accurate production tracking.
Perfect stroke counting for stamping presses using Discrete w/o Merge algorithm combined with SenseAi downtime filter.

