Introduction: The Lucid Dream Machine

Picture of The Lucid Dream Machine
This is part of both the "let it glow" challenge and the robot challenge, so please vote for either/or category that you see fitting if you enjoyed/liked this instructable. Remember, voting is different than giving it a good rating.

First off, this is a Collaboration between me Guyfrom7up and Gmoon

Gmoon did all of the programming, debugging, etc.

Guyfrom7up did all of the hardware, PCB, etc.

What is Lucid Dreaming? Lucid Dreaming is when you are sleeping and dreaming and that you are aware that your are asleep and that you are dreaming, yet you don't wake up. This can be great, giving you full control of your dreams, jumping off of buildings, going into space, whatever your mind can create.

The Lucid Dream Machine is a pair of glasses that you wear while you are sleeping. About 4 hours into your sleep the AVR microcontroller pulse LEDs that shine through your eyelids. This half wakes you up. The flashing lights helps you become aware (in your sleep) that your are sleeping and dreaming, in doing so you become more likely to be able to control your dreams.

Our Collaboration give you the Lucid Dream Machine.

Sorry, but to watch a video you will have to download it, for some reason the video won't work on both youtube and metacafe.
(gmoon: I tweaked the video and uploaded to my account... I need to do this for all my videos, also.)

Step 1: Supplies

Picture of Supplies

In order to build the device you need:

1x ATtiny13v AVR Microcontroller
2x LEDs (color of your choice, we used red because it works at low voltage, shines through eyelids well, and is cheap)
2x Resistors (value of your choice)
1x SPST or SPDT switch (it's only used as a power switch, so it doesn't matter)
1x Normally off momentary switch
1x Lithium 3volt Watch Battery (we used a CR2032)
1x Lithium Watch Battery Holder (we used a CR2032 holder)
Some way of mounting the device to your face, such as glasses).

Ways of making a PCB or just Prefboard (up to you, we used a custom PCB using toner transfer and Eagle)
An AVR programmer

Step 2: About the Program

Picture of About the Program
Other than initialization, the lucid13 software runs entirely via interrupts. Timer-triggered IRQs count through the long initial wait until the subject is in a deep sleep. The timing scaler is then switched to a high rate to create the smooth PWM for the lucid dreaming LED blinking.

Functioning modes:

--User input/options
--Wait-for-sleep mode
--PWM dreaming mode


During startup the LED lights up for approx. 2 seconds to indicate operation.

The device also checks if the input button was pressed and held during power up for those initial 2 seconds. If it was, "immediate mode" is entered: the LEDs begin blinking. This is mostly so guyfrom7up could easily test the hardware without waiting for four hours ;-).

It could also be used for "catnap" type sleep states.

However, we could also add a bit of code to vary the pulse width...whattay think?

The Timer and IRQ setup for the initial wait state

After checking for user input, etc., and setting up the IRQ, the ATtiny13 is immediate placed in sleep mode. In this mode only the timers, clocks and IRQs are functional. Of course, this is a power-saving measure.

Rollover time for a 16-bit counter, per timer scaler value (times approx)--
-----------------------CS00:        13.75sCS01:        110s (1m, 50s)CS02:        3520s (58m, 40s)CS00 + CS02: 14080s (3.91h)

A ~4 hour wait is possible with the CS02 and CS00 flag combination, a clock scaler of 1024. In this state, the IRQ is triggered 4.6 times per second. The WAITING state could easily be fine tuned, by using the 16-bit counter (for durations < 4 hrs) together with the waitstate counter (for longer delays.)

Since four hours is as good a delay as any, a longer-duration waitstate isn't used. A longer delay would be a trivial matter to implement.

NOTE: guyfrom7up has found the waitstate for his AVRs is somewhat greater than 4 hours, while mine is somewhat less. The internal oscillator of the AVR isn't highly accurate, but it's good enough for our needs....

At 4.6 IRQs per second, CPU power consumption should be very low. Of course the AVR cannot be in power-down mode, as that requires an external wake up signal. Ours must be timed internally, so SLEEP_MODE_IDLE is our best choice.

IRQs per second, for each scaler (approx)--
---------------------CS00:         4766 /s   (during dream phase)CS01:         593.8 /sCS02:         18.6 /sCS00 + CS02:  4.6 /s    (during initial waitstate)

The Timer and IRQ setup for dreaming PWM mode

The timer scaler value changes to CS00 when MODE_DREAMING begins--in order to create the gentle transitions of the software pwm. The duty cycle for the CPU (and IRQ) is much greater (about 4.7K per second.) But the LED duty cycle is much less than it would be with a simple on/off switch. A trade off between cpu and LED current draw...

The overall pulse width (length) of the LED blink is controlled by the MACRO_WIDTH and MACRO_GAP constants. The PWM is handled by incrementing the pwm and transition variables by the constants PWM_VAL and TRANS_VAL. Altering those constants will change how rapidly the PWM "ramps up."

Currently, the dreaming frequency LED pulse rate is approx 1.5 hz.

Program Size

The current version (0.2b) uses only 438 bytes of flash memory. This is well short of the 1K limit on the ATtiny13.

So adding more features is certainly do-able.

Step 3: The Code

Picture of The Code

For some reason code isn't showing up right anymore, so I've attached a file with the C program

Step 4: The Circuit Board/Schematic

Picture of The Circuit Board/Schematic

We used a custom circuit board to make the end project look much cleaner for instructables (and the watch battery holder only worked on a custom PCB). The Circuit board pattern and schematic is posted below, but if you choose to make a PCB it's very likely that you have to redesign it because you won't have the exact same pieces as we do. We left a lot of wire pads so that it would be easy to upgrade in the future (such as adding more switches, LEDs, etc).

Step 5: Soldering

Picture of Soldering
If you do not know how to solder, watch videos such as this one:

and look into some soldering Instructables such as:

Solder some longs wires to the other side of the resistors and ground. It's easier to make them too long and then cut them shorter than the other way around. The other side is later going to be soldered to LEDs which hover over your eyes.

Step 6: Prepare the Mask

Picture of Prepare the Mask

I used a sleeping mask, so some of this might be purely situational, but it's just what I did.

Most masks are made up of 2 pieces of fabric and some squishy foam in the middle for comfort, what you need to do is somehow mount the Lucid Dream Circuit on the mask (above the nose) and cut out eye holes for the LEDs.

To mount the PCB I cut into one of the pieces of fabric and just slipped the PCB between the 2 pieces of fabric.

For eyes I just slowly guessed and check with a pair of scissors (make sure you don't cut the mask while it's on your face!!!)

Step 7: Line Up the Wire

Picture of Line Up the Wire

Line up & cut the wire to the correct length where you are going to mount the LEDs over your eyes.

Step 8: Solder on the LEDs

Picture of Solder on the LEDs

Solder the LEDs to the wires above the eyes. You may want to slip on some heat-shrink before you solder it up to prevent shorts later. Make sure the LEDs are facing the right way!

Step 9: Test It Out!

Picture of Test It Out!

Test out your finished Lucid Dream Machine! Turn it on, it should be able to shine through your eyelids, then the LEDs should go off and wait for 4 hours, and when you fall asleep they'll start blinking at you.

This will give you a good chance at controlling your dreams.

Have fun with it!

Step 10: Personal Experiences

I, honestly haven't been able to keep this device on for long enough when I'm sleeping for it to start working. For example, 1 night I think I took it off in my sleep without me knowing it, and another night I tossed and turn so much in my sleep in the first hour or so that when I woke up 2 hours from when I started sleeping I found the mask near the foot of my bed. Another night I think I took it off in my sleep...

I will update this once I get a successful experience.

Don't forget to vote!


Crafty_Dragon (author)2017-01-11

Does this thing work or not? I´ve been trying to train my brain and nothing's work. I would like to know if it works before I build this. Sounds really cool.

valveman (author)Crafty_Dragon2017-06-01

You don't need a device to Lucid Dream. It does however take effort on your part.

I have been Lucid Dreaming for nearly 20 years.

There is a lot of good info on the internet.

It is very important to keep a dream journal.

Good Luck.

carlos177567 (author)2011-01-28

I are a maojr in hallucinogenz and dose have wors effecs on yuo

Wow what language is that?

TwistOneUp (author)haunted_lady2017-01-01

"dose" instead of "those" indicates Chicagoese. And i knows dat as i'm a native chicagoan. So dere.

Haunted_Human - What he's doing is deliberately colloquial. Here's a definition for you straight from the precious dictionary -

Colloquial: conversational, informal referring to types of speech not on a formal level. Refers to a style used in the oral exchange of ideas, opinions, etc.: an easy conversational style, without formality, without strict attention to set forms, unceremonious: an informal manner of speaking; it describes the ordinary, everyday language of cultivated speakers.

I'm wondering if you're capable of leaving positive comments... You seem to enjoy hurting others.

gabrielzw (author)2015-09-02

que tremenda pelotudes.....hace algo productivo pendejo...cascate el mani...

Loopedfroot (author)2015-03-19

Is this real life :o

Build4343 (author)2009-01-05

If anyone has tried this please tell us what happened to insure that its safe!!

ArqueiroBrasil (author)Build43432015-02-05

Yes! It works! But... no magic! close the eyes, turn on the machine and go to the matrix is false! This "machine" do 5% of work, the other 95% is your mind learning the work.

The leds call your mind for attention only. Several months are request to you "wakeup" in a lucid dream.

My first lucid dream comes after 4 months usind everyday. Now, after 2 years, I do not need the machine. I can wakeup in a lucid dream by my self (when sleeping sure). But the sound around me is distractions and do dificults to still dreaming.

In the dream is very dificult still lucid, everytime I lost the control.

ArqueiroBrasil (author)Build43432015-02-05

Yes! It works! But... no magic! close the eyes, turn on the machine and go to the matrix is false! This "machine" do 5% of work, the other 95% is your mind learning the work.

The leds call your mind for attention only. Several months are request to you "wakeup" in a lucid dream.

My first lucid dream comes after 4 months usind everyday. Now, after 2 years, I do not need the machine. I can wakeup in a lucid dream by my self (when sleeping sure). But the sound around me is distractions and do dificults to still dreaming.

In the dream is very dificult still lucid, everytime I lost the control.

Bigev (author)Build43432009-08-19

What's the worst that could happen? The mask could fall off and choke you i guess, but otherwise it's risk free.

M4industries (author)Bigev2009-11-07

Maybe epileptic fits. I dunno

Kryptonite (author)M4industries2010-03-29

The lights aren't that bright of flashy.

haunted_lady (author)Kryptonite2010-04-24

 As a person with epilepsy any blinking light causes this. If you read in the agreement with Yahoo within the email account even they tell you there is chance of epileptic seizures. Just surfing your inbox can cause this. Best to not offer an opinion on something unless you know what you are talking about when this could cause harm. ANd really you could reprogram your mind with this device this type of stuff should not be allowed to be on this site. There is a reason there is an FDA even though they are not perfect.
You could cause yourself to be stuck in certain parts of sleep patterns and not fully get out like when you are driving.

ManifoldSky (author)haunted_lady2015-01-01

"Any blinking light" will NOT cause epileptic seizures, and even if it did, that would COMPLETELY obviate this point, as this would be no more problematic than ANYTHING else.

(And my degree in neuroscience trumps your psych degree.)

donhaynes (author)ManifoldSky2015-01-17


suspect13 (author)haunted_lady2010-11-17

I don't want to resurrect a dead flame war, but I feel obligated to correct misinformation when I stumble across it.

It's a bad idea to take someone's credentials at face value on the internet. An anonymous person who claims to hold a master's degree in psychology could just be a cat lady who took Inception a little too seriously. I'm not attacking haunted_lady's credentials, I'm just giving a cautionary note.

Fact: the percentage of people who have photosensitive epilepsy, who will be triggered by lights blinking slowly, is extremely low. A television is more dangerous than this instructable, and televisions are available for mainstream sale. I'm sure you aren't organizing a door to door campaign to ban the use of decorative lights around the holidays.

These lights are not going to hypnotize you into sleep patterns that catch back up with you in the afternoon when you're driving home from work. At worst, they may contribute to incidents of sleepwalking in individuals who are predisposed to it. OTC sleeping pills are just as dangerous, though.

Bigev (author)haunted_lady2010-04-24

I respect your input, and give due respect to your epileptic knowledge, but on the subject of this not being on the site I must disagree. Instructables is an open community of makers where any idea, no matter how unique or dangerous, is respected. A bit of discretion must be exercised when a project may be potentially dangerous, but Instructables usually leaves that up to the individual readers.

In short:
If you know you have epilepsy, then you should know better than to strap blinking lights to your face. Further, I don't believe that it is possible to get stuck in a particular stage of sleep.

Use common sense, I want proof of mind-stickage

bowmaster (author)Build43432010-07-15

Who cares if it's safe? It's science!!!

Delo97 (author)bowmaster2011-06-15

Are you GLaDOS or what? ^_^

bowmaster (author)Delo972011-06-17

A bit.

Delo97 (author)bowmaster2011-06-24

Anways, I think that the prgress of Science can't be stopped because of dangers too!

mickydeejr (author)2015-01-21

thirty dollars it does not work

Suraj Grewal (author)2015-01-11

Try mounting some bright leds on the bed side, pointing towards your face.

Bigev (author)2010-04-25

I value your input, and yes it is true that the SHOULD aspect of making is often times overlooked, but I do not appreciate being bashed. I invent words like "stickage" to use in lieu of other more proper words to give a more accurate view of how I actually talk, but if this bothers you let's talk straight.

In your retort, you called me stupid. I assure you i am not stupid, merely uninformed. There is a crucial semantic difference between those two. I am in fact attending a University for an electrical engineering degree, and as such the matters of psychosis is a bit out of my area.

Also in the aforementioned response, I quote "Ever hear of hypnosis?" Why yes, I have. BUT, like a large number of people on here we are not intimately familiar with all of the possible side effects of improper waking.

You are obviously passionate about this subject, so take a minute and properly educate us unversed masses with a mature and documented response. References would be nice, as they lend credibility as opposed to claims by a faceless internet person.

Doubt is easy, disproving doubt is difficult.

haunted_lady (author)Bigev2010-04-26

 First of all I said you sound stupid.
Secondly now you want references before you said use common sense.
And I am sorry it is hard to take a man seriously who is wearing a cream puff on his head seriously. 
If you are going to school why don't you make use of the library there ( no not the internet) and look up something. Try to research a subject not familiar to you.
I do this all the time. I should not have to hold your hand on this.
And I have given you examples when you first said you thought the "science behind his invention" was interesting.
What science would that be funny how he showed no references? Yet you swallowed it hook line in sinker you need to use your common sense it seems.
Sorry if I am a little tired of the sheep mentality on the internet " wow shiny cool" and no one thinks down the road...
I would give you links to things to look at but I read real books.

If you have a masters degree in psychology I would trust then, that you are familiar with APA citation formats? Might I suggest that you make reference to your books using that? I would imagine that you became quite intimate with the process during grad school while you were working on your thesis.

Bigev (author)haunted_lady2010-04-26

Alright, alright. Calm down. The flame war is over. I cede.

I apologize for playing devil's advocate the whole time, and we both have made decent points.Your research point is a very valid one, for example, and if I or anyone else felt so inclined that would be the proper course of action.

Have a nice day.

haunted_lady (author)Bigev2010-06-03

 What decent point did you make I missed that.
You made the point that people that know whey have Epilepsy should avoid this  or whatever. Well considering the awesome health insurance Americans have I am sure you will be glad to know I was in my late 20's before mine was discovered. 
We are a Wiki nation everyone wants to contribute because they think they know something even when they do not. We all want to pretend we are somebody. No one wants to be the unknown guy in the corner in the chicken hat. In this arena this could get dangerous and could cause someone to do things dangerous... it isn't like we are building soap boxy derby cars.
Did you yourself not hear the story of the Japanese videos games pulled form the shelves because of the severe seizures kids were going into?

I am lost here in the see of flames .

I understand a very small percentage of people, can have seizures with certain stimuli. I will vomit if I go into a room with certain strobes, and from (I kid you not) Playing the first version of Wolfenstein, and I have spoke with other who avoid it, like me. But it really depends on the rate of strobe and frequency of light, (for me).

I am asking about hypnosis and getting stuck. I have never heard of it. I have in the past used auto hypnosis for years, ad am reading a rather intense book on how do it. This was written by one of the leaders in the field and is meant for practitioners who do not live close to a university that has a department that can teach it.

As this is a state of hyper awareness, and the body will not let you do self harming things and you can easily slip out if something were to happen like say a loud noise or flash of light, then how do you get stuck?

I know this is an old post but I would love to hear from all the combatants on the subject.


You are right! Let's censor the internet! Let's be Chinese Communists! YYYAAAAAAAAAAAAYYYYYYYYYYYYY!!!!!!!!!!!!!!!!!!!!! ( I have nothing against the Chinese, just the way their government is set up.)

Where is censorship mentioned nowhere. I hate to break it to you but everyone in the world's opinion is just that not a fact and some people do not know the difference and that can be dangerous. That's why it is not legal for people just to start making things and mass producing them out of their house it is called PRODUCT TESTING. You know to see IF IT IS DANGEROUS>>>>>>

dhall-1 (author)haunted_lady2015-01-01


"We are a Wiki nation everyone wants to contribute because they think they know something even when they do not." I was responding with a sarcastic solution.

watson21995 (author)haunted_lady2010-06-04

Just gtfo of the internet if you don't like it this much. Jeez.

haunted_lady (author)watson219952011-03-28

I have been off the internet for a long time that is why I have not seen these comments... I actually travel you know air. People are getting RICKETS from lack of sunshine because of internet addiction this is insane. All for what for people to update their fb? This website is useful most are not.

Please... Do us all a favor. Continue traveling on your crusades and leave the interwebs alone. We're safer with you out in the world doing "God Knows What," you're comments however "are shot from the hip" and lack a cohesion rarely found even on the internets.

TheParadox (author)haunted_lady2010-07-19

You are very arrogant, and you lust for control of the information on the internet bothers the hell out of me. Go back to Russia and take your socialism with you.

Build4343 (author)TheParadox2010-07-19

me? :(

TheParadox (author)Build43432010-07-19

Of course not you. "Haunted_Lady" The communist with the desire to censor the internet.

camelstrike (author)TheParadox2010-07-26

Lol you dont even know the meaning of that word my fellow american brainwashed kid, and haunted lady, wiki rules, the books you read and have on your shelf I saved them on my C Drive on pdf format because im green. PS. TheParadox, socialism and communism are not the same just like capitalism and democracy.

haunted_lady (author)camelstrike2011-03-28

Your "greeness"of saving things on your computer and all the other computers on in the is world caused a demand so high for power because of constant internet usage that countries all over the world are addicted to nuclear power.
We were better off with paper alone people still print out everything..
The Sierra Club is a nice place to visit maybe have a look at their website.

Hey hey... c'mon. Let's be nice. If you feel the need to define the differences of Socialism vs Communism as compared to Capitalist vs Democracy you can do so without calling people: Kid, Brainwashed, etc. There's nothing wrong with standing up for what you believe, or your opinion. When it gets outright insulting... people get hurt. This may be the "InterWebs" but there are still people at the end of it.

Im sorry I got carried away, sometimes it just happens, bad day I guess. What I worte is a lilttle offensive, didnt mean to. I hope you can understand.

haunted_lady (author)TheParadox2011-03-28

I am so glad you know the difference between communism and socialism. What makes me arrogant because you feel bad about yourself and I don't.
Do you know what a paradox even is without Wiki??? Controlling information my goodness wow...that has nothing to do with anything don;t confuse me with your Mom.
I cannot build cars and decide to start selling them to people because I think they are great. They have to be tested that has nothing to do with controlling information that has to do with common sense.

tori1012 (author)haunted_lady2010-08-23

I think you are smart. However, you are not smart enough to go preach somewhere else to strangers in person. Gosh lady. Just gosh. Yes video games are bad. But not just Japanese ones. Don't be so biased.

haunted_lady (author)tori10122011-03-28

Google Japanese Video Games Epilepsy. I am not biased. This is an event that actually happened in Japan my dear. Don't make me sound racist. I am relating not gossip, not something I would post on my Facebook BUT A REAL EVENT IN HISTORY.

Kanellos (author)haunted_lady2011-02-27

So, haunted_lady, you really don't quit, do you?

haunted_lady, I'm surprised you have the courage to breath, many people have choked that way. I'm surprised you eat, people choke that way too. And the likely statistic is that most bones are broken while doing something active. So honestly, I'm surprised you do anything more than exist.

About This Instructable




More by guyfrom7up:Stylish Battery BeltCloth Covered EarbudsHow to Solder in 30 Seconds
Add instructable to: