I don't know if you gave a description of what "wonky" means; please describe it.
When stand-alone, how is everything wired? When powered via USB, how is everything wired? Please make drawings (photo of pencil and paper drawings is OK) and post them here; don't forget every single power wire.
I still think you need to use Serial Monitor to figure out what is happening on your sensors while the tram is making it's rounds.