ATtiny project stops running after a time

Hello,
My project involves an ATtiny85 using PWM to control the gate of a mosfet, that in turn switches power to a 12vdc CPU fan. The controller uses a potentiometer input and is powered via an L7805 regulator. The setup works as it should just after power on <5~10 minutes, and then the fan will stop. I’ve tried varying the fan speed to see the affect of run time, but there seems to me to difference. I’ve also scoured google to see if I programmed the controller correctly, but most of those searches end in how to get three PWMs out of the controller. I used the Arduino IDE and commands to program the controller. Has anyone some insight as to what might be causing this issue?

  int potVal = 0;
  int gatePin = 1;
  int potpin = A1;
  
void setup() {
  pinMode(gatePin, OUTPUT);
  }

void loop() {
  potVal = analogRead(potpin);
  analogWrite(gatePin, potVal / 4);
}

Stirplate.png

Do you have a 0.1uf cap between Vcc and Gnd of the tiny85 right next to the chip? I don’t see one on the schematic. You need one of those, otherwise chip operation will be unstable and it could just stop or reset itself at random. The larger cap on the output of the regulator does not eliminate the need for the 0.1uf cap - you need both.

Check voltages on pins when it’s in a failed state, too, to make sure there aren’t any surprises.

Thank you for your help. No I do not. I was unaware this was needed. Does the cap need to be a specific type?

Ceramic, 0.1uf.

Most digital IC's should have a 0.1uf decoupling cap between supply and ground, right next to the chip - include it unless told otherwise.

You'll likely use more 0.1uf ceramic caps than any other single component in the course of electronics hobby stuff.

Alright, I'll be sure to throw one in there and test it out.