We developed a self-balancing robot for our mechatronics course using Simulink.
In order to test your systems, you can run gyrotest and motortest files separately. After making sure that your IMU and driver units are working fine, you can run the final file.