Published
Computer Vision Implementation on Raspberry Pi 4 for a 3 DOF Robotic Arm in Object Classification by Shape and Color
Implementación de visión por computador en Raspberry Pi 4 para un brazo robótico de 3 GDL en clasificación de objetos por forma y color
DOI:
https://doi.org/10.15446/ing.investig.118562Keywords:
stacking, OpenCV, image processing, pick and place, inverse kinematics (en)apilado, OpenCV, procesamiento de imágenes, recoger y colocar, cinemática inversa (es)
Downloads
Previous studies presents different implementations of computer vision in robotics using both Arduino and Raspberry Pi, however, very few works implement applications with human-machine interactions, trajectories and presence sensors, furthermore, there are no approaches that integrate into a single Raspberry Pi three working modes (manual, semi-automatic, and automatic), object stacking, nor statistical analysis of the positions of objects placed by the robot. This paper presents the operation of a 3 DOF robotic arm prototype through a GUI to classify and stack objects by color and shape through image processing performed with the OpenCV library and a 8 MP camera on a Raspberry Pi 4; integrating several devices (presence sensors, camera, and servomotors). The inverse kinematics problem was solved using the geometric method; additionally, trajectories with trapezoidal velocity profiles were performed using Peter Corke’s Robotics Toolbox for Python. The results showed that the NRMSE positioning error was 0.0793 (Triangle), 0.0267 (Square), 0.0099 (Rectangle), 0.0245 (Rhombus), and 0.0152 (Circle). This work satisfactorily demonstrated the two stages programmed on Raspberry Pi 4: shape and color identification with OpenCV and the stacked classification of objects by shape and color with a 3 DOF robotic arm, programmed on Raspberry Pi 4; it was also statistically demonstrated that the rectangle positioning was the most precise, the circle the most accurate, and the triangle the least precise and accurate among the five geometric figures studied.
Estudios previos presentan diferentes implementaciones de visión computacional en la robótica tanto en Arduino como en Raspberry Pi, sin embargo, muy pocos trabajos implementan aplicaciones con interacciones humano-máquina, trayectorias y sensores de presencia, además, no hay enfoques que integren en una sola Raspberry Pi tres modos de trabajo (manual, semiautomático y automático), apilado de objetos, ni análisis estadı́stico de las posiciones de los objetos colocados por el robot. Este documento presenta el funcionamiento de un prototipo de brazo robótico de 3 GDL a través de una GUI para clasificar y apilar objetos por color y forma a través de procesamiento de imágenes realizado con la librerı́a OpenCV y una cámara de 8 MP en una Raspberry Pi 4; integrando varios dispositivos (sensores de presencia, cámara y servomotores). El problema de cinemática inversa se resolvió utilizando el método geométrico; además, se realizaron trayectorias con perfiles de velocidad trapezoidal utilizando el Robotics Toolbox de Peter Corke para Python. Los resultados demostraron que el error de posicionamiento NRMSE fue de 0.0793 (Triángulo), 0.0267 (Cuadrado), 0.0099 (Rectángulo), 0.0245 (Rombo), y 0.0152 (Cı́rculo). Este trabajo evidenció de manera satisfactoria las dos etapas programadas en Raspberry Pi 4: la identificación de forma y color con OpenCV, y la clasificación apilada de objetos por forma y color con un brazo robótico de 3 GDL; también se demostró estadı́sticamente que el posicionamiento del rectángulo fue el más preciso, el cı́rculo el más exacto, y el triángulo el menos preciso y exacto entre las cinco figuras geométricas estudiadas.
References
[1] R. V. Petrescu, R. Aversa, A. Apicella, S. Kozaitis, T. Abu-Lebdeh, and F. I. Petrescu, “The inverse kinematics of the plane system 2-3 in a mechatronic mp2r system, by a trigonometric method,” J. Mechatron. Robot., vol. 1, no. 2, pp. 75–87, 2017. https://doi.org/10.3844/jmrsp.2017.75.87.
[2] B. S. Babu, V. Priyadharshini, and P. Patel, “Review of voice controlled robotic arm-raspberry pi,” Eur. J. Electr. Eng. Comput. Sci., vol. 5, no. 2, pp. 1–4, 2021. doi: https://doi.org/10.24018/ejece.2021.5.2.302.
[3] B. Meneses Claudio, L. Nuñez-Tapia, and W. Alvarado-Dı́az, “Graphical interface to improve python language teaching and image processing,” Int. J. Emerg. Technol. Adv. Eng., vol. 12, no. 3, pp. 92–98, 2022. https://doi.org/10.46338/ijetae032210.
[4] F. Brito del Pino, M. Brito del Pino, D. Reina, and J. Brito del Pino, “Graphic user interface for synchrotron beamline,” Novasinergia Rev. Digit. Cienc. Ing. Tecnol., vol. 2, no. 2, pp. 58–67, 2019. https://doi.org/10.37135/unach.ns.001.04.06.
[5] P. Corke and J. Haviland, “Not your grand-mother’s toolbox–the robotics toolbox reinvented for python,” in 2021 IEEE Int. Conf. Robot. Autom. (ICRA), pp. 11357–11363, IEEE, 2021. https://doi.org/10.1109/ICRA48506.2021.9561366.
[6] B. Gupta, A. Chaube, A. Negi, and U. Goel, “Study on object detection using open cv-python,” Int. J. Comput. Appl., vol. 162, no. 8, pp. 17–21, 2017. https://doi.org/10.5120/ijca2017913391.
[7] T. Serrano-Ramı́rez, N. d. C. Lozano-Rincón, A. Mandujano-Nava, and Y. J. Sámano-Flores, “Artificial vision system for object classification in real time using raspberry pi and a web camera,” J. Inf. Technol. Commun., vol. 5, no. 13, pp. 20–25, 2021. https://doi.org/10.35429/jitc.2021.13.5.20.25.
[8] B. Salah, “Real-time implementation of a fully automated industrial system based on ir 4.0 concept,” Actuators, vol. 10, no. 12, p. 318, 2021. https://doi.org/10.3390/act10120318.
[9] I. D. Garcı́a Santillán and V. M. Caranqui Sánchez, “La visión artificial y los campos de aplicación,” Tierra Infinita, vol. 1, pp. 98–108, 2015. https://doi.org/10.32645/26028131.76.
[10] J. J. Sanabria and J. F. Archila, “Detección y análisis de movimiento usando visión artificial,” Sci. Tech., vol. 16, no. 49, pp. 180–188, 2011. https://doi.org/10.22517/23447214.1513.
[11] M. Kolling, “Educational programming on the raspberry pi,” Electronics, vol. 5, no. 3, p. 33, 2016. https://doi.org/10.3390/electronics5030033.
[12] A. Valera, A. Soriano, and M. Vallés, “Low-cost platforms for realization of mechatronics and robotics practical works,” Rev. Iberoam. Autom. Inform. Ind., vol. 11, no. 4, pp. 363–376, 2014. https://doi.org/10.1016/j.riai.2014.09.002.
[13] J. W. Jolles, “Broad-scale applications of the raspberry pi: A review and guide for biologists,” Methods Ecol. Evol., vol. 12, no. 9, pp. 1562–1579, 2021. https://doi.org/10.1111/2041-210X.13652.
[14] S.-E. Oltean, “Mobile robot platform with arduino uno and raspberry pi for autonomous navigation,” Procedia Manuf., vol. 32, pp. 572–577, 2019. https://doi.org/10.1016/j.promfg.2019.02.254.
[15] J. Á. Ariza and C. N. Galvis, “Raspycontrol lab: A fully open-source and real-time remote laboratory for education in automatic control systems using raspberry pi and python,” HardwareX, vol. 13, p. e00396, 2023. https://doi.org/10.1016/j.ohx.2023.e00396.
[16] A. Pajankar, Raspberry Pi Computer Vision Programming: Design and implement computer vision applications with Raspberry Pi, OpenCV, and Python 3. Packt Publishing Ltd, second ed., 2020. https://books.google.com.co/books?id=R2XuDwAAQBAJ.
[17] K. Pulli, A. Baksheev, K. Kornyakov, and V. Eruhimov, “Real-time computer vision with opencv,” Commun. ACM, vol. 55, no. 6, pp. 61–69, 2012. https://doi.org/10.1145/2184319.2184337.
[18] J. Canny, “A computational approach to edge detection,” IEEE Trans. Pattern Anal. Mach. Intell., vol. PAMI-8, no. 6, pp. 679–698, 1986. https://doi.org/10.1109/TPAMI.1986.4767851.
[19] J. Valverde Rebaza, “Detección de bordes mediante el algoritmo de canny,” tech. rep., Escuela Académico Profesional de Informática, Universidad Nacional de Trujillo, 2007.
[20] P. Suárez and M. Villavicencio, “Detección de contornos utilizando el algoritmo canny en imágenes cross-espectrales fusionadas,” Enfoque UTE, vol. 8, no. 1, pp. 16–30, 2017. https://doi.org/10.29019/enfoqueute.v8n1.127.
[21] J. Salgado Patrón, L. Vásquez Dı́az, and M. Vidal Solano, “Diseño e implementación de algoritmo para el procesamiento de imágenes en sistemas embebidos,” Ing. Reg., vol. 10, pp. 41–53, Dec. 2013. https://doi.org/10.25054/22161325.756.
[22] H. Hermawan, “Experimental vision robot for general working application using raspberry pi and single camera with python-opencv,” ACMIT Proc., vol. 3, no. 1, pp. 231–238, 2016. https://doi.org/10.33555/acmit.v3i1.50.
[23] Z. Xu, X. Baojie, and W. Guoxin, “Canny edge detection based on open cv,” in 2017 13th IEEE Int. Conf. Elec- tron. Meas. Instrum. (ICEMI), pp. 53–56, IEEE, 2017. https://doi.org/10.1109/ICEMI.2017.8265710.
[24] M. Intisar, M. M. Khan, M. R. Islam, and M. Masud, “Computer vision based robotic arm controlled using interactive gui,” Intell. Autom. Soft Comput., vol. 27, no. 2, pp. 533–550, 2021. https://doi.org/10.32604/iasc.2021.015482.
[25] M. Abdullah-Al-Noman, A. N. Eva, T. B. Yeahyea, and R. Khan, “Computer vision-based robotic arm for object color, shape, and size detection,” J. Robot. Control, vol. 3, no. 2, pp. 180–186, 2022. https://doi.org/10.18196/jrc.v3i2.13906.
[26] J. Lahoti, J. Sn, M. V. Krishna, M. Prasad, B. Rajeshwari, N. Mysore, and J. S. Nayak, “Multi-class waste segregation using computer vision and robotic arm,” PeerJ Comput. Sci., vol. 10, p. e1957, 2024. https://doi.org/10.7717/peerj-cs.1957.
[27] V. Kumar, Q. Wang, W. Minghua, S. Rizwan, S. Shaikh, and X. Liu, “Computer vision based object grasping 6dof robotic arm using picamera,” in 2018 4th Int. Conf. Control Autom. Robot. (ICCAR), pp. 111–115, IEEE, 2018. https://doi.org/10.1109/ICCAR.2018.8384653.
[28] V. D. Cong, D. A. Duy, et al., “Design and development of robot arm system for classification and sorting using machine vision,” FME Trans., vol. 50, no. 1, pp. 181–192, 2022. https://doi.org/10.5937/fme2201181C.
[29] D. F. Monroy Moya, D. A. Rojas Sarmiento, and F. Barrera Prieto, “3 dof robot programmed withpic 18f45k22 for handling materials in a robotic cell,” Vis. Electron., vol. 17, no. 1, pp. 129–139, 2023. https://revistas.udistrital.edu.co/index.php/visele/article/view/21189.
[30] A. P. Mancipe Garcı́a, N. D. Barrera Fonseca, D. A. Rojas Sarmiento, and F. Barrera Prieto, “Desarrollo de un brazo robótico de 2 dof impreso en 3d, a través de un pic 18f46k22 y matlab para el trazo de contornos de imágenes,” I+T+C Investig. Tecnol. Cienc., vol. 1, no. 17, p. 12, 2023. https://doi.org/10.57173/ritc.v1n17a12.
[31] X. Cui, Y. Fang, and C. Gu, “Residual vibration reduction in flexible systems based on trapezoidal velocity profiles,” Appl. Sci., vol. 15, no. 4, p. 1791, 2025. https://doi.org/10.3390/app15041791.
[32] H.-J. Heo, Y. Son, and J.-M. Kim, “A trapezoidal velocity profile generator for position control using a feedback strategy,” Energies, vol. 12, no. 7, p. 1222, 2019. https://doi.org/10.3390/en12071222.
How to Cite
APA
ACM
ACS
ABNT
Chicago
Harvard
IEEE
MLA
Turabian
Vancouver
Download Citation
License
Copyright (c) 2026 David Fernando Monroy Moya, Fabián Barrera Prieto, Diego Alfonso Rojas Sarmiento

This work is licensed under a Creative Commons Attribution 4.0 International License.
The authors or holders of the copyright for each article hereby confer exclusive, limited and free authorization on the Universidad Nacional de Colombia's journal Ingeniería e Investigación concerning the aforementioned article which, once it has been evaluated and approved, will be submitted for publication, in line with the following items:
1. The version which has been corrected according to the evaluators' suggestions will be remitted and it will be made clear whether the aforementioned article is an unedited document regarding which the rights to be authorized are held and total responsibility will be assumed by the authors for the content of the work being submitted to Ingeniería e Investigación, the Universidad Nacional de Colombia and third-parties;
2. The authorization conferred on the journal will come into force from the date on which it is included in the respective volume and issue of Ingeniería e Investigación in the Open Journal Systems and on the journal's main page (https://revistas.unal.edu.co/index.php/ingeinv), as well as in different databases and indices in which the publication is indexed;
3. The authors authorize the Universidad Nacional de Colombia's journal Ingeniería e Investigación to publish the document in whatever required format (printed, digital, electronic or whatsoever known or yet to be discovered form) and authorize Ingeniería e Investigación to include the work in any indices and/or search engines deemed necessary for promoting its diffusion;
4. The authors accept that such authorization is given free of charge and they, therefore, waive any right to receive remuneration from the publication, distribution, public communication and any use whatsoever referred to in the terms of this authorization.










