It began when Madelyn Song was only 14 months old. Roughly two hours after she fell asleep, she would sit up suddenly in her crib and begin to scream and violently flail her limbs.
"We would try to hold her and keep her safe so she didn't hurt herself when she was thrashing around," her mother, Carol Lin, told CBS News. Ten to 15 minutes would pass before Madelyn would wake up, smile at her terrified parents and fall back to sleep.
Lin, a former child psychologist, saw all of the hallmarks of night terrors in her daughter: inconsolable crying and screaming, open eyes but an unawareness of others and no memory of what happened during the night.
Lin believed that she and her husband would have to wait for the sleep problem to pass on its own, which could take months or years.
Night terrors are episodes of screaming and extreme fright that occur while someone is still asleep. They are most common in children, but can also affect adults. The Mayo Clinic says most children eventually outgrow sleep terrors and don't suffer lasting harm, but the experience can be frightening and exhausting for families living through it.
Dr. Andy Rink knows how difficult the problem can be to handle. "My twin sister suffered from night terrors throughout her childhood, and now her children do as well, so I have seen firsthand how scary and disruptive pediatric sleep disorders can be for entire families," he said. "Once I started looking into sleep disorders and I realized just how many millions of people suffer from them in this country, I knew I wanted to design a device to help people overcome sleep issues."
Rink, a physician trained in general surgery, teamed up with Varun Boriah, an engineer and former CEO of a blood-diagnostics company, to try to develop a solution. As fellows in the Stanford Biodesign Program, Rink and Boriah created a device they call the Lully Sleep Guardian and won financial backing from Y Combinator to produce it.
The Lully Sleep Guardian is a small bluetooth-enabled electronic gadget that slides under the child's mattress. It works by rousing a child with gentle vibrations just before a night terror occurs, preventing them from entering the deleterious stage of sleep.
Carol Lin learned about it when Madelyn was 2 and still suffering from frequent night terrors. She decided to try it out.
"It was not intrusive, so I didn't think it was a big deal if it didn't work," she said.
To use it, parents first answer a few questions about their child's sleep patterns on the Lully smartphone app. Then a proprietary algorithm determines the right time to trigger the device, partially waking a child with gentle vibrations.
The Lully system is based on a standard technique for treating night terrors called scheduled awakening. With scheduled awakening, parents keep track of the time their child typically has a night terror and wakes them up just before.
"With the Sleep Guardian you're not fully waking the kid up or keeping the child awake, so you're not disrupting sleep patterns," Rink said.
In 2014, Rink and Boriah worked with Stanford University School of Medicine researchers who conducted a clinical study to test the effectiveness of the device. The team recruited 150 subjects who were suffering from night terrors and had them use the Sleep Guardian for a period of four weeks.
Results from the study found that on average, night terrors were reduced by 80 percent. In some cases the night terrors were eliminated, according to a posting on the company website.
The research has yet to be published. The Lully Sleep Guardian retails for $129 and can be bought on Amazon.
Dr. Lisa Medalie, a pediatric sleep expert at University of Chicago Medicine who was not involved in the research or associated with Lully, said the technology sounded promising.
"The more tech that we can use to make it easier for parents to adhere to our behavioral interventions is great from my standpoint, " she told CBS News.
Lin says it worked for her family; Madelyn's night terrors stopped four months ago. Now, "Maddie sleeps through the night," she told CBS News. "The Sleep Guardian was super useful. I wish we could get more use out of it, but I guess that's the point."