A modern web application for controlling and monitoring Continuous Passive Motion (CPM) therapy devices for knee rehabilitation.
The CPM Knee Controller provides a comprehensive user interface for healthcare professionals and patients to:
- Control CPM device parameters
- Monitor motion data in real-time
- Manage therapy sessions
- Export session data in various formats
- Customize therapy protocols
To set up the CPM machine hardware:
-
Upload Code:
- First, upload the ESP8266 WiFi module code to your ESP8266
- Set the baud rate to 115200 in the Arduino IDE
- Select the correct board type (ESP8266)
- Then, upload the Arduino Mega code to your Arduino Mega
- Set the baud rate to 115200 in the Arduino IDE
- Select the correct board type (Arduino Mega 2560)
- Make sure to update the WiFi credentials (SSID and password) in the ESP8266 code to match your network
- First, upload the ESP8266 WiFi module code to your ESP8266
-
Power Supply:
- Connect the ESP8266 to a 3.3V power supply
- Connect the Arduino Mega to a 5V power supply
-
Network Connection:
- Ensure both the WiFi module and your computer/device are connected to the same WiFi network
- Note down the IP address displayed by the ESP8266 module
-
Application Connection:
- Open the web application
- Click the "Connect" button
- Enter the ESP8266's IP address
- Click "Connect" to establish communication with the CPM machine
- Once connected, you can use the application interface to control the CPM machine
- Framework: Next.js 15
- UI Libraries:
- React 18
- Tailwind CSS
- Radix UI for accessible components
- Framer Motion for animations
- Data Visualization: Recharts
- Data Export:
- Theming: next-themes
- Real-time Motion Control: Adjust speed, angle, and therapy parameters
- Data Visualization: View live motion graphs and real-time feedback
- Session Management: Track and store therapy sessions
- Data Export: Export session data in multiple formats (JSON, CSV, Excel, PDF)
- Responsive Design: Works on desktop, tablet, and mobile devices
- Dark/Light Theme: User-selectable interface theme
- Node.js 18.17 or later
- npm (Node Package Manager)
-
Clone the repository:
git clone https://github.com/yourusername/cpm-knee-controller.git cd cpm-knee-controller -
Install dependencies:
npm install
-
Run the development server:
npm run dev
-
Open http://localhost:3000 with your browser to see the application.
- Real-time Motion Control: Adjust speed, angle, and therapy parameters
- Data Visualization: View live motion graphs and real-time feedback
- Session Management: Track and store therapy sessions
- Data Export: Export session data in multiple formats (JSON, CSV, Excel, PDF)
- Responsive Design: Works on desktop, tablet, and mobile devices
- Dark/Light Theme: User-selectable interface theme
-
Controls Tab:
- Adjust therapy parameters
- Start, stop, and pause sessions
- Control device motion
-
Live Data Tab:
- Monitor real-time motion data
- View angle and position graphs
-
Session Tab:
- Review session statistics
- Export session data
Contributions are welcome! Please feel free to submit a Pull Request.



