Overview
This interactive laboratory provides a real-time simulation of non-invasive surface electromyographic
(sEMG) bio-signal processing coupled with a dual-mode 2D kinematic engine representing an upper-limb
prosthetic limb. Upper-limb amputees often rely on myoelectric control architectures that measure microvolt-level electrical potential differences across skeletal muscle groups generated during isometric or isotonic contractions. By deploying bipolar surface electrodes over antagonist muscle pairs—specifically the biceps brachii, triceps brachii, wrist flexor muscle groups (flexor carpi radialis), and wrist extensor muscle groups (extensor digitorum)—prosthetic microcontrollers classify motor intent to actuate motor drivers for elbow pivot rotation and terminal end-effector grasping.
The simulator models two complementary kinematic operational modes: Forward Kinematics (FK) driven by biological sEMG recruitment profiles, and Inverse Kinematics (IK) driven by target coordinate tracking across the visualizer canvas workspace. Biological signal noise, low-pass exponential smoothing, muscle recruitment latency, and real-time audio sonification are synthesized dynamically to reflect realistic clinical myoelectric control scenarios.
How to Use
Users can evaluate prosthetic responsiveness through three distinct interactive interaction schemes: manual sEMG contraction commands via physical keyboard or touch controls, interactive target trajectory tracking on the canvas display, and automated pre-programmed calibration demonstrations.
1. Manual Operator EMG Control
To simulate individual muscular contractions, press and hold the designated keyboard keys or click and hold the corresponding "Hold Contract" interface buttons:
| Muscular Target |
Key Binding |
sEMG Channel |
Kinematic & Prosthetic Response |
| Biceps Brachii |
Q |
Channel 1 |
Decreases elbow joint angle $\theta_2$ (Elbow Flexion) |
| Triceps Brachii |
W |
Channel 2 |
Increases elbow joint angle $\theta_2$ (Elbow Extension) |
| Forearm Flexors |
E |
Channel 3 |
Closes mechanical terminal gripper prongs (Grasp Action) |
| Forearm Extensors |
R |
Channel 4 |
Opens mechanical terminal gripper prongs (Release Action) |
2. Interactive Canvas Target Dragging (Inverse Kinematics)
Click or touch directly anywhere inside the visualizer canvas matrix to engage the Inverse Kinematics (IK) override mode. The primary shoulder base angle $\theta_1$ and elbow angle $\theta_2$ will instantly override the forward biological signal simulation to mathematically position the end-effector terminal wrist joint as close to your cursor coordinate as mechanically permissible. Releasing the canvas immediately relinquishes control back to manual sEMG operator inputs.
3. Calibration & Preset Demo Mode
Clicking the "Start Demo" button at the top of the control panel initiates an automated calibration trajectory demonstration sequence. You can select specific movement profiles from the adjacent dropdown menu:
- Cycle All: Automatically rotates through all programmed exercise trajectories every 5 seconds.
- Grip Focus: Holds the elbow joint steady while executing cyclical grasp activation routines.
- Max Reach: Sweeps the elbow joint through its full angular range of motion ($15^\circ$ to $165^\circ$).
- Dynamic Wave: Rapid flexion-extension oscillations demonstrating motor acceleration limits.
Note: Any manual physical interaction—such as pressing a key, moving a control, or touching the canvas—will instantly interrupt and terminate Demo Mode, returning the simulator to your baseline configuration.
Technical Details
Forward Kinematics Formulation
The planar upper-limb prosthetic assembly is modeled as a 2-DOF open kinematic chain consisting of an upper arm segment length $L_1 = 180\text{ mm}$ and a forearm segment length $L_2 = 160\text{ mm}$ anchored to a fixed shoulder base coordinate $P_0 = (x_0, y_0)$. Given base shoulder rotation angle $\theta_1$ and elbow joint angle $\theta_2$, the Cartesian coordinates for the elbow joint $P_1 = (x_1, y_1)$ and the wrist terminal joint $P_2 = (x_2, y_2)$ are determined as follows:
$$x_1 = x_0 + L_1 \cos(\theta_1)$$
$$y_1 = y_0 + L_1 \sin(\theta_1)$$
$$x_2 = x_1 + L_2 \cos(\theta_1 + \theta_2) = x_0 + L_1 \cos(\theta_1) + L_2 \cos(\theta_1 + \theta_2)$$
$$y_2 = y_1 + L_2 \sin(\theta_1 + \theta_2) = y_0 + L_1 \sin(\theta_1) + L_2 \sin(\theta_1 + \theta_2)$$
Inverse Kinematics Geometric Solver
When IK canvas tracking mode is triggered by pointing to target coordinate $P_t = (X, Y)$, the system computes required joint angles using the analytical Law of Cosines. First, Euclidean distance $D$ from origin $P_0$ to target $P_t$ is computed and bounded within physical arm length envelope constraints:
$$D = \min\left(L_1 + L_2 - \epsilon, \, \max\left(|L_1 - L_2| + \epsilon, \, \sqrt{(X - x_0)^2 + (Y - y_0)^2}\right)\right)$$
Applying the Law of Cosines yields internal triangle angles $\alpha$ and $\beta$:
$$\alpha = \arccos\left( \frac{L_1^2 + D^2 - L_2^2}{2 L_1 D} \right)$$
$$\beta = \arccos\left( \frac{L_1^2 + L_2^2 - D^2}{2 L_1 L_2} \right)$$
The required base angle $\theta_1$ and elbow angle $\theta_2$ are then derived as:
$$\theta_1 = \operatorname{atan2}(Y - y_0, X - x_0) - \alpha$$
$$\theta_2 = \pi - \beta$$
Biological Signal Interpolation & Gaussian Artifact Noise
Raw biological muscle recruitment cannot change instantaneously due to neurological recruitment latency and biomechanical viscoelastic lag. Muscle activation signal $V_i(t)$ is modeled using a first-order low-pass exponential smoothing filter applied to raw digital target input $T_i(t) \in \{0, 1\}$ with smoothing constant $\beta = 0.08$:
$$V_i(t) = V_i(t - \Delta t) + \beta \cdot \left( T_i(t) - V_i(t - \Delta t) \right)$$
High-frequency sEMG interference artifacts are introduced using the Box-Muller transform to generate normally distributed Gaussian noise $N(0, \sigma^2)$ scaled proportionally to signal amplitude:
$$u_1, u_2 \sim U(0, 1)$$
$$Z = \sqrt{-2 \ln u_1} \cdot \cos(2\pi u_2)$$
$$S_i(t) = \max\left(0, \, V_i(t) + Z \cdot 0.05 \sqrt{V_i(t)}\right)$$
Web Audio Sonification Engine
To offer continuous multi-modal biofeedback, the simulator integrates a Web Audio API synthesizer. Cumulative muscular activity $A(t) = \sum_{i=0}^3 V_i(t)$ modulates the frequency $f$ and gain $g$ of a pure sine wave oscillator:
$$f(t) = 150 + 175 \cdot A(t) \quad \text{(Hz)}$$
$$g(t) = 0.02 + 0.12 \cdot \ln(1.0 + 1.7 \cdot A(t))$$