A while ago I tried to build an "intelligent locomotive" that could be controlled over WiFi as well as DCC, and would continually report back on its status. The experiment was a failure, because the microprocessor I used (Particle Photon), though very promising, couldn't cope with electrical reality of an outdoor layout. It was an interesting experiment though, and maybe people would be interested to know more. It's written up on my blog.
n5296s.blogspot.com

Flowers for Marcel - the end of my intelligent locomotive experiment
This weekend I finally abandoned my attempt to build an intelligent, "internet of things" locomotive for my garden railway. It was a very di...