Electronic device for driving a lock, comprising: - a support for connection with the cylinder of an existing lock having at least one through opening for accommodating a projecting portion of said cylinder, and fastening means to block the support with respect to said projecting portion; - a gear motor provided with an actuator and a transmission configured to rotate said cylinder and allow the opening or closing of the lock; wherein the actuator is defined by an electric motor having an axis of rotation parallel and offset with respect to a central axis of said through opening so as to be parallel to the cylinder, and said transmission comprises at least a first and a second wheels rotatably connected to each other, wherein the first wheel is rigidly connected to the motor and the second wheel has a coupling portion with a shaft or tang of the cylinder; said coupling portion being defined by a hole which can be coupled to said shaft or tang of the cylinder, and shaped with a non-circular cross-section complementarity shaped with respect to said shaft or tang of the cylinder, so as to allow its insertion into the hole preventing its relative rotation; - control board associated with said actuator, arranged to receive a driving signal from a user and configured to send to said actuator a signal representative of an opening or a closing of the lock in order to move the actuator; characterized in that it comprises a box body having at least a first plate and a second plate facing each other, defining an internal housing for said transmission and both provided with respective through holes substantially aligned with said coupling portion of the second wheel, wherein said actuator and said support are connected to said first plate, said transmission is located in said housing and said control board is connected to said second plate. - a support for connection with the cylinder of an existing lock having at least one through opening for accommodating a projecting portion of said cylinder, and fastening means to block the support with respect to said projecting portion; - a gear motor provided with an actuator and a transmission configured to rotate said cylinder and allow the opening or closing of the lock; wherein the actuator is defined by an electric motor having an axis of rotation parallel and offset with respect to a central axis of said through opening so as to be parallel to the cylinder, and said transmission comprises at least a first and a second wheels rotatably connected to each other, wherein the first wheel is rigidly connected to the motor and the second wheel has a coupling portion with a shaft or tang of the cylinder; said coupling portion being defined by a hole which can be coupled to said shaft or tang of the cylinder, and shaped with a non-circular cross-section complementarity shaped with respect to said shaft or tang of the cylinder, so as to allow its insertion into the hole preventing its relative rotation; - control board associated with said actuator, arranged to receive a driving signal from a user and configured to send to said actuator a signal representative of an opening or a closing of the lock in order to move the actuator;