Applying an electrical current to the brain could induce lucid dreaming.

Lucid dreaming is when the person is aware they are in a dream and in many cases are able to control the situation, Reuters reported.

Researchers discovered that a certain frequency of brain waves is related to lucid dreaming.

Electroencephalograms showed a type of brain activity called gamma rays during the Rapid Eye Movement (REM) phases of sleep in participants who reported experiencing lucid dreams. These types of brain waves have only been known to occur when a person is experiencing a higher level of thinking.

The team looked at what happened when a current of the same frequency as gamma rays were applied when a person was asleep.

They attached electrodes to the scalps of 27 volunteers using a technique called transcranial alternating current stimulation (tACS).

The volunteers reported that they were able to control their dreams. An example described in the article suggested they could choose their outfit before leaving the house, Reuters reported. The volunteers also often reported feeling like they were watching themselves instead of being in the first person.

Ursula Voss of J.W. Goethe-University in Frankfurt, Germany, who worked on the study does not believe lucid-dreaming machines will be a common product in the future.

Devices like that  "do not work well," she told Reuters. A device that involves electrical stimulation "should always be monitored by a physician," she said.

The device could be useful in treating people with post-traumatic stress disorder and suffer debilitating nightmares that replay scarring memories from their past. Lucid dreaming could allow them to avoid these scary dream situations. They could do this in ways such as "turning down a different street than the one with the roadside bomb or ducking into a restaurant before the rapist attacks them," Reuters reported.

"By learning how to control the dream and distance oneself from the dream," Voss said.