The present invention provides an Electro Surgical Generator (ESG) optimized for lung biopsy. The ESG is exclusively battery operated and fits within the handpiece of modern endoscopic electrosurgical/electrocautery instruments, thereby avoiding wires, adapters, and coupling mechanisms. The ESG is adaptable to generate different waveforms that vary with respect to frequency, pulse width, amplitude, etc. through the use of timing circuits and voltage control (i.e. transformers). The ESG is both energy-efficient and safe. A closed loop feedback system featuring a monitor and controller ensure no more power than necessary is provided to achieve a goal current level. Dynamic Power Control (DPC) and Dynamic Temperature Control (DTC) systems vary power to maintain temperature with the lowest possible power. These features prolong battery life and guard against tissue damage. The generator includes other safety features such as resiliency against and the ability to overcome single fault events such as short circuits.