Wayzata High School student develops tool for perfecting a good night’s sleep

[anvplayer video=”4958468″ station=”998122″]

A student at Wayzata High School developed a sleep calculator to help people figure out what time to go to bed so they can wake up well-rested.

It all started because 15-year-old Josh Ternyak couldn’t figure out why he just wasn’t feeling alert in the morning.

“I had a problem where I was getting eight hours of sleep, but I was waking up just tired and foggy. Mentally I was foggy,” Ternyak said.

The Plymouth teen began looking for answers, and they didn’t take long to find.

“So the problem was that I didn’t understand REM cycle,” said Ternyak.

REM stands for “rapid eye movement.” REM sleep is the deepest type of sleep someone can get in the sleep cycle.

“I realized I was waking up during a REM cycle, which caused me to feel groggy and tired in the morning. And then I did a bit of research and realized that the way to wake up and feel energized is to wake up in between REM cycles,” Ternyak said.

It just so happens Ternyak has been programming computers and coding since he was 11 years old. And the pandemic meant he had some free time on his hands. A week later, a solution was born.

The high school sophomore’s sleep calculator generates three of the best times to go to bed based on the body’s natural sleep cycle.

5 EYEWITNESS NEWS talked to Dr. Patrick Wright, who works at the Minnesota Sleep Institute, to understand how these sleep cycles work.

“REM sleep is one of the stages of sleep. It’s usually associated with dreaming, and it is a very unusual stage of sleep. It looks like you’re awake, when we look at […] your brain waves, but your body is paralyzed, so you don’t act out your dreams, which is very important — you don’t want to be acting out your dreams," Wright said. "And you have these rapid eye movements that flip back and forth. We can actually see your eyes when you’re asleep, move very quickly. Usually REM sleep is the last part of the sleep cycle.”

When you hit the deepest part of your sleep can depend on how long you’ve been sleeping.

“It’s an hour and a half at a time. The first cycle is lots of deep sleep and a little bit of dream-sleep. And then over the night, the next three cycles or four cycles if you’re lucky will end up with very little deep sleep, but much more dream sleep,” Wright said. "And at the end of your cycle, you have some REM sleep, usually in the first cycle it’s about five minutes, and by the end of the night that extends to about half an hour.

"So that’s why when you wake up in the morning, you may remember your dream because you woke up out of your REM sleep. […] You want to wake up at the end of your cycle rather than in it, but since we use alarms we usually wake up in our sleep cycles somewhere.”

The Sleep Foundation recommends school-aged children from ages 6-13 get nine to 11 hours of sleep; teenagers should get at least eight to 10 hours of sleep; and adults should get at least seven to nine hours of sleep.

Ternyak’s mission to help people wake up energized at the end of their sleep cycle has been well received.

“My family really likes the app. They really like the clock, how easy it is to use,” Ternyak said.

And people who have never met Ternyak like it, too. His online tool was picked up by Reddit and posted onto various "life hack" forums. Now, and it’s being hosted online.

Ternyak says he especially hopes the app helps kids his age.

“With the new school year coming ahead, basically to be effective in your learning I think you need to get the proper amounts of sleep, and know when you actually should go to bed,” said Ternyak.