In this paper, we present a system for controlling the angular velocities of the motors of a 2WD mobile robot using an optimal Linear Quadratic Regulator with Tracking (LQRT), thanks to a Co-simulation between two Raspberry Pi modules and the MATLAB R2018a software. Indeed, we have a system made up of a certain number of elements, notably a web interface for communication with users, a Raspberry Pi 4 Model B module that we have configured as a server and a Raspberry Pi 3 Model B module that plays the role of a socket client who’s physical GPIOs are represented in an identical logical manner on Simulink in order to facilitate interaction with the process modelled in MATLAB R2018a. This system has been realized thanks to a combination of various software technologies such as the python flash framework for the development of the web application, the HTML and CSS programming languages for the client side of our user application, the library written in C language SQLite for the relational database engine accessible by the SQL language, the JavaScript library Socket. IO library for real-time bidirectional communication between clients and servers, the Python Threading library to facilitate the execution of parallel processes and the python RPI library to control the GPIO ports of the Raspberry Pi 3. The speed control simulation results on a 2WD mobile robot in both normal and Co-simulation modes show almost identical performance indices.