Thomas Edison was famously opposed to sleeping. In an 1889 interview published in Scientific American, the ever energetic inventor of the lightbulb claimed he never slept more than four hours a night. Sleep was, he thought, a waste of time.

Yet Edison may have relied on slumber to spur his creativity. The inventor is said to have napped while holding a ball in each hand, presuming that, as he fell asleep, the orbs would fall to the floor and wake him. This way he could remember the sorts of thoughts that come to us as we are nodding off, which we often do not recall.

Sleep researchers now suggest that Edison might have been on to something. Published recently in Science Advances, a new study reports that the we have a brief period of creativity and insight in the semilucid state that occurs just as we begin to drift into sleep, a sleep phase called N1, or non-rapid-eye-movement sleep stage 1. The findings imply that if we can harness that liminal haze between sleep and wakefulness—known as a hypnagogic state—we might recall our bright ideas more easily.

Inspired by Edison, Delphine Oudiette of the Paris Brain Institute and her colleagues presented 103 participants with mathematical problems that had a hidden rule that allowed them to be solved much faster. The 16 people who cracked the clue right away were then excluded from the study. The rest were given a 20-minute break period and asked to relax in a reclined position while holding an object in their right hand. If the object fell, they were then asked to report what they had been thinking prior to letting go.

Throughout the break, subjects underwent polysomnography, a technology that monitors brain, eye and muscle activity to assess a person’s state of wakefulness. This helped determine which subjects were awake rather than in N1 or N2—the next, slightly deeper phase of our sleep—based on their brain-wave activity.

Following the break, the study subjects were presented with the math problems again. Those who had dozed into N1 were nearly three times as likely to crack the hidden rule as others who had stayed awake throughout the experiment—and nearly six times as likely as to do so as people who had slipped into N2. This “eureka moment,” as the authors call it, did not occur immediately. Rather it happened after many subsequent attempts to solve the math problem, which is consistent with previous research on insight and sleep.

As for whether Edison’s technique of gripping balls holds any weight, the new study found its efficacy unconvincing—and participants were instead given a  small drinking glass to hold. Of the 63 subjects who dropped the object as they fell asleep, 26 did so after they had passed through N1 sleep. Still, the findings suggest that we do have a creative window just before falling asleep.

Oudiette says that, like Edison, her personal experience with sleep inspired the study. “I’ve always had a lot of hypnagogic experiences, dreamlike experiences that have fascinated me for a long time,” she says. “I was quite surprised that almost no scientists have studied this period in the last two decades.”

A study published in 2018 found that a brief period of “awake quiescence,” or quiet resting, boosted the odds of discovering the same mathematical rule used in Oudiette’s experiment. And psychologist Penny Lewis of Cardiff University in Wales suggests that both rapid-eye-movement (REM) sleep—the phase in which our eyes dart back and forth and most dreams occur—and non-REM sleep work together to encourage problem-solving.

Yet for the most part, Oudiette is not aware of any other research specifically looking at the influence of sleep onset on creativity. She does, however, point to plenty of historical examples of this phenomenon.

“Alexander the Great and [Albert] Einstein potentially used Edison’s technique, or so the legend goes,” she says. “And some of the dreams that have inspired great discoveries could be hypnagogic experiences rather than night dreams. One famous example is the chemist August Kekulé finding the ring structure of benzene after seeing a snake biting its own tail in a ‘half-sleep’ period when he was up working late.” Surrealist painter Salvador Dali also used a variation of Edison’s method: he held a key over a metal plate as he went to sleep, which clanged to wake him as he dropped it, supposedly inspiring his artistic imagery.

“This study gives us simultaneous insight into consciousness and creativity,” says Adam Haar Horowitz of the M.I.T. Media Lab, who has devised technology to interact with hypnagogic states, but did not collaborate with Oudiette’s team. “Importantly,” he adds,“it’s the kind of study that you can go ahead and try at home yourself. Grab a metal object, lie down, focus hard on a creative problem, and see what sort of eureka moments you can encounter.”

For University of California, Santa Barbara, psychologist Jonathan Schooler, who  also was not involved with the project, the study does not necessarily prove that just anyone will be able to mine their creativity during this early phase of somnolence. As he points out, “Residing in the ‘sweet zone’ might have also simply refreshed the study participants, making it easier for them to solve the problem later.” But Schooler acknowledges that there may be something very solid in the study’s findings. “The new results suggest there is a creative sleep sweet spot during which individuals are asleep enough to access otherwise inaccessible elements but not so far gone that the material is lost,” he says.

Despite its reputation as the brain’s period of “shutting off,” sleep is, neurologically speaking, an incredibly active process. Brain cells fire by the billions, help reactivate and store memories, and, it seems, allow us to conjure our mental creations.

Oudiette hopes not only to confirm her findings in future research but also to determine if focusing on our hypnagogic state might help solve real-world tasks and problems by harnessing the creative potential of that liminal period between sleep and wakefulness. Additionally, she and her group are considering the potential of brain-computer interfaces to precisely identify brain-wave patterns associated with the onset of sleep, allowing the precise identification of when people should be awoken during their moments of putative insight.

“We could even teach people how to reach this creative state at will,” Oudiette envisions. “Imagine playing sounds when people are reaching the right state and other sounds when they are going too far into sleep. Such a method could teach them how to recognize the creative state and how to reach it.”