A comprehensive real-time monitoring dashboard for CNC machines built with React, Material-UI, and Recharts. Features dark/light mode, real-time data visualization, and interactive charts.
- Real-time Monitoring: Live data updates every 5 seconds
- Interactive Dashboard: Multiple chart types including line charts, area charts, bar charts, and gauge charts
- Time-based Filtering: Filter data by time ranges (10min to 30 days)
- Dark/Light Mode: Toggle between themes with persistent settings
- Responsive Design: Works on desktop and mobile devices
- Machine Status Overview: Current status and distribution analysis
- Performance Metrics: Spindle speed, power consumption, temperature, vibration, and more
- Summary Stats: Gauge charts for key metrics (Power, Spindle Speed, Servo Load, Temperature)
- Spindle Chart: Line chart showing spindle speed and feed rate
- Power Chart: Area chart comparing power consumption vs servo load
- Temperature Chart: Line chart for spindle temperature and vibration
- Coolant Chart: Bar chart for coolant system health
- Environmental Chart: Radar chart for environmental conditions
- Machine Status: Horizontal bar chart showing status distribution
- Time Range Selector: Filter data by predefined time ranges
- Real-time Updates: Automatic data refresh every 5 seconds
- Theme Toggle: Switch between dark and light modes
- Responsive Grid: Adaptive layout for different screen sizes
- React 18 - UI framework
- Material-UI (MUI) - Component library
- Recharts - Charting library
- Axios - HTTP client
- React Router - Navigation
- Node.js - Runtime environment
- Express.js - Web framework
- PostgreSQL - Database (Neon)
- CORS - Cross-origin resource sharing
RealTime_data_simulater
βββ .gitignore
βββ LICENSE
βββ package-lock.json
βββ package.json
βββ README.md
β
βββ simulator
β βββ .env
β βββ generator.py
β βββ requirements.txt
β
βββ backend
β βββ src
β β βββ routes
β β β βββ machines.js
β β βββ db.js
β β βββ server.js
β βββ .env
β βββ .gitignore
β βββ package-lock.json
β βββ package.json
β
βββ frontend
βββ public
β βββ elliot_logo.jpeg
β βββ favicon.png
βββ src
β βββ assets
β βββ components
β β βββ charts
β β β βββ CoolantChart.jsx
β β β βββ EnvironmentalChart.jsx
β β β βββ GaugeChart.jsx
β β β βββ LineChartComponent.jsx
β β β βββ MachineStatusBarChart.jsx
β β β βββ PowerChart.jsx
β β β βββ ServoLoadChart.jsx
β β β βββ SpindleChart.jsx
β β β βββ SummaryStats.jsx
β β β βββ TemperatureChart.jsx
β β βββ MachineCard.jsx
β β βββ MachinesGrid.jsx
β β βββ Navbar.jsx
β βββ data
β β βββ api.js
β βββ pages
β β βββ MachineDashboard.jsx
β βββ theme
β βββ chartTheme.js
β βββ theme.js
βββ .env
βββ .gitignore
βββ eslint.config.js
βββ index.html
βββ package-lock.json
βββ package.json
βββ README.md
βββ tailwind.config.js
βββ vite.config.js
- Node.js 16+
- PostgreSQL database (Neon)
- Python 3.8+ (for data simulation)
- Clone the repository
git clone <repository-url>
cd cnc-monitoring-dashboard- Backend Setup
cd backend
npm installCreate .env file:
DATABASE_URL=your_neon_postgresql_connection_string
PORT=4000
CORS_ALLOWED_ORIGIN=http://localhost:5173
MACHINE_TABLE=machine_01- Frontend Setup
cd frontend
npm installCreate .env file:
VITE_BACKEND_URL=http://localhost:4000- Start the Application
# Terminal 1 - Backend
cd backend
npm start
# Terminal 2 - Frontend
cd frontend
npm run devThe application will be available at http://localhost:5173
A Python script to generate realistic CNC machine data for testing and development.
cd backend
python data_simulator.pyEdit data_simulator.py to adjust:
- Update interval (default: 2 seconds)
- Machine parameters (RPM ranges, temperature limits, etc.)
- Error simulation frequency and types
- Data patterns (cyclic behavior, trends)
The script generates realistic CNC machine data including:
machine_id: Unique machine identifierspindle_speed_rpm: Spindle rotation speed (0-10,000 RPM)power_consumption_kw: Power usage (0-15 kW)spindle_temperature_c: Temperature monitoring (20-100Β°C)servo_motor_load_pct: Servo load percentage (0-100%)vibration_mm_s: Vibration levelscoolant_flow_l_min: Coolant system flow ratemachine_status: Current state (Running, Idle, Error, Maintenance)- And 10+ additional metrics...
Edit src/theme/theme.js to customize colors:
primary: '#FD6600', // Main orange
secondary: '#2E5AAC', // Complementary blue
success: '#10b981',
warning: '#f59e0b',
error: '#ef4444',Modify src/theme/chartTheme.js for chart-specific styling:
- Color schemes for different chart types
- Dark/light mode adaptations
- Threshold values for gauge charts
GET /api/health- Health checkGET /api/machine/latest- Latest machine dataGET /api/machine/history?limit=200- Historical data
limit: Number of records (default: 200, max: 5000)from: Start timestamp (ISO format)to: End timestamp (ISO format)
- Create component in
src/components/charts/ - Import and add to
MachineDashboard.jsx - Update data formatting as needed
- Apply theme using
getChartTheme(darkMode)
- Update PostgreSQL table schema
- Modify Python simulator
- Update API response handling
- Create/update chart components
-
Backend Connection Refused
- Ensure backend is running on port 4000
- Check CORS configuration
- Verify database connection
-
No Data Displayed
- Run Python data simulator
- Check browser console for errors
- Verify API endpoints
-
Chart Display Issues
- Check data formatting in chart components
- Verify Recharts installation
- Ensure proper responsive container usage
MIT License - feel free to use this project for personal or commercial purposes.
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
For issues and questions:
- Check troubleshooting section
- Review API documentation
- Create GitHub issue with detailed description
Note: This dashboard is designed for monitoring and demonstration purposes. For production use, ensure proper security measures, authentication, and data validation are implemented.