# System integration <a href='https://gitlab.fabcloud.org/academany/fabacademy/2023/labs/isafjordur/students/svavar-konradsson/-/blob/main/docs/final-project/integration.md?plain=1' title='View Page Source'><img src='https://fabacademy.org/2023/labs/isafjordur/students/svavar-konradsson/assignments/images/file-eye-outline.svg' alt='View Page Source' /></a> ## USB hub communication I was unsure how to connect all the robot joints together for a while. Jake Read shows I2C communication using his OSAP library. It would make for a nicely integrated whole, but the joints that have I2C connections might react more slowly than the one in the base, which would be directly connected to the full-speed USB port. So two weeks before the final presentation I ordered a tiny USB hub from a Swiss company called Yoctopuce. When it arrived I was eager to see if it worked and whether it was able to supply enough current to two motors at the same time. So I took my bike over to Hamraborg, bought a USB-C cable, cut it in half and soldered the wires to connectors that I ordered with the USB hub. And here I am running two BLDC motors from one USB port on my laptop (note that this is a special 3A port with a battery charging logo on it): <video controls width=100%> <source src="images/usb_hub_test.mp4" type="video/mp4"> </video> Now the whole thing works on a breadboard. Whew! ## Power budget A bit later I realized that I hadn't checked whether that single USB-C port on my laptop could support all the motors and things that I wanted to build into the arm. So I bought another USB-C cable, cut it in half and connected more motors. And here I have three brushless motors and one stepper motor running on one USB-C port at the same time: <video controls width=100%> <source src="images/power_budget_test.mp4" type="video/mp4"> </video>*Instead of the stepper motor I'll actually be using a tiny DC motor as a Z-axis, and I also need to power an end effector.* ## Assembling a robot joint The night before my final project presentation, I assembled one robot joint and managed to hide all the wires. Here it is running a PID cascade control loop using the SimpleFOC library: <video controls width=100%> <source src="images/pid_control.mp4" type="video/mp4"> </video>*Phew, it works!* ### Design file The motor control code is the same as in [Motor Control](https://fabacademy.org/2023/labs/isafjordur/students/svavar-konradsson/final-project/motor_control.html). <style> .md-content__button { display: none; } </style>