SparkCycle

A step-by-step guide to building your own FES cycling setup for spinal cord injury rehabilitation — open source, $317 in parts, and built by people who understand the urgency.

~50× cheaper than commercial FES bikes · MIT License · No gatekeeping
Not medical advice. This is a community-built hardware project. It should work — the biology is well-established and the components are the same ones used in clinical research. But you are responsible for your own build and your own body. Read every safety callout. Go slowly. Learn how your body responds before pushing further. If something hurts or feels wrong, stop.

FES cycling (Functional Electrical Stimulation) uses precisely timed electrical pulses to trigger muscle contractions in a coordinated pedaling pattern. It's used in SCI rehabilitation to maintain muscle mass, drive BDNF (the growth factor that supports neural repair), improve circulation, and — in some cases — contribute to motor recovery. Commercial FES bikes cost $12,000–$20,000. SparkCycle builds the same function from commodity parts you can buy today on Amazon and eBay.

🛒 Parts List
# Part What it does Where to get it Budget cost
1 Recumbent stationary bike
or upright + magnetic trainer
Holds the cranks. Provides resistance. Low transfer height from chair. Facebook Marketplace, Craigslist $60
2 Foot cages + ankle straps
⚠ CRITICAL — do not skip
Keeps feet on pedals when legs can't grip. Without this the foot will slip and the crank will spin freely. Amazon, any bike shop $25
3 Surface electrodes
4×4" self-adhesive, reusable
Couples the electrical pulse to your muscle through intact skin. 4 minimum for both quads. Add 2–4 more for hamstrings/glutes later. Axelgaard PALS Platinum (axelgaard.com or Amazon) $28
4 FES / TENS stimulator
⚠ TRY $30 TENS FIRST
Generates biphasic charge-balanced pulses. Triggers visible quad contraction. Try a cheap TENS unit first — if your quads fire, you're done. eBay (used Zynex NexWave ~$80) · Amazon (TENS ~$30 to test) $30–$160
5 Hall effect sensors × 5
A3144 + 6mm neodymium magnets
Reads crank angle so the controller knows when to fire each muscle. Without this your stim fires randomly — that doesn't work. Amazon, AliExpress $8
6 Arduino Nano clone The brain. Reads crank angle, runs timing logic, fires output pins to trigger the stimulator channels. Amazon, AliExpress ($3–5 for clones) $12
7 4-ch optocoupler relay board
⚠ SAFETY — not optional
Electrically isolates the Arduino from the stimulator. Your body never sees logic ground from a wall-powered computer. This is a $9 safety requirement. Amazon "SainSmart 4-channel relay" $9
8 USB power bank Powers Arduino + relay. Stimulator has its own supply. You already have one. $0
9 Trunk support + lap belt
if trunk control is affected
Keeps you safely upright during pedaling. Check trunk control first — many people don't need this. Hardware store + climbing shop $15
SparkCycle total (budget build) $317
MOTOmed Viva2 (commercial FES bike) $14,000
RT300 FES Ergometer (Restorative Therapies) $16,000+
⚡ SparkCycle vs commercial — cost ratio ~50× cheaper
🔧 Build Steps
1
Test your quad response — before buying anything else

Do this before buying the bike. Before buying the Arduino. Before buying anything except a $30 TENS unit and a pack of electrodes. The question this step answers: do your quads respond to surface electrical stimulation? If yes, everything else in this guide works. If the response is weak, you'll need a proper FES unit instead of a TENS unit — but you'll know that now, for $30, rather than after building the whole system.

Electrode placement for quads:

RIGHT leg:
Electrode A: mid-thigh, ~4cm below the inguinal crease, center of the rectus femoris
Electrode B: 3cm above the kneecap (patella)

LEFT leg: mirror of right.

Set the TENS to: 35 Hz frequency · 250–300 μs pulse width · start at 20mA. Increase in 5mA steps until you see a visible leg kick (the knee extends). Most quads respond at 40–80mA. If you see a kick — you're done, TENS is your stimulator. If you can't get a good contraction even at maximum, you'll need a proper FES unit (Zynex NexWave used on eBay, ~$80/unit, you need 2).

⚠ Safety — Electrode Placement Electrodes go on the thighs only. Never place electrodes across the chest, near the heart, near the head, or over implanted hardware (pacemakers, SCS implants, etc.). If you have an implanted spinal cord stimulator, consult your neurosurgeon before using any surface electrical stimulation.
💡 Tip — Skin prep Clean, dry skin. Remove lotion. Electrodes should feel secure — if they're lifting at the edges, the contact is bad and stimulation will be uneven. New electrodes are better than old ones. A pack of Axelgaard PALS 4×4" lasts ~20 sessions per pair.
🔀 If your quads didn't fire — the What-If Protocol

No visible leg kick even at max TENS current. This happens — especially after long periods off a bike or years in a chair. The muscle is still there. Satellite cells are still there. The excitability is low and the tissue is atrophied, but none of that is permanent. Before you write off the TENS test, work through this list in order. These are sorted by cost and probability of working — lowest cost / highest chance first. Try each level for 3–4 weeks before moving to the next. Most people who failed the initial TENS test will pass it again inside 60 days if they stack levels 0–2 seriously.

LEVEL 0 · Diet first · Today
Protein and basic nutrition audit

Atrophied SCI muscle is almost always in a catabolic state — not because of the injury, but because caloric needs dropped after injury and protein intake followed. Muscle protein synthesis needs a leucine spike above ~3g per meal to actually trigger. Below that threshold, dietary protein is just oxidized for energy.

Protein target: 1.6–2.2g per kg of bodyweight per day, split into 3–4 meals
Leucine minimum: ≥3g leucine per meal (that's ~25g whey, ~35g chicken, ~4 eggs)
Hydration: dehydration directly reduces muscle conductivity — electrode contact gets worse
Sun or D3: SCI patients are chronically Vitamin D deficient (~70%+ in literature) — affects neuromuscular junction function directly
💡 Why this works Skeletal muscle is ~60% protein by dry weight. Without adequate substrate, satellite cells can't fuse into existing fibers even if they're activated. This isn't a supplement issue — it's a construction materials issue. Fix the materials first.
→ Build your regional diet plan + budget supplement ladder on the Nutrition page
LEVEL 1 · ~$25/mo · Strong evidence
Creatine + Vitamin D + Magnesium + daily passive NMES

These aren't supplements — they're deficiency corrections that nearly every chronic SCI patient needs. Creatine monohydrate is the most evidence-backed legal compound for atrophied muscle: it replenishes phosphocreatine in motor units that fire rarely, directly increasing the energy available on the next stimulation attempt.

Creatine monohydrate: 5g/day, no loading needed. ~$12/month. Studies on SCI populations show preservation of lean mass and motor unit excitability.
Vitamin D3: 2000–4000 IU/day (~$8/month). Directly upregulates calcium handling in muscle fibers — the same calcium release that triggers contraction.
Magnesium glycinate: 300–400mg/day (~$10/month). Mg is the cofactor for ATP hydrolysis — every muscle contraction burns ATP. Low Mg = low force output per pulse.
Daily passive NMES: 20 min/day on the same $30 TENS unit you already have. No bike. Just electrodes on quads, steady 35Hz. This alone has been shown to slow atrophy and restore some motor unit excitability in chronic denervation patients. (Kern 2010, Carraro 2010)
LEVEL 2 · ~$50/mo · Moderate evidence
HMB + Omega-3 + increase NMES duration

Once the basic substrate issues are addressed, these two compounds attack the problem from the opposite end — suppressing muscle protein breakdown rather than increasing synthesis. In immobilized populations, breakdown is the dominant force. Slow the breakdown and the net equation tips toward retention.

HMB (β-Hydroxy β-methylbutyrate): 3g/day split across meals (~$30/month). Leucine metabolite. Directly inhibits the ubiquitin-proteasome pathway — the primary mechanism of immobilization atrophy. Specifically studied in bedbound and immobilized patients. Most effective population: people who can't do voluntary exercise.
Omega-3 (EPA + DHA): 2–4g/day combined EPA+DHA (~$20/month). Directly increases muscle protein synthesis rate in elderly and atrophied muscle (Smith 2011, Lalia 2017). Also anti-inflammatory — relevant for the chronic systemic inflammation SCI creates.
NMES sessions: scale up to 2× daily, 30 min each. The evidence on denervated muscle (Kern 2010) used this density and showed measurable fiber type preservation over 12 months.
LEVEL 3 · ~$80 one-time · Emerging evidence
Blood flow restriction (BFR)

BFR cuffs inflate around the proximal thigh (~160–180 mmHg), creating partial venous occlusion during whatever movement is possible. With passive cycling or NMES-assisted movement, BFR amplifies the anabolic response by accumulating metabolites (lactate, H⁺) that locally trigger mTOR signaling and satellite cell activation — the same pathway that high-load exercise triggers, but without the mechanical load. This is one of the few interventions that can drive satellite cell fusion in a partially-loaded population.

Hardware: SAGA BFR cuffs ($60–80, re-use indefinitely) or blood pressure cuff as a rough substitute
Protocol: 160–180 mmHg on proximal thigh. NMES session while cuffed. 4 sets of 5 min on / 3 min off. Release fully between sets.
Contraindication: don't use BFR if there's a DVT history in that limb, active pressure sores near the cuff site, or peripheral vascular disease. SCI increases DVT risk — clarify this with your care team first.
⚠ Safety — autonomic dysreflexia (injuries T6 and above) BFR creates a pressure stimulus. In high thoracic and cervical injuries, this can trigger autonomic dysreflexia — the hypertensive crisis response. Start with low cuff pressure (120 mmHg), monitor for signs (headache, flushing, sweating above the level of injury, bradycardia), and release immediately if any appear. This is a known risk; it doesn't mean don't try — it means do the first session with a second person present and monitored BP.
LEVEL 4 · Open questions · Research frontier
Muscle cell regrowth in chronic SCI atrophy — what we don't know yet

This is the honest edge of what the literature covers. Satellite cell activation in chronically denervated SCI muscle is genuinely understudied. Here's what the research shows exists, what's missing, and what the community could actually contribute data on:

What we know:
→ Satellite cells are quiescent but present in chronically atrophied SCI muscle (Verdijk 2012, Kern 2014)
→ Mechanical loading is the primary activator under normal conditions — that's absent in SCI quads
→ NMES can partially substitute for mechanical loading as a satellite cell activation signal, but dose is unclear
→ Myostatin (the primary inhibitor of muscle growth) is elevated after SCI — it's suppressing the growth response
→ IGF-1 (the primary promoter) is depressed after SCI — the accelerator is off and the brake is on simultaneously
What nobody has published adequately:
→ Dose-response curve for NMES + nutrition combined on satellite cell number in chronic (>5yr) SCI
→ Whether BFR + NMES combination drives satellite cell fusion in complete vs incomplete injury
→ Optimal leucine timing relative to NMES session (pre, intra, or post) for maximum MPS triggering
→ Long-term myostatin levels in patients doing regular NMES vs not — is there a trained suppression effect?
→ Whether pre-injury athlete status (higher baseline satellite cell density) survives chronic atrophy
What this community could actually document:
→ TENS response test results before and after running the Level 0–2 stack for 8 weeks — with dates, muscle groups, current levels
→ Thigh circumference measurements every 4 weeks during NMES protocol (proxy for cross-sectional area)
→ Dietary protein logs + TENS response threshold over time
→ n=1 case reports with consistent methodology are enough to justify a formal RCT proposal
Open an issue with "NMES-atrophy-data" label — we're building the dataset

The reason this is Level 4 isn't because it's less important — it's because it requires the most patience and the least certainty about outcomes. Levels 0–2 will very likely improve your TENS response. Level 3 might. Level 4 is where you become a contributor to the research, not just a recipient of it.

After 6–8 weeks on Level 0–2: re-run the TENS test from Step 1. Most people who failed initially will have a measurable response at this point. If still no kick: continue NMES + nutrition protocol, add BFR, and consider the Level 4 documentation path. The circuit isn't gone — it's quiet.

2
Get the bike and secure your feet

Now that you know your quads respond, get a bike. Find a used recumbent stationary bike ($30–80 on Facebook Marketplace or Craigslist). Recumbent is better than upright for SCI — lower seat, easier transfer from a wheelchair, natural leg position with gravity helping you stay seated.

If you already have an upright bike, put it on a magnetic trainer stand ($25–40). Both work.

⚠ Safety — Foot Security Your feet must be secured to the pedals before any stimulation. When your quad fires, your whole leg extends — if your foot isn't strapped in, it will come off the pedal and the crank will swing free. Use rigid caged pedals with a velcro ankle strap over the top. No exceptions. Test it: try to pull your foot off with your hand. If it comes free, fix it before proceeding.

Also consider a lap belt or hip strap if your trunk control is limited. A simple climbing harness chest strap zip-tied to the seat back works well. Test that you can sit stably on the bike for 5 minutes before adding any electronics.

💡 Tip — Transfer height Recumbent bikes with seats close to wheelchair height make transfers much easier and safer. Look for ones where the seat is 16–19 inches off the ground. Bring a measuring tape to whoever's selling it.
3
Wire the angle sensor to the crank

This is what makes SparkCycle work instead of just shocking you randomly. The Hall effect sensor reads a magnet on the crank arm and tells the Arduino where in the rotation you are. Each leg's quads fire in the correct phase — right quad from 350° to 90°, left quad from 170° to 270°.

── CRANK ARM ──────────────────────────────────────────────

Attach a 6mm neodymium magnet to the crank arm with epoxy or tape.
(The magnet spins with the crank.)

Mount an A3144 Hall sensor in a fixed position on the frame,
~3mm gap from the magnet path. Point the flat face at the magnet.

── SENSOR WIRING ──────────────────────────────────────────

A3144 Pin 1 (VCC) ──→ Arduino 5V
A3144 Pin 2 (GND) ──→ Arduino GND
A3144 Pin 3 (OUT) ──→ Arduino D2 (with 10kΩ pullup to 5V)

── TEST ───────────────────────────────────────────────────

Open Arduino Serial Monitor at 115200 baud.
Spin the crank by hand.
You should see "HALL pulse" printed once per revolution.
If you see it: sensor is working ✓

For budget builds: 5 sensors at 72° spacing gives enough resolution to distinguish quad-on vs quad-off phase. For a cleaner build: one AS5048A magnetic rotary encoder on the bottom bracket axle gives continuous angle. Both work fine.

💡 Tip — First verify by hand Before attaching anything to your body, spin the crank by hand and confirm the Hall sensor fires in the Serial Monitor. This takes 5 minutes and prevents troubleshooting with electrodes on.
4
Wire the optocoupler board — the safety layer

This step is non-negotiable. The optocoupler board creates optical isolation between the Arduino (powered by a computer or USB charger) and the stimulator (connected to your body). A direct connection could create a ground loop through you. The $9 board prevents this completely.

── ISOLATION LAYER ────────────────────────────────────────

Arduino D8 ──→ Relay Board CH1 IN (optical isolation) Relay CH1 OUT ──→ Stimulator CH1 trigger
Arduino D9 ──→ Relay Board CH2 IN (optical isolation) Relay CH2 Out ──→ Stimulator CH2 trigger
Arduino D10 ──→ Relay Board CH3 IN (optical isolation) Relay CH3 Out ──→ Stimulator CH3 trigger
Arduino D11 ──→ Relay Board CH4 IN (optical isolation) Relay CH4 Out ──→ Stimulator CH4 trigger

Arduino GND ──→ Relay Board logic GND
Arduino 5V ──→ Relay Board VCC

✗ NEVER connect Arduino GND to stimulator output ground
✓ The optocoupler board is the only connection between the two systems
⚠ Safety — Isolation is everything The stimulator's output channels are floating — they see only your body. The Arduino is referenced to USB/wall power ground. These two grounds must never meet. The optical isolation board costs $9 and makes this irrelevant. If you skip it and there's ever a fault, the path of least resistance is through you. Buy the board.
5
Flash the firmware and test without electrodes

Download fes_controller.ino from this repo and flash it to your Arduino Nano using the Arduino IDE (free, arduino.cc).

// What the firmware does:
// 1. Waits for "GO" command on Serial (safety — nothing fires until you say so)
// 2. Reads Hall sensor pulses to track RPM and crank angle
// 3. Fires relay channels at correct phase windows
// 4. TIMEOUT: if no crank movement for 5 seconds → kills all channels automatically
// 5. "STOP" command → kills all channels immediately

// To test without electrodes:
// 1. Open Serial Monitor at 115200 baud
// 2. Send "GO"
// 3. Spin crank by hand
// 4. Watch output: RPM, angle, channel states
// 5. Send "STOP" — verify all channels show 0
💡 Tip — LED indicator Pin D13 blinks at your pedaling cadence. Spin the crank and watch the built-in LED blink. If it blinks — the sensor loop is working. This is your go/no-go for everything else.
⚠ Safety — Test without body connection first Confirm the relay board clicks in the correct pattern (you'll hear it) before connecting to the stimulator. Confirm the stimulator triggers correctly with a multimeter on the trigger inputs before connecting electrodes to your skin. Set stimulator current to zero before connecting. Then increase from zero.
6
First session — 10 minutes, not 30

First session is a calibration. Not a workout. You're learning how your body responds to this setup, not hitting a training dose yet.

  • Transfer onto bike. Secure feet in cages. Verify you can't pull a foot free.
  • Apply electrodes to both quads (see placement in Step 2). Press firmly. All four corners of each electrode should be flat.
  • Connect electrode leads to stimulator. Set stimulator to: 35 Hz, 300 μs, 0 mA.
  • Open Serial Monitor. Send "GO". Spin crank manually — verify channels fire at correct phases.
  • With crank at right-quad position (~30°), slowly increase right channel current until you see a visible leg kick. Note the threshold mA. Reduce back to zero.
  • Repeat for left quad.
  • Set both channels to 80% of your threshold mA. Start the crank manually. Let the FES take over.
  • Ride for 10 minutes maximum. Watch for skin response under electrodes. Note any discomfort.
  • Send "STOP" or just stop pedaling (timeout kicks in at 5 seconds).
  • Remove electrodes. Check skin. Minor redness at electrode edges is normal. Significant redness, blistering, or pain is not — reduce current next session.
  • ⚠ Safety — Have someone present for the first session The first time you run this, have another person in the room who can send "STOP" or disconnect power if anything unexpected happens. After you know how your setup responds, you can run it solo.
    💡 What success looks like Both quads contracting in alternating pattern. Cranks turning with visible effort. Even if the cadence is slow (10–20 RPM), the cycle is happening. That's the signal going where it needs to go.
    7
    Training protocol — building to the BDNF dose

    The research dose that shows BDNF upregulation and meaningful neuroplasticity signal is 30 minutes × 3–5 sessions per week. You don't get there on day one. Ramp slowly — your skin, muscles, and overall system need to adapt.

  • Weeks 1–2 10–15 min, 3×/week. Focus on electrode placement consistency and current calibration.
  • Weeks 3–4 20 min, 4×/week. Add hamstring channels if quad timing is stable and comfortable.
  • Week 5+ 30 min, 5×/week. This is the target training dose. The BDNF literature uses this as the floor for measurable effect.
  • Month 2+ Optional: add glute channels. Log session data (RPM, duration, current levels) — the trend over time matters.
  • The cadence doesn't need to be high. 20–40 RPM drives the CPG (central pattern generator) circuits effectively. 40+ RPM starts to look like actual cycling. Both are valid. Both send signal.

    💡 Log everything Notes app, paper, spreadsheet — doesn't matter. Date, duration, RPM range, current level, anything you noticed. Trends over 4–8 weeks are where the data lives.

    ⚙️ Motor Assist OPTIONAL ADD-ON

    A small motor on the crank spindle — controlled by a thumb throttle on the handlebar — can help maintain pedaling rhythm when FES alone isn't producing enough torque, or during rest intervals when you want to keep the legs moving passively. Think of it as power steering for the crank. You control the assist level; the FES still drives the muscle timing.

    A
    Motor assist hardware
    PartWhat it doesSourceCost
    24V DC gear motor (25–50W)
    with encoder output preferred
    Drives the crank shaft via a chain or belt coupling. Low RPM, high torque = right spec for cycling assist. Amazon, AliExpress — search "25W 24V gear motor" $35–55
    24V DC motor controller (PWM)
    BTS7960 or IBT-2 module
    Lets the Arduino set motor speed via PWM signal. Handles up to 43A — massively oversized for this use, which means it runs cool and never fails. Amazon "IBT-2 motor driver" $8
    Thumb throttle
    0–5V or 0–3.3V hall-effect type
    Mounts on the handlebar. Outputs 0.8–4.2V proportional to thumb position. Arduino reads this as assist level 0–100%. Amazon "ebike thumb throttle" $12
    24V 5Ah LiFePO4 battery pack
    or 6× 18650 cells in series
    Powers the motor. LiFePO4 is safer than Li-ion for DIY — no thermal runaway risk. Amazon — search "24V LiFePO4 5Ah battery" $45
    Chain or toothed belt coupling Connects motor output shaft to crank spindle. A simple #25 chain and two sprockets works fine at this torque level. Amazon, local bike shop $15
    Motor assist add-on total ~$115
    ⚠ Safety — Motor direction The motor must only drive the crank in the forward direction. Add a diode or one-way bearing on the coupling so the motor cannot backdrive you if it stalls or misfires. Test motor direction before coupling to the crank: the correct rotation should push the pedals in the forward (forward-cycling) direction when you squeeze the throttle.
    B
    Throttle wiring and firmware
    ── MOTOR ASSIST WIRING ────────────────────────────────────

    Thumb throttle signal ──→ Arduino A0 (analog read 0–1023)
    Thumb throttle VCC ──→ Arduino 5V
    Thumb throttle GND ──→ Arduino GND

    Arduino D5 (PWM) ──→ IBT-2 RPWM
    Arduino D6 (PWM) ──→ IBT-2 LPWM (set to 0 — forward only)
    Arduino D7 ──→ IBT-2 R_EN and L_EN (enable pin)

    IBT-2 B+ / B- ──→ 24V Battery
    IBT-2 M+ / M- ──→ Motor terminals

    Battery and motor are isolated from stimulator circuit entirely.
    Shared Arduino ground is the only connection — this is safe.

    The firmware reads the throttle analog value and maps it to a PWM duty cycle on the motor driver. At 0% throttle: motor off, FES does all the work. At 100%: motor provides full assist.

    // Add to fes_controller.ino loop():
    int throttle_raw = analogRead(A0); // 0–1023
    int motor_pwm = map(throttle_raw, 150, 900, 0, 255); // calibrate deadband
    motor_pwm = constrain(motor_pwm, 0, 255);
    analogWrite(5, motor_pwm); // RPWM — forward only
    analogWrite(6, 0); // LPWM always 0 (no reverse)
    💡 How to use motor assist Start each session without assist while your FES is warming up. Add assist gradually if fatigue sets in or cadence drops below 15 RPM. The goal is to keep the crank moving — passive cycling still drives BDNF, still maintains muscle length and joint ROM. Assist doesn't mean cheating. It means staying in the game.

    📂 All Files
    race-to-walk-again/
    └── diy_fes_bike/
    ├── diy_fes_bike.py — parts list + stimulation timing algorithm (Python)
    ├── SAFETY.md — full safety protocol
    └── firmware/
    └── fes_controller.ino — Arduino firmware (flash this to your Nano)

    📖 The science behind it

    FES cycling is not experimental. It has been studied for 30+ years. The core findings are consistent:

    BDNF upregulation — Aerobic exercise (including FES cycling) elevates brain-derived neurotrophic factor. BDNF supports synaptic plasticity, axon sprouting, and motor circuit reorganization. The dose is ~30 min at sufficient intensity, 3–5×/week. (Vaynman et al. 2004, Cai et al. 2006)

    CPG entrainment — The lumbosacral spinal cord contains central pattern generators for locomotion. Even in complete SCI, these circuits remain intact below the injury. Rhythmic cycling input — whether voluntary or FES-driven — can drive these circuits and maintain their excitability. (Edgerton et al., Harkema et al.)

    Muscle maintenance — SCI causes rapid muscle atrophy and fat infiltration in paralyzed limbs. FES cycling slows this, maintains cross-sectional area, and improves insulin sensitivity. These matter for long-term health regardless of functional recovery outcomes.

    Pre-injury athletic history — Cyclists and runners have higher baseline CPG circuit weight (LTP-consolidated via years of training). The Hebbian decay after injury operates on a higher starting value. This means more circuit residue survives the same chronicity. Chronic injury ≠ exhausted circuit. See signal_scaling_law.py for the formal model.