Light-driven electron transport or ion pumping produces the gradient.