I am thinking of writing about Obstructive Sleep Apnoea (UK spelling for apnea) out of interest in the condition (not a medical textbook).
During deep sleep, in persons with a narrow airway, the back of the tongue can fall back as muscles relax and obstruct the airway. As I understand it, when this happens, and airway is completely blocked so that breathing stops, the blood oxygen level (SpO2) falls over the next 1-2 minutes and the CO2 level rises until the brain detects that the CO2 level is too high (not that the O2 is too low, as I previously thought), and I believe it triggers the sympathetic nervous system to deliver adrenaline to the body, which, amongst other things, tends to wake one out of deep sleep into light sleep where breathing can occur again (until the body falls back into deep sleep again, where the problem happens again.
What I would like to know, is what is the mechanism by which this happens - how does the brain detect high CO2 or low blood oxygen and then trigger the response?
This Wikipedia page says:
the adrenal medulla produces a hormonal cascade that results in the secretion of catecholamines, especially norepinephrine and epinephrine.[4] The hormones estrogen, testosterone, and cortisol, as well as the neurotransmitters dopamine and serotonin, also affect how organisms react to stress.[5] The hormone osteocalcin might also play a part.[6][7]
so perhaps it is a function of the adrenal medulla? But I cannot find any reference to how it, or any other part of the brain, might detect high CO2 (or low O2).