After a short break, I finally have some update. First, the motor. It works! The H-bridge is perfect, and runs only from the USB power it gets from the MEGA. Also, I get rid of the voltage-divider resistors and get a proper CD4050 for the Raspberry-MEGA UART connection.
I also figured that connecting every device again and again one by one at every power-up can become really annoying. Who wants to do that? Not me, obvoiusly. So I came up with the idea of static IDs. Devices with static ID have to be connected to TWPC line when the master is offline. Then, when it starts, they'll be connected automatically. Connecting devices with auto-assigned ID is still possible though.
Here is the new breadboard setup with the H-bridge:
That's for the electronics, but that's not all I got. I designed brand new rails with holes and stuff to be modular. I also designed switches (only the static part yet) and assembled a whole train station. Go to my GitHub to see the STL files along with the codes and schematics.
Still no news from the 3D printer...