A motor controller configured to drive a permanent magnet synchronous motor - PMSM - with sensorless Field Oriented Control - FOC -, the motor controller comprising: a current controller configured to generate control signals for driving the PMSM, wherein the current controller is configured to measure current information of the PMSM characterized in that the current controller configured to measure voltage information, and by a power constant controller configured to receive the voltage information and the current information, and generate a first target speed based on a target power of the PMSM and based on the voltage information and the current information; a first signal generator configured to generate a second target speed; a speed constant controller coupled between the power constant controller and the current controller, wherein the speed constant controller is configured to switchably receive the first target speed and the second target speed, and regulate a motor speed of the PMSM based on the received first target speed or the received second target speed; a first switch configured to switchably couple the speed constant controller to the power constant controller, to receive the first target speed, in a first switch state or to the first signal generator, to receive the second target speed, in a second switch state; a first switch controller configured to control a switching state of the first switch; wherein the power constant controller comprises: a power feedback estimator configured to receive the voltage information and the current information from the current controller and to calculate a feedback power of the PMSM based on the voltage information and the current information, wherein the power constant controller is configured to generate the first target speed based on the target power and the calculated feedback power. a current controller configured to generate control signals for driving the PMSM, wherein the current controller is configured to measure current information of the PMSM characterized in that the current controller configured to measure voltage information, and by a power constant controller configured to receive the voltage information and the current information, and generate a first target speed based on a target power of the PMSM and based on the voltage information and the current information; a first signal generator configured to generate a second target speed; a speed constant controller coupled between the power constant controller and the current controller, wherein the speed constant controller is configured to switchably receive the first target speed and the second target speed, and regulate a motor speed of the PMSM based on the received first target speed or the received second target speed; a first switch configured to switchably couple the speed constant controller to the power constant controller, to receive the first target speed, in a first switch state or to the first signal generator, to receive the second target speed, in a second switch state; a power feedback estimator configured to receive the voltage information and the current information from the current controller and to calculate a feedback power of the PMSM based on the voltage information and the current information, wherein the power constant controller is configured to generate the first target speed based on the target power and the calculated feedback power.