system
Given the following post, respond as if you're commenting on Reddit:
human
ELI5: How does your body know when to wake you up?
gpt
Medical doctor here.

Our body is controlled by a circadian rhythm, which is like a clock we have it in our brains to control when it's time to wake up and when it's time to sleep. 

Our eyes can capture how illuminated the environment around us is and send signals to our brain. The brain, with this information, not only "calculates" how long the day lasts, but also tries to organize your activities (bodily functions, sleep time, awaken time etc) accordingly to the time of the day. This "time organizer" is called the pineal gland.

The pineal gland secretes melatonin, which is the hormone that makes us fall asleep. Eyes see it's dark outside, the brain notices that and the pineal gland releases melatonin. Its secretion peaks at night, when it's time for us to rest. You feel sleepy and your body temperature falls.

In the morning, when the sun goes up, the brain sends to your body a message to raise your temperature and your adrenal glands start to produce another hormone called cortisol. It's when your body realizes it's time to wake up. 

That's why using your computer at night makes you stay awake all night long, for example. The blue spectrum of light that comes from your computer screen deceives your brain, making it think it's still sunny outside. That way, your pineal gland doesn't release melatonin and you stay awake. 

ETA - If you find it difficult to wake up, try to leave the window curtains open before you go to bed. That way, when the sun goes up it will illuminate your bedroom, making it easier for you to wake up and feel awaken. Another good tip is, right after waking up, opening the window and looking at the sunshine, to give your brain the message that it's daytime. 

**TL;DR: When it's sunny outside, your brain releases cortisol, that keeps you awake. When it's dark outside, your brain releases melatonin, that makes you feel sleepy.**