Have a look at the below corrected diagram . 1). You should add a freewheeling diode at the motor terminal to catter inductive kicks. 2)If you need further protection you can isolate the microcontroller section from the MOSFET via an optocoupler, and there power supplies respectively. 3) Add a zener at the base of the Mosfet to protect the gate at what ever, voltage you are operating the FET.![enter image description here][1] [1]: https://i.sstatic.net/vK8Ob.jpg