Described herein is a flow control valve for a ventilator that controls gas flow through a patient line in response to a target pressure within the line. The valve controls gas flow by (i) providing both a high frequency signal and a low frequency signal through a coil positioned in a fixed magnetic field, (ii) determining a position of the coil by detecting the high frequency signal, and (iii) controlling a position of the coil by adjusting the low frequency signal based on the determined position and/or velocity of the coil.