A valve (100) for controlling pressure in a ventilation system is disclosed. The valve comprises an electromagnet (105 106) a shaft (107) connected to the electromagnet and a diaphragm (110) connected to the shaft wherein the electromagnet applies force to the diaphragm based on an input. The ventilation system comprises a ventilator (200) connected to a patient circuit (204) the valve (100) controlling pressure in the ventilation system and a controller (206) connected to the valve and configured to provide the input to the valve.