To invert the rotation of a motor by changing the levels of an Arduino output or another microcontroller, we can use a 5 V relay as shown in the connection below. The engine has independent power. To turn the engine on and off we can use a second relay. For higher voltage relays it is convenient to use an excitation stage as given in the next circuit.