Hydrocephalus is characterized by an excessive accumulation of cerebrospinal fluid (CSF). Therapeutically, an artificial pressure relief valve (so-called shunt) is implanted which opens in case of increased intracranial pressure (ICP) and drains CSF into another body compartment. Today, available shunts are of a mechanical nature and drainage depends on the pressure drop across the shunt. According to the latest data, craniospinal compliance is considered to be even more important than mean ICP alone. In addition, ICP is not constant but varies due to several influences. In fact, heartbeat-related ICP waveform patterns depend on volume changes in the cranial vessels during a heartbeat and changes its shape as a function of craniospinal compliance. In this paper, we present an electromechanical shunt approach, which changes the CSF drainage as a function of the current ICP waveform. A series of 12 infusion tests in patients were analyzed and revealed a trend between the compliance and specific features of the ICP waveform. For waveform analysis of patient data, an existing signal processing algorithm was improved (using a Moore machine) and was implemented on a low-power microcontroller within the electromechanical shunt. In a test rig, the ICP waveforms were replicated and the decisions of the ICP analysis algorithm were verified. The proposed control algorithm consists of a cascaded integral controller which determines the target ICP from the measured waveform, and a faster inner-loop integral controller that keeps ICP close to the target pressure. Feedforward control using measurement data of the patient's position was implemented to compensate for changes in hydrostatic pressure during change in position. A model-based design procedure was used to lay out controller parameters in a simple model of the cerebrospinal system. Successful simulation results have been obtained with this new approach by keeping ICP within the target range for a healthy waveform.