Hardware in the loop is presented as a valid solution both to design and simulate mechanical models using “close loop control” techniques. Through the application of controller algorithms, the mechanical model is defined either as a physical mechanism or as an embedded device, allowing to get a suitable control structure to implement in real life. Hence, the following work will show the design of a PID and a Root Locus Compensator controllers for a differential transmission in a four-wheeled vehicle, using Hardware in the loop (HIL) techniques and an STM development boards. Subsequently, a simulation is carried out to get a comparison between the data produced by HIL and those obtained by computational tests, allowing to acquire the system behaviour at different sample time.