Thanks for the suggestion, dividing by four was actually what I saw in someone else's script and I had it in there initially but I didn't understand what it was for so I removed it haha (so @SteveThackery 's comment was very useful as I wasn't aware of the 0-255 vs 0-1023).
I have now solved all the issues so far. With a separate power supply for the fan I can run it perfectly while maintaining the serial connection.
I will add a 10K resistor between the Gate and GDN as well and connect all grounds (I guess that's why they also call it 'common'? My first language isn't English, so I only realize this now). This should work so well when it's up and running.
Thanks for the input! I'll share some more about the project when I finish it.