Method to optimize the command and control of an electric motor of an automation unit, comprising a mechanical member, driven by a shaft of said electric motor, to carry out an operating cycle and a central command and control unit, the automation unit comprising at least a position detection mean to detect the instantaneous position of said shaft of the electric motor and/or of said mechanical member, wherein said electric motor is directly connected to said mechanical member, the electric motor and the mechanical member constituting an operating unit suitable to perform at least a portion of a complete rotation of one or more round angles of the mechanical member carrying out said operating cycle, characterized in that said method comprises the following steps: i) receiving, by said central command and control unit, at least signals of the position of the shaft of the electric motor and/or of the mechanical member from said position detection mean or from a mathematical simulator entity configured to simulate the position of the shaft of the electric motor and/or of the mechanical member; ii) dividing said operating cycle into a plurality of operating sub-phases ("n") equal to each other; iii) establishing, by said central command and control unit, in which operating sub-phase ("n") the operating unit is, based on signals from said position detection mean or from said mathematical simulator entity of step i); iv) selecting, by said central command and control unit, a reference current based on a self-learning step, for each of said operating sub-phases ("n"), or for a multiple of sub-phases, established in step iii); v) generating, by said central command and control unit, a correcting signal based on said reference current of step iv) and sending, by said central command and control unit, said correcting signal to the electric motor; wherein said self-learning step comprises: verifying, by said central command and control unit, the position of the shaft of the electric motor and/or of the mechanical member with respect to the operating sub-phases ("n") established in step iii) and the cadence of the operating cycle, memorizing, by said central command and control unit, values of the reference current in a corresponding table for each sub-phase; wherein said reference current is selected at least as a function of one or more between: an instantaneous tracking error, a reference instantaneous speed of the mechanical member, a first derivative of the reference instantaneous speed of the mechanical member, a second derivative of the reference instantaneous speed of the mechanical member and an instantaneous inertia of the mechanical member in relation to the cadence of the operating cycle. i) receiving, by said central command and control unit, at least signals of the position of the shaft of the electric motor and/or of the mechanical member from said position detection mean or from a mathematical simulator entity configured to simulate the position of the shaft of the electric motor and/or of the mechanical member; ii) dividing said operating cycle into a plurality of operating sub-phases ("n") equal to each other; iii) establishing, by said central command and control unit, in which operating sub-phase ("n") the operating unit is, based on signals from said position detection mean or from said mathematical simulator entity of step i); iv) selecting, by said central command and control unit, a reference current based on a self-learning step, for each of said operating sub-phases ("n"), or for a multiple of sub-phases, established in step iii); v) generating, by said central command and control unit, a correcting signal based on said reference current of step iv) and sending, by said central command and control unit, said correcting signal to the electric motor; verifying, by said central command and control unit, the position of the shaft of the electric motor and/or of the mechanical member with respect to the operating sub-phases ("n") established in step iii) and the cadence of the operating cycle, memorizing, by said central command and control unit, values of the reference current in a corresponding table for each sub-phase; wherein said reference current is selected at least as a function of one or more between: an instantaneous tracking error, a reference instantaneous speed of the mechanical member, a first derivative of the reference instantaneous speed of the mechanical member, a second derivative of the reference instantaneous speed of the mechanical member and an instantaneous inertia of the mechanical member in relation to the cadence of the operating cycle.