Russian astronaut Vasily Tsibliyev hadn't had a good night's sleep for 12 days. He was being kept awake on purpose, as part of a study about sleeping on board the space station Mir. On the 13th day, June 25, 1997, he was assigned to guide a cargo ship to dock with the space station. But the ship came in too fast, crashing into Mir and knocking out half of the station's power.

A NASA case study later found that there were problems with the docking procedure for the cargo ship — problems Tsibliyev might have been able to mitigate if he hadn't been so badly fatigued.

"It could have killed everyone," said psychologist Erin Flynn-Evans, who runs the sleep research program at NASA's Ames Research Center. "It was really a disaster."

We talked with Flynn-Evans in her office at Ames about how she helps astronauts sleep in space — and what can happen when they don't get enough.

How is falling asleep in space different from sleeping on the ground?

Sleep is something a lot of us take for granted. A lot of people fall asleep if they can get to it, you know, they just see it as something you have to do.

But in space, in some ways, the question is, "Can you sleep?" The astronauts have to sleep in a weightless environment so that means they don't have control of their arms and legs. Their arms can float up and hit their face when sleeping. If they don't restrain themselves to a wall, they will just float through the capsule that they're in, and some people do that.

The other big difference between space and Earth is that on Earth we are aligned to the 24-hour schedule by the exposure to light that we get every day. But in space, the space station orbits around the earth every 90 minutes, so they get a sunrise and sunset every 90 minutes. And the body clock can't adapt to that — it's far too fast. So what happens is the internal clock starts to desynchronize from the schedule they have up there.

That desynchrony is challenging because your body clock is what tells you when to go to sleep, and it's also what promotes wakefulness. So the functional consequence is that astronauts can be in space and have a scheduled time to sleep, and they may be awake for a long time, but when they try to bundle themselves in, they may not be able to sleep at all.

What happens to astronauts when they aren't getting enough rest?

Basically when anyone is sleep deprived, you start to lose focus, you get grumpy. So if you're in a small confined environment with just a couple of people, you may lose the ability to work as a team. On the International Space Station, this is already a problem, but it's an even bigger problem for deep space flight [like a mission to Mars]. If you start to have rifts between crew members, that could be a major problem. We also have little slips and lapses. On Earth, if you are tired and you walk out of the house without your phone that's annoying, but nobody is likely to die over that. If you make a very small mistake on the space station, someone could die. So the stakes are very high, and we can't really afford to have crew members making even tiny mistakes like that.

Of course the crew members are very highly trained, so it's different than life on Earth, and there's a lot of oversight … but we're very concerned about deep space flight because there will be a time delay [in communication], and so we won't have the same type of oversight that we have on ISS. It will be a lot longer mission and harder to schedule every little thing.

Is there any way to make sure sleepy astronauts don't slip up?

This summer we did a sleep deprivation study where we tested a new device that may be very sensitive to detecting when someone is fatigued. … We kept people in our lab here at Ames, we kept them awake for 28 hours in a dark room, in a bed, and had them do this test over and over again to see how sensitive it was to their sleep loss.

It's called the psychomotor vigilance task, and it's basically a simple reaction time test. Basically what it does is it gives you a stimulus, and every time you see the stimulus, you hit a button, and it's deliberately boring. And so, when we're bored doing something like that really reveals our underlying sleepiness. So … we might be able to use that device both in aviation and in space flight to determine whether somebody is rested and alert enough to do what they need to do.

You might think that sounds weird, but we aren't very good at telling when we aren't functioning perfectly, so by having an objective device we might be able to say oh, this person might not be ready to do that complex task, let's let them have a nap or caffeine or something before they do it.

How does NASA try to make it easier for astronauts to sleep?

It's interesting — the space environment has gone up and down with respect to comfort. Skylab [the U.S. space station that operated between 1973 and 1979] was quite luxurious: They had individual crew rooms, they had these mattresses they could strap themselves to. But on the Apollo lunar landers, there were no sleep accommodations whatsoever. That was a real problem because they had partial gravity, so they were basically very uncomfortable because they were in this partial gravity environment on the moon, and nobody thought about where someone would sleep once they got to the moon.

So, where did they end up?

On the equipment. Or in their chairs. There are some interesting narratives from the Apollo days about how awful the sleep environment was.

Hopefully the situation is a bit more comfortable now.

Yeah. On the International Space Station, each person has their own individual room, essentially, and they can shut the door, strap themselves in. … They're like little coffins that they shut themselves into. They have little sleeping bags they can zip up, they can velcro themselves to the wall. They can do various types of bundling to get their arms down, and that helps them feel that sensation of being pressed against something. Some of them will even harness their heads to a pillow.

One of the most important things that we do to help astronauts is the way that we control the light dark cycle up there. We use different wavelengths of light to help reset their clock. Basically, blue light is what has the strongest effect on the circadian rhythm, probably because our sky is blue. We can change the wavelength to blue when we want the astronauts to be awake and alert, and when we want them to sleep, we can shift that color spectrum to red to help them prepare for bed.

It sounds like making sure a toddler gets enough sleep.

It's definitely very similar, and sometimes they may not want to go to sleep when they're scheduled to sleep. That's another really strange thing about space compared with the ground.

Are there any surprises from space sleep research?

One thing is Mars has an orbit that's a little bit longer than Earth, but it's a big deal because if you're going to go from Earth to Mars, you're going to have to be able to sleep 39 minutes longer every day, so one thing we've found is people who have longer circadian rhythms are probably better suited to go to Mars.

Read more:

Dear Science: Is yawning really contagious?

R.I.P., Rosetta: The orbiter just smashed into its comet in the name of science

Ask a MacArthur genius: What do ancient rocks and cystic fibrosis have in common?

Bees are bold when they're on a sugar buzz

Ask a MacArthur 'genius': Could elusive deep-sea microbes help fight climate change?