Turn EtherCAT servos into programmable force-feedback knobs. Turn one by hand and feel notches, end stops, springs, honey-thick drag, a coasting flywheel, a safe you can crack by feel, and more. 19 effects, all in a browser page, plus a Two knob demo for two servos.
Built and tested on a STEPPERONLINE A6 Series 750 W EtherCAT servo kit (A6-EC750H2B1-M17). Parts list: HARDWARE.md.
⚠ This drives a real servo motor. It's an experimental demo, tested on one drive under Windows 11. Linux and Raspberry Pi are untested. Read READ-ME-FIRST.md before you connect a drive, keep the motor clamped with only a small, round, smooth knob on the shaft (nothing that can catch clothing, hit a hand or trap a finger against the bench), and keep the drive's mains switch within reach. You use it at your own risk (see the MIT licence).
I was building a 6-DOF motion simulator and waiting for parts to arrive. Six of these servos were already here, so I put one on the bench, printed a bracket and a knob, and asked: what else can this motor do?
Over five days, 17 to 21 November 2026, it became this app. I'm not a programmer. I built it by directing AI coding assistants in plain English, testing every change on the bench motor, recording what I felt and feeding that back. DEVELOPMENT.md describes that loop: how each bug was caught, reproduced in the simulator, fixed and checked again on the real motor. CHANGELOG.md has every version.
It turned out to be a good teaching tool too. You can feel torque control, damping and PID tuning with your own hand, and learn EtherCAT on an ordinary PC with no PLC.
| Effect | Effect | ||
|---|---|---|---|
| Free | No effect | Ratchet | Do up a nut |
| Set Position | Place it, press SET | Texture | Gritty, bumpy |
| Drag | Stir thick honey | Flywheel | Spin it, it coasts |
| Non-Newtonian | Slow is easy, fast is hard | Menu List | Positions with ends |
| Spring | Returns to zero | Radio Tuner | Find the stations |
| Learn PID | P, I and D exposed | Bungee | Slack, then stretch |
| Drone Arm | Tune a virtual drone's PID by hand | Gear Backlash | Loose gears, real load |
| Notches | Even clicks | Safe Dial | Crack the combination |
| Rotary Switch | Snap positions | End Stops | Walls at each end |
| Magnet Ends | Sticks to each end |
Every effect has sliders. A Sing option makes the motor hum, rising in pitch as an effect nears the torque cap.
With exactly two drives on the cable, the Two knob demo links them:
- Linked shaft: turn either knob and the other follows. Set a ratio (a gearbox: one knob turns easily, the other pushes harder) or reverse it (meshed gears). A slip clutch limits the twist.
- Two-key launch: both keys must be turned into their end stops within half a second of each other.
- Tug of war / handshake: two people, one knob each, both turn clockwise to pull a rope. Contest: drag it past the line to win. Handshake: no line, just feel each other push. Handicap (0-75 %) gives the weaker player a lighter gear: at 50 % they feel half the pull, so half the strength holds a draw, but their knob turns twice as far.
- Remote surgery: knob A is your hand, knob B the robot. B follows A and can touch a wall, a soft sponge or a notch that A can't; you feel it through A. Add up to 200 ms delay to feel why remote surgery is hard.
- Two-person safe: each knob is a 100-number dial with its own secret number, felt as a sharper click. A dials and rests on its number first, then B dials its number while A holds still: OPEN. Geared together (harder): a slipping clutch drags each dial with the other, so both people must hold firm and correct each other's drag.
Setting the start position: press UNLOCK BOTH TO SET ZERO. Both knobs go limp (no torque at all); turn each one to where you want it, then press LOCK BOTH HERE.
Knob A is drive 1, the first drive on the cable from the PC. Both knobs must be small, round and smooth, and everyone at the bench must be able to reach STOP or the mains switch. STOP, a fault or lost frames on either drive stops both.
Download the repo and double-click app/index.html. It opens a simulator: a virtual motor you turn with the
mouse, with the same maths and safety rules as the real thing. Nothing else is needed.
You need:
- the servo kit, wired and powered (see HARDWARE.md);
- a Windows PC with a spare wired Ethernet port, used only for the drive;
- Python 3.12 with
pip install pysoem, and Npcap.
Then:
- Read READ-ME-FIRST.md.
- Close any other EtherCAT program (only one program can own the port).
- Double-click
Start Haptic Knob Lab LIVE.bat. A small server starts on this PC only (http://127.0.0.1:8794) and the app opens in your browser. - The first time, the Drive link panel offers a set-up wizard. It walks you through each stage below, one step at a time, ending with first torque at a 5 % cap.
- After that, just press ENABLE (top right). The first time, a banner at the top asks you to turn knob A clockwise, then knob B (or just the knob), so it knows which way each drive counts. Then it checks the link and switches on. STOP or Space switches off. Press Disconnect before you switch the drive off.
The app talks to the drive over EtherCAT at 1 kHz, from Python on the PC (pysoem). ENABLE takes it through three stages by itself, and each one has to pass before the next:
| Stage | What is sent to the drive | Can the motor make torque? |
|---|---|---|
| 1 Look | Reads only: position, status, a few settings. Then the knob direction: turn each knob clockwise when asked. | No. |
| 2 Listen | The 1 kHz link in SAFE-OP. The app runs its maths in "shadow": turn the knob and the gauges show what it would send. | No. The drive ignores outputs in SAFE-OP. |
| 3 Feel | OP: torque and torque limits every 1 ms. | Only after ENABLE and a hand turning the knob 1°. |
- Torque cap: 50 % of rated (about 1.2 N·m) unless you tick the full-power unlock on the Safety panel. That allows up to 100 % in the 12 effects that stay stable there; it's never saved, so every page load starts at 50 %. The drive's own torque limits are set to the cap every cycle.
- No torque until you turn the knob (1°) after ENABLE or a mode change.
- Speed limits: the motor may resist at any speed but only push below a set speed; overspeed trip; a sustained-oscillation cut.
- STOP button or Space bar: zero torque, power stage off.
- Exactly one EtherCAT device on the cable (exactly two for the Two knob demo), or nothing starts. It can never drive a whole machine.
- Knob direction the first time, and again whenever the drives change: a banner asks you to turn knob A clockwise, then knob B, and the app sets each drive Normal or Reversed from that turn. Nothing goes further until it is set. The Drive link panel shows the result and a Check direction again button.
- Counts per turn come from the drive: 131072 for the 17-bit encoder, scaled by the drive's gear ratio (6091h, factory 1:1). If it can't be read, the app won't switch on. There is nothing to measure by hand.
- Keep the app in front: if its tab is hidden or the screen stops updating for 0.5 s, the drive stops.
- Lost frames, PC stalls, encoder jumps, drive faults: all stop the drive.
- One drive setting changes while it runs: C06.20 runaway protection is switched off, because a hand turning against the motor trips it. The original value is recorded first and put back on Disconnect. A-series drives keep settings written over EtherCAT after a power cycle, so if the put-back ever fails, the app shows a Put back drive settings button at the next connection.
| Path | What it is |
|---|---|
app/ |
The page: effects maths and safety rules (engine.js), screen (app.js), Drive link panel (live.js). |
live/ |
The live link: server (server.py), 1 kHz worker (rt_worker.py), EtherCAT and a fake drive (drive_link.py), Python copy of the effects maths (hk_engine.py), A6 fault table from the manual (a6_faults.json). |
live/tools/ |
Tests and studies (below). |
3D-print-files/ |
Motor bracket (80 mm flange) and knob, as STEP files. |
From the live folder:
| Command | Checks |
|---|---|
python tools/fake_e2e.py |
The whole live pipeline against a fake drive: stages, gates, shadow mode, enable, heartbeat, faults, stalls, lost frames, overspeed, STOP, cap. |
python tools/mock_ecat_test.py |
The real EtherCAT code against a mock: setup order, stage 1 writes nothing, settings recorded and put back, refuses more than one device. |
python tools/parity_test.py |
The Python and JavaScript maths give the same torque every millisecond in 44 scenarios. Needs Node.js (node on the PATH, or set HK_NODE). |
python tools/delay_study.py |
Every effect with the measured 4 ms link delay: does anything buzz? |
python tools/dircheck_test.py |
Knob direction: knob A then knob B, the wrong knob pointed out, a backwards drive, kept until the drives change; counts per turn from the gear ratio. |
python tools/fake_pair_e2e.py, python tools/mock_pair_test.py, python tools/pair_parity.py, node tools/pair_study.cjs |
The Two knob demo: two fake drives, two mock drives, Python vs JavaScript, and the coupling physics. |
Other *_study.py / *_test.py |
Focused checks: strokes, light touch, easing off, flywheel, drone, safe dial, mode change while spinning. |
MIT licence, © 2026 psionic001 (LICENSE). Use it, change it, share it; keep the copyright notice. Third-party parts (pysoem, SOEM, Npcap) are listed in THIRD-PARTY-NOTICES.md.
Servo hardware: STEPPERONLINE.
