By age 32, Sheri Finstad’s epileptic seizures had become unbearable. She frequently fell, injured herself, and got concussions. Her doctors tried neuro­surgery to better understand her condition, and a special diet and medication to treat it, to no avail. Then she enrolled in an experimental trial at the Mayo Clinic.

A surgical team implanted two stimulators, each about the size of a deck of cards, below Finstad’s clavicles. They threaded wires up her neck, just beneath the skin, to four probes implanted in her brain. Doctors programmed the device to deliver a constant flow of electricity to electrodes on the probes. In deep regions of the brain, such as the thala­mus and the hippocampus, this current affects the electric signals that neurons use to communicate.

“It’s kind of like a pacemaker for the brain,” says Zoltan Mari, director of the Deep Brain Stimulation Center at Johns Hopkins, who uses the therapy to treat dystonia and tremors associated with Parkinson’s disease. But Finstad’s device is even more advanced. In addition to stimulating the brain, it records her brain activity so doctors can better understand her epilepsy.

So far, study results suggest the treatment is effective and has fewer side effects than drugs. It’s now in the final stages of FDA approval. Regulators have already signed off on the therapy (with non-recording devices) to treat epilepsy in 30 countries—including Australia, Canada, and a number of countries in the European Union.

Neuroscientists anticipate deep brain stimulation might also soon be used to treat depression, control blood pressure, and regulate metabolism. In a 2013 pilot study, obese patients who failed to lose weight after getting bariatric surgery did lose weight after stimulation of their hypothalamus, the region associated with hunger.

Finstad must visit the doctor to transmit data from her device, but the next-gen stimulator, now in animal trials, will transfer it directly to a patient’s computer. Mari predicts future devices could be even smarter, reading the neurological activity, and automatically adjusting the settings to deliver a more precise current, right when it’s needed.

This article was originally published in the November 2015 issue of Popular Science under the title “Electricity Tamps Down Epilepsy.”