  We study the entropy and information flow in a Maxwell demon device based on
a single-electron transistor with controlled gate potentials. We construct the
protocols for measuring the charge states and manipulating the gate voltages
which minimizes irreversibility for (i) constant input power from the
environment or (ii) given energy gain. Charge measurement is modeled by a
series of detector readouts for time-dependent gate potentials, and the amount
of information obtained is determined. The protocols optimize irreversibility
that arises due to (i) enlargement of the configuration space on opening the
barriers, and (ii) finite rate of operation. These optimal protocols are
general and apply to all systems where barriers between different regions can
be manipulated.
