While the basic concept of LEGO bricks ... were an H-bridge driver to operate the motor and an ESP8266 to generate PWM signals. In order to keep the bricky appearance of the train engine intact ...