DIY hot wire cutter electronics: needs some advice

I've edited my comment.

The fan seems to run intermittent. I can hear the PWM signal going up and down when I turn the pot, but sometimes the Arduino seems to 'hang' and then moving the pot doesn't change the PWM anymore. I don't have an Osc sadly, but I tried reading the values through the serial connection, however the Arduino seems to hang as well when I start moving the pot. So the serial outputs zero's until I start moving the pot, then it gives a conn error and it freezes.

I haven't attached the PSU yet, this is still with the 5v fan setup.

(Also tried this without the mapping, but it seems that the Uno keeps doing this with and without the mapping)

I can only reset it by disconnecting the USB power. I'll give it one last try now by connecting it all up to a separate power supply with 5v going to Vin and Gnd. Maybe it's undervolting somehow, though I doubt it as the fan doesn't pull much current (0.05A max).

Update:
No matter what I try, it keeps crashing the serial when I start turning the pot.
This is the script:

#define PWM_PIN 3 // pin 3 because: pwm
	void setup() {                
	  pinMode(PWM_PIN, OUTPUT); // set PWM_PIN as an output
    Serial.begin(9600);
	  delay(1000);
	}
	void loop(){
	  int val = analogRead( A0 ); // read potentiometer
    int sensorValue = analogRead(A0);
    val = map(val, 0, 1023, 0, 255); // map the analog value from max 1023 to max 255
	  analogWrite(PWM_PIN, val ); // send value to the mosfet
    Serial.println(sensorValue*1);
  delay(100);        // delay in between reads for stability
  }