Herein is disclosed a sensor for noninvasive measurement of the partial pressure of CO2 (pCO2) in the skin of a human. The sensor comprises a housing a gas measuring chamber for measuring gases at least one chimney for communication of gases diffusing through the skin to the gas measuring chamber a broad band light source transmitting light into the gas measuring chamber and a detector system comprising a first and a second photodetector. The first photodetector detects light at a wavelength wherein CO2 absorbs light and the second photodetector acts as a zero reference detector by measuring light in a freeband where no gases absorb light.