Lucid dreaming occurs in the fifth stage. This is the stage of the REM sleep.
Dreams are dreamt during the 3rd, 4th and 5th stages. The 3rd and 4th stages are the heavy sleep. The 5th stage includes dreaming in the astral and mental planes. During this period, the electrical activity of the brain is similar to the waking state. It lasts about 15 — 20 minutes.
This is a full cycle.
After that, the sleeper goes back to the 2nd stage of slow wave sleep, etc. until the awakening.
The first cycle lasts 90-100 minutes. Then the cycles are repeated with the reducing proportion of slow wave sleep and gradually increasing proportion of REM sleep, whose last episode can, in some cases, last up to 1 hour.
On average, the good quality healthy sleep includes five cycles.
Estimated time of the good quality sleep is about 7-8 hours.