Direct generation of electricity