Real-time Hodgkin-Huxley solver. Adjust stimulus current, membrane capacitance, and Na/K conductances to watch ion channels gate and membrane voltage spike.
Channel currents are gated by voltage-dependent variables m, h, n. Defaults reproduce the classic squid axon parameters (E_Na=50, E_K=-77, E_L=-54.4 mV).
💬 Discussion
🙋
An action potential looks like the neuron just "fires" instantly. What is actually happening at the membrane?
🎓
When a stimulus pushes the voltage past about -55 mV, voltage-gated Na⁺ channels snap open. Sodium rushes in and the inside of the cell jumps to roughly +40 mV. Then Na⁺ channels inactivate while K⁺ channels open, and potassium leaves until the membrane is back near -70 mV. The whole event takes 1-2 ms.
🙋
I keep hearing "all-or-nothing". What does that actually mean?
🎓
Below threshold, no spike — the voltage just decays back. Above threshold, you always get the same spike, no matter how much harder you push. Information is encoded in the firing rate, not the spike size. Dial I_ext around 7 µA/cm² to see the threshold sharply.
🙋
The gate variables m, h, n look complicated. What are they?
🎓
m is the fast Na⁺ activation gate, h the slower Na⁺ inactivation gate, and n the K⁺ activation gate. m rises first and lets sodium in, then h falls and shuts sodium off, and n keeps rising to drive the recovery. Their staggered kinetics shape the spike.
Frequently asked questions
Q. How do local anesthetics block pain?
A. Drugs like lidocaine bind to the inner side of voltage-gated Na⁺ channels and block them. Without Na⁺ influx the neuron can no longer fire, so the pain signal never travels. Lower ḡ_Na in this simulator to reproduce the effect.
Q. What does tetrodotoxin (puffer-fish toxin) do?
A. TTX is an extremely potent and selective blocker of voltage-gated Na⁺ channels (K_d ≈ 1 nM). It abolishes action potentials and causes muscle and respiratory paralysis. In the lab it is used as a precise pharmacological tool.
Q. How fast do nerves conduct signals?
A. Unmyelinated axons: 0.5-2 m/s. Myelinated axons (saltatory conduction at the nodes of Ranvier): 70-120 m/s. A signal from spinal cord to hand (~1 m) travels in roughly 10-15 ms via myelinated fibres.
Q. How does HH compare with modern neuron models?
A. The 1952 HH model captures Na⁺/K⁺/leak dynamics. Modern simulators (NEURON, Brian2) add tens of channel types (Ca²⁺, Cl⁻, ...) plus dendritic structure. HH remains the canonical starting point — Hodgkin and Huxley shared the 1963 Nobel Prize for it.
About this simulator
The Hodgkin-Huxley model is the foundation of computational neuroscience. Voltage across the membrane evolves according to the four-current equation $C_m\,dV/dt = I_{ext} - g_{Na}m^3h(V-E_{Na}) - g_K n^4(V-E_K) - g_L(V-E_L)$, with the gating variables m, h, n following first-order kinetics driven by voltage-dependent rate constants α and β.
This page integrates the equations forward in time with a small Euler step (dt = 0.01 ms over 40 ms). Move any slider to re-run the simulation and observe how the spike threshold, refractory period, and firing pattern depend on stimulus current and channel densities.
Real-world applications
Pharmacology & medicine. Local anesthetics, antiepileptics, and antiarrhythmic drugs work by modulating Na⁺ or K⁺ channels. Reducing ḡ_Na in this simulator mimics lidocaine or tetrodotoxin; lowering ḡ_K produces broader spikes similar to certain channelopathies.
Neural prostheses. Cochlear implants, deep-brain stimulators, and spinal cord stimulators deliver controlled current pulses. Engineers tune pulse amplitude and duration against simplified HH-like models before in-vivo testing to minimise animal use and shorten development cycles.
Cardiac & computational biology. The HH framework was extended into cardiac myocyte models (Beeler-Reuter, Luo-Rudy, ten Tusscher). Modern multi-scale simulators couple ion-channel models with finite-element tissue meshes for arrhythmia and drug-induced QT prolongation studies.
Common misconceptions
"Bigger stimulus, bigger spike." Above threshold the spike amplitude is set by the Na⁺ reversal potential, not by the input current. Stronger inputs increase firing frequency, not spike height.
"More channels, faster recovery." Increasing only ḡ_K speeds repolarisation but can shorten the spike so much it disappears. Increasing only ḡ_Na can lock the cell in depolarisation. Real neurons depend on a tuned ratio.
"HH is the truth." The HH parameters come from a 6.3 °C squid giant axon. Mammalian neurons run at 37 °C and contain dozens of channel types. Use HH for intuition, not for quantitative drug dosing.
Set stimulus current (iext-slider) between 5–20 µA/cm² to trigger action potentials; values below 7 µA/cm² typically fail to reach threshold
Adjust stimulus onset time (ton-slider) in milliseconds to control when depolarization begins relative to simulation start
Set stimulus duration (tstim-slider) from 0.5–5 ms; shorter pulses may fail to sustain regenerative inward current
Modify membrane capacitance (cm-slider) between 0.5–2 µF/cm²; typical squid axon is 1 µF/cm²
Click Run to solve Hodgkin-Huxley equations and observe voltage, sodium (Na+), potassium (K+), and leak conductances across time
Worked Example
Giant squid axon at 6.3°C: iext=10 µA/cm², ton=1 ms, tstim=2 ms, cm=1 µF/cm². Simulation shows resting potential −65 mV, rapid depolarization to +30 mV peak within 1 ms, sodium inactivation gate h drops from 0.6 to 0.05, potassium activation n rises to 0.8, hyperpolarizing afterpotential reaches −90 mV at 4 ms, refractory period lasts ~1.5 ms. Increasing iext to 15 µA/cm² accelerates upstroke slope to 200 V/s.
Practical Notes
Rheobase threshold typically occurs near 6–7 µA/cm² for mammalian neurons; use stimulus strengths 1.5× rheobase for reliable recruitment
Membrane capacitance inversely affects depolarization rate; myelinated axons with lower cm show steeper dV/dt during stimulus phase
Sodium equilibrium (ENa ≈ +60 mV) and potassium equilibrium (EK ≈ −90 mV) determine repolarization kinetics; verify with voltage clamp protocols
Double-pulse stimulation with 2–3 ms interpulse intervals reveals sodium inactivation recovery; reduced second spike amplitude indicates incomplete h gate recovery
🎬 Watch it in motion
Electric Dipole | the field two opposite charges weave #Shorts