Abstract. Freshwater ecosystems are sources of the two most relevant greenhouse gases (GHGs): CO2 and CH4. Understanding the importance of freshwater ecosystems in the global carbon cycle and their role in global warming trends requires the accurate quantification of gas fluxes from the water phase to the atmosphere. These fluxes depend on the gas exchange velocity and the concentration gradient between the phases, which both cause high spatio-temporal variability in fluxes. On a global scale, the estimation of fluxes is limited by the lack of cheap and accurate methods to measure dissolved gas concentrations. Low-cost sensors, as an alternative to expensive gas analysers, are available; however, to date, the in situ performance of such sensors has been poorly examined. Here, we present an inexpensive data-logging sensor prototype that provides continuous measurements of dissolved CO2 and CH4 in submerged environments. Gas measurements are done in a confined gas space, which is rapidly equilibrated with the water phase through a single-layer polytetrafluoroethylene (PTFE) membrane, by a miniature non-dispersive infrared (NDIR) sensor for CO2 (Sunrise sensor, Senseair, Sweden) and a cheap metal oxide sensor for CH4 (TGS2611-E, Figaro Engineering Inc., Japan). Pressure, temperature and humidity are measured to correct raw sensor readings. For freshwater, the dissolved gas concentration is directly obtained from the measured molar fraction and temperature and pressure readings. In air, we measured the molar fraction of CO2 in a range from 400 to 10 000 ppm and the molar fraction of CH4 in a range from 2 to 50 ppm with an accuracy of ± 58 and ± 3 ppm respectively. We successfully used our prototype to measure diurnal variations in dissolved CO2 in a natural stream. We further calibrated the CH4 sensor for in situ use at concentrations ranging from 0.01 to 0.3 µmol L−1. Underwater, we were able to measure the molar fraction of CH4 in the prototype head with an accuracy of ± 13 ppm in the range from 2 to 172 ppm. The underwater measurement error of CH4 is always higher than for the same concentration range in air, and CH4 is highly overestimated below 10 ppm. At low CH4, humidity was the most important influence on the TGS2611-E sensor output in air, whereas temperature became the predominant factor underwater. We describe the response behaviour of low-cost sensors in submerged environments and report calibration methods to correct for temperature and humidity influence on the sensor signal if used underwater. Furthermore, we provide do-it-yourself instructions to build a sensor for submerged continuous measurements of dissolved CO2 and CH4. Our prototype does not rely on an external power source, and we anticipate that such robust low-cost sensors will be useful for future studies of GHG emissions from freshwater environments.