Our body produces substances that affect the quantitative state of our consciousness - that is, whether we want to sleep or whether we are stimulated and eager for action.
There are many such sleep factors; however, the most well-known of these is melatonin. It is a hormone secreted in the pineal gland, which is located deep in our brain. It is not directly involved in falling asleep itself, but instead regulates the diurnal cycle. The activity of the pineal gland, which secretes melatonin, is inhibited by light, so the pineal gland produces the most melatonin in the dark.
This description helps to understand one of the causes of insomnia in people working night shifts. Under dark conditions, they are exposed to bright light or forced to remain awake and there is a disruption of the diurnal rhythm related, among other things, to melatonin secretion.
Therefore, melatonin preparations are often effective in the treatment of insomnia in night workers with a dysregulated diurnal cycle. The conclusion is also drawn that it is not advisable to be exposed to bright light before going to bed, but that it is advisable to be exposed to bright light after waking up. The screens of our monitors, televisions and telephones are also sources of light of a length that inhibits the activity of the pineal gland and disrupts the diurnal cycle. You should therefore not use these devices preferably even one hour before bedtime.