Motorized brewing unit for preparing beverages from a capsule, cartridge or compacted pod containing at least one ingredient, comprising a first part having a receptacle adapted to receive said capsule, cartridge or compacted pod, a second part, movable relative to the first part between an open position, wherein the first part and the second part are at a distance from each other to allow insertion of said capsule, cartridge or compacted pod into the receptacle, and a closed position, wherein the second part and the first part are coupled to each other to define a brewing chamber therebetween, an electric motor adapted to control the movement of the second part relative to the first part between the open position and the closed position, a transmission mechanism that is positioned between the electric motor and the first part or the second part and comprises a movable member, whose position is univocally associated with the relative position of the second part with respect to the first part, and an electronic control unit adapted to control the electric motor, characterized in that it further comprises a micro-switch configured to switch between a first and a second operational state (ON/OFF) depending on the position of the movable member, the electronic control unit being programmed to: determine in which phase of the relative movement of the first and second parts (12, 14), among a plurality of movement phases defined between said open and closed positions, the first and second parts (12, 14) are, depending on the operational state (ON/OFF) of the micro-switch and on the direction of rotation of the electric motor; and control the electric motor according to a given rotational speed profile depending on the movement phase thus determined. a first part having a receptacle adapted to receive said capsule, cartridge or compacted pod, a second part, movable relative to the first part between an open position, wherein the first part and the second part are at a distance from each other to allow insertion of said capsule, cartridge or compacted pod into the receptacle, and a closed position, wherein the second part and the first part are coupled to each other to define a brewing chamber therebetween, an electric motor adapted to control the movement of the second part relative to the first part between the open position and the closed position, a transmission mechanism that is positioned between the electric motor and the first part or the second part and comprises a movable member, whose position is univocally associated with the relative position of the second part with respect to the first part, and an electronic control unit adapted to control the electric motor, characterized in that it further comprises a micro-switch configured to switch between a first and a second operational state (ON/OFF) depending on the position of the movable member, determine in which phase of the relative movement of the first and second parts (12, 14), among a plurality of movement phases defined between said open and closed positions, the first and second parts (12, 14) are, depending on the operational state (ON/OFF) of the micro-switch and on the direction of rotation of the electric motor; and control the electric motor according to a given rotational speed profile depending on the movement phase thus determined.