The present research work carries out the design and implementation of a computer vision algorithm supported by image pre-processing techniques to improve the QR (Quick Response) code detection rate efficiency in a semi-controlled environment. The proposed algorithm is implemented in an embedded system using a Raspberry Pi model4B+ microcomputer to manipulate a DC motor that emulates the change in direction in a mobile robot. For greater precision and simplicity, the encoded data of the QR code are 1 and 0, which allow turning to the right or left, respectively, on the DC motor. To complement the embedded system, a Raspberry camera, and a control module (current regulator) for the DC motor are used. Finally, efficiency tests are carried out with the proposed algorithm, where the idea is to obtain a lower error factor compared to the tests carried out in classical algorithms that do not have image pre- processing stages. These tests are carried out in a semi-controlled environment, varying the luminosity and distance to detect the QR code. Once the objective is reached, the best light and distance conditions are proposed for detection, allowing the general system to be versatile and fast.