A power tool, comprising: a power interface configured to be connected to a power supply; a motor; a driver circuit having a plurality of switching elements for driving the motor; a capacitor configured to filter out current spikes in the power supply; a capacitor switch connected to the capacitor and configured to control a working state of the capacitor; a temperature detection unit configured to detect a temperature of a related object; and a controller electrically connected to the capacitor switch and configured to control an on or off state of the capacitor switch; wherein the controller is configured to: acquire the temperature of the related object; control the capacitor switch to be in a first on or off state such that the capacitor works in a first working state when the temperature is lower than a lowest temperature of a temperature threshold; and control the capacitor switch to be in a second on or off state such that the capacitor works in a second working state when the temperature is higher than a highest temperature of said temperature threshold characterized in that the capacitor comprises a first capacitor and a second capacitor, wherein the capacitor switch comprises a first switch, and the first switch is connected to the first capacitor and configured to control an on or off state of the first capacitor; wherein the capacitor switch further comprises a second switch, and the second switch is connected to the second capacitor and configured to control an on or off state of the second capacitor; wherein the controller is configured to: control the first switch to be turned on such that the first capacitor is in a working state and control the second switch to be turned off such that the second capacitor is in a non-working state when the temperature is lower than the lowest temperature of the temperature threshold; and control the first switch to be turned off such that the first capacitor is in a non-working state and control the second switch to be turned on such that the second capacitor is in a working state when the temperature is higher than the highest temperature of the temperature threshold, wherein said related object is a working environment in which the power tool is located and/or the capacity and/or the motor. a power interface configured to be connected to a power supply; a motor; a driver circuit having a plurality of switching elements for driving the motor; a capacitor configured to filter out current spikes in the power supply; a capacitor switch connected to the capacitor and configured to control a working state of the capacitor; a temperature detection unit configured to detect a temperature of a related object; and a controller electrically connected to the capacitor switch and configured to control an on or off state of the capacitor switch; acquire the temperature of the related object; control the capacitor switch to be in a first on or off state such that the capacitor works in a first working state when the temperature is lower than a lowest temperature of a temperature threshold; and control the capacitor switch to be in a second on or off state such that the capacitor works in a second working state when the temperature is higher than a highest temperature of said temperature threshold the capacitor comprises a first capacitor and a second capacitor, wherein the capacitor switch comprises a first switch, and the first switch is connected to the first capacitor and configured to control an on or off state of the first capacitor; wherein the capacitor switch further comprises a second switch, and the second switch is connected to the second capacitor and configured to control an on or off state of the second capacitor; wherein the controller is configured to: control the first switch to be turned on such that the first capacitor is in a working state and control the second switch to be turned off such that the second capacitor is in a non-working state when the temperature is lower than the lowest temperature of the temperature threshold; and control the first switch to be turned off such that the first capacitor is in a non-working state and control the second switch to be turned on such that the second capacitor is in a working state when the temperature is higher than the highest temperature of the temperature threshold, control the first switch to be turned on such that the first capacitor is in a working state and control the second switch to be turned off such that the second capacitor is in a non-working state when the temperature is lower than the lowest temperature of the temperature threshold; and control the first switch to be turned off such that the first capacitor is in a non-working state and control the second switch to be turned on such that the second capacitor is in a working state when the temperature is higher than the highest temperature of the temperature threshold, wherein said related object is a working environment in which the power tool is located and/or the capacity and/or the motor.