a Schematic illustration of an E. coli expressing xenorhodopsin, a light-driven proton pump (red), allowing for the reversible generation of a directional pH gradient during illumination with white light. The inward pump increases the pH of the external solution. b Photoactivity generated by the E. coli (OD600 =20, in 150 mM NaCl) measured with an external pH electrode. The pH is plotted over time during three light-dark cycles (periods of illumination are indicated in yellow). The pH increases by almost one pH unit within 5 min of illumination and nearly returns to its original value after 10 min in the dark (mean ± s.d., n = 3). c Absorbance measurements of the pH-sensitive ratiometric fluorophore pyranine at pH 6 (blue) and pH 8 (green). The pH can be quantified as the fluorescence intensity ratio at the excitation wavelengths 488 nm and 405 nm (gray dashed lines). d Normalized fluorescence intensity ratio I488/I405 of pyranine (50 μM) over time in a solution containing E. coli and lipid vesicles as determined with confocal fluorescence microscopy (mean ± s.d., n = 4). Periods of illumination are indicated in yellow. Source data is available for Fig. 1b–d.