
It is important to distinguish melanin from melatonin, since the latter is a black pigment that acts as the primary determinant of human skin color and is produced by melanocytes in the epidermis. Thus, melatonin is a hormone produced mainly in the pineal gland.
The chemical precursor to melatonin is serotonin, a neurotransmitter that regulates many brain functions among which is the state of mind, not in vain, the famous Prozac or St. John's wort increases brain levels of serotonin. The pineal gland was described by Descartes as the "third eye", considering that was the seat of the soul.
The production of melatonin in the pineal gland (located in the brain) occurs under the influence of the hypothalamus, another gland which is also located in the brain and is considered the central core or coordinator of vegetative or autonomic nervous system. Specifically, the pineal gland receives orders from the hypothalamus, called the suprachiasmatic nucleus, which receives information from the retina to whether it is day or night. Specifically, the release of melatonin takes place through a process of phototransduction, whereby when it is night the retina of the eye detects a lack of light and sends a nerve signal to the suprachiasmatic nucleus, which in turn stimulates the pineal gland to produce and release of melatonin. Therefore, melatonin is released mainly during periods of darkness, while its amount decreases during the daylight hours, which makes it an ideal substance to help regulate cycles called circadian or sleep-wake cycles.