problems with humidity controlled bathroom fan project

hi i have a project involiving a dht11 where my values start jumping around like crazy after hitting trigger point

i am also displaying a image like a gif to a nokia 5110 to show that the fan is running so im not sure if i messed up my millis

here is my code

#include <U8glib.h>
#include "dht.h"

#define dht_apin A1
#define test_width 30
#define test_height 30
#define backlight_pin 11
#define relayPin 12

U8GLIB_PCD8544 u8g(8, 4, 7, 5, 6);  // lcd pins CLK=8, DIN=4, CE=7, DC=5, RST=6

dht DHT;
int humid = DHT.humidity;
int sensorPin = A1;
long currentMillis = 0;      // stores the value of millis() in each iteration of loop()
long previousFrame1Millis = 0;
long previousFrame2Millis = 0;
long previousFrame3Millis = 0;
long previousMillis = 0;              // store time for dht11 polling
long interval = 5000;                 // specify wait between polling dht11
long Animate = 200;

const unsigned char test_bits[]PROGMEM  = {
  0xff, 0xff, 0xff, 0x3f, 0xfb, 0xff, 0xff, 0x3f, 0xf9, 0xff, 0xff, 0x3f,
  0xff, 0x07, 0xf8, 0x3f, 0xff, 0x01, 0xe0, 0x3f, 0xff, 0x1c, 0x80, 0x3f,
  0x3f, 0x3f, 0x30, 0x3f, 0x3f, 0x3f, 0x78, 0x3e, 0x1f, 0x3e, 0x7c, 0x3e,
  0x0f, 0x7e, 0xfc, 0x3c, 0x0f, 0x7c, 0x7e, 0x3c, 0x07, 0x78, 0x3f, 0x38,
  0x07, 0xf0, 0x1f, 0x38, 0xc7, 0x72, 0x07, 0x38, 0xe7, 0x3f, 0x02, 0x38,    // frame 1 of 4 gif loop
  0xf7, 0x3f, 0x0e, 0x38, 0xf7, 0xff, 0x7f, 0x38, 0xe7, 0xe7, 0xfe, 0x39,
  0xef, 0xe0, 0xfc, 0x3d, 0x0f, 0xf0, 0xf8, 0x3d, 0x0f, 0xf0, 0xf0, 0x3c,
  0x1f, 0xf8, 0x40, 0x3e, 0x1f, 0xf8, 0x00, 0x3e, 0x3f, 0xf8, 0x00, 0x3f,
  0xff, 0xf8, 0x80, 0x3f, 0xff, 0xe1, 0xe0, 0x3f, 0xff, 0x07, 0xf8, 0x3f,
  0xff, 0xff, 0xff, 0x27, 0xff, 0xff, 0xff, 0x37, 0xff, 0xff, 0xff, 0x3f
};

const unsigned char test2_bits[]PROGMEM  = {
  0xff, 0xff, 0xff, 0x3f, 0xfb, 0xff, 0xff, 0x3f, 0xf9, 0xff, 0xff, 0x3f,
  0xff, 0x05, 0xf8, 0x3f, 0xff, 0x71, 0xe0, 0x3f, 0x7f, 0xf8, 0x80, 0x3f,
  0x3f, 0xf8, 0x01, 0x3f, 0x2f, 0xf8, 0x01, 0x3e, 0x1f, 0xf0, 0xc1, 0x3e,
  0x0f, 0xf0, 0xf0, 0x3c, 0x0f, 0xf0, 0xf8, 0x3d, 0xe7, 0xe3, 0xfc, 0x39,
  0xf7, 0xe7, 0xff, 0x39, 0xf7, 0xff, 0xff, 0x38, 0xf7, 0x3f, 0x1f, 0x38,
  0xf7, 0x3f, 0x02, 0x38, 0x07, 0xa0, 0x07, 0x38, 0x07, 0xf0, 0x0f, 0x38,    // frame 2 of 4 gif loop
  0x07, 0x78, 0x3f, 0x38, 0x0f, 0x7c, 0x7e, 0x3c, 0x0f, 0x3e, 0xfe, 0x3c,
  0x1f, 0x3f, 0xfc, 0x3e, 0x2f, 0x3f, 0x78, 0x3e, 0x3f, 0x1e, 0x10, 0x3f,
  0x7f, 0x1c, 0xc0, 0x3f, 0xff, 0x01, 0xa0, 0x3f, 0xff, 0x07, 0xf8, 0x3f,
  0xff, 0xff, 0xfb, 0x27, 0xff, 0xff, 0xff, 0x37, 0xff, 0xff, 0xff, 0x3f
};

const unsigned char test3_bits[]PROGMEM  = {
  0xff, 0xff, 0xff, 0x3f, 0xfb, 0xff, 0xff, 0x3f, 0xf9, 0xff, 0xff, 0x3f,
  0xff, 0x07, 0xf8, 0x3f, 0xff, 0xc1, 0xe1, 0x3f, 0x7f, 0xc0, 0xc7, 0x3f,
  0x3f, 0xc0, 0x07, 0x3f, 0x1f, 0xc0, 0x07, 0x3e, 0x9f, 0xc0, 0x07, 0x3e,
  0xcf, 0xc3, 0x03, 0x3c, 0xef, 0xc7, 0x03, 0x3c, 0xef, 0xcf, 0xc1, 0x3d,
  0xe7, 0xdf, 0xf9, 0x39, 0x87, 0xff, 0xff, 0x3b, 0x07, 0x1c, 0xff, 0x3b,     // frame 3 of 4 gif loop
  0x07, 0x10, 0xff, 0x39, 0x07, 0xb8, 0xd3, 0x38, 0x07, 0xfe, 0x03, 0x38,
  0x07, 0xbf, 0x07, 0x38, 0x8f, 0x9f, 0x0f, 0x3c, 0xcf, 0x8f, 0x1f, 0x3c,
  0x9f, 0x0f, 0x1f, 0x3e, 0x9f, 0x07, 0x3f, 0x3f, 0x3f, 0x03, 0x3f, 0x3f,
  0x7f, 0x00, 0xce, 0x3f, 0xff, 0x01, 0xe0, 0x3f, 0xff, 0x07, 0xf8, 0x3f,
  0xff, 0xff, 0xff, 0x27, 0xff, 0xff, 0xff, 0x37, 0xff, 0xff, 0xff, 0x3f
};

const unsigned char test4_bits[]PROGMEM  = {
  0xff, 0xff, 0xff, 0x3f, 0xfb, 0xff, 0xff, 0x3f, 0xf9, 0xff, 0xff, 0x3f,
  0xff, 0x07, 0xfc, 0x3f, 0xff, 0x01, 0xe0, 0x3f, 0x7f, 0x00, 0x8e, 0x3f,
  0x3f, 0x02, 0x1e, 0x3f, 0x9f, 0x07, 0x3f, 0x3e, 0xdf, 0x0f, 0x1f, 0x3e,
  0xcf, 0x1f, 0x1f, 0x3c, 0x8f, 0x9f, 0x0f, 0x3c, 0x07, 0xbf, 0x07, 0x38,
  0x07, 0xfc, 0x03, 0x38, 0x07, 0x38, 0x01, 0x38, 0x07, 0x10, 0xff, 0x3b,
  0x07, 0x3e, 0xff, 0x3b, 0xc7, 0xff, 0xff, 0x3b, 0xe7, 0xff, 0xf9, 0x39,     // frame 4 of 4 gif loop
  0xe7, 0xcf, 0xe1, 0x39, 0xef, 0xc7, 0x03, 0x3c, 0xcf, 0xe3, 0x03, 0x3c,
  0xdf, 0xc0, 0x03, 0x3e, 0x3f, 0xe0, 0x07, 0x3f, 0x3f, 0xe0, 0x07, 0x3f,
  0xff, 0xc0, 0x87, 0x3f, 0xff, 0x81, 0xe1, 0x3f, 0xff, 0x07, 0xfc, 0x3f,
  0xff, 0xff, 0xff, 0x27, 0xff, 0xff, 0xff, 0x37, 0xff, 0xff, 0xff, 0x3f
};


uint8_t toggle = 0;

void draw(void) {
  //graphic commands to placw static values
  u8g.setFont(u8g_font_profont11);  // select font
  u8g.drawStr(0, 15, "T: ");  // put string of display at position X, Y
  u8g.drawStr(0, 25, "H: ");
  u8g.setPrintPos(15, 15);  // set position
  u8g.print(DHT.temperature, 0);  // display temperature from DHT11
  u8g.drawStr(30, 15, "c ");
  u8g.setPrintPos(15, 25);
  u8g.print(DHT.humidity, 0);  // display humidity from DHT11
  u8g.drawStr(30, 25, "% ");


  // graphic commands to redraw the complete screen should be placed here
  if (toggle == 1)
    u8g.drawXBMP( 50, 0, test_width, test_height, test_bits);
  else if (toggle == 2)
    u8g.drawXBMP( 50, 0, test_width, test_height, test2_bits);
  else if (toggle == 3)
    u8g.drawXBMP( 50, 0, test_width, test_height, test3_bits);
  else
    u8g.drawXBMP( 50, 0, test_width, test_height, test4_bits);
}


void setup() {
  analogWrite(backlight_pin, 200); // Set the Backlight intensity
  pinMode(relayPin, OUTPUT);
}

void loop() 
  {// print data to screen
    u8g.firstPage();  
    do
    {draw();}
    while( u8g.nextPage() );
    
    currentMillis = millis();
    readdht();
    switchfan();
   
  }
void readdht()  
  {
   if (currentMillis - previousMillis > interval) 
    previousMillis = currentMillis;// save the last time you polled dht11
    DHT.read11(dht_apin); // Read apin on DHT11
  }
void switchfan()
{
  
  if (humid>40)
 { 
  digitalWrite(relayPin, HIGH); //turn on fan and display fan animation
  // picture loop
  u8g.firstPage();
  do 
  {
    draw();
  } 
  while ( u8g.nextPage() );

  toggle++;
  if (toggle > 1) toggle = 2;
  // rebuild the picture after some delay
  if (currentMillis - previousFrame1Millis >= Animate)
    previousFrame1Millis = millis();
  toggle++;
  if (toggle > 2) toggle = 3;
  // rebuild the picture after some delay
    if (currentMillis - previousFrame2Millis >= Animate)
    previousFrame2Millis = millis();
  toggle++;
  if (toggle > 3) toggle = 0;
  // rebuild the picture after some delay
    if (currentMillis - previousFrame3Millis >= Animate)
    previousFrame3Millis = millis();
 }
  else
 {
 digitalWrite(relayPin, LOW); //turn off fan and draw static image of fan
  u8g.drawXBMP( 50, 0, test_width, test_height, test_bits);  
}
}

the code runs fine and shows the values correctly as long as i dont hit the 40% humidity but as soon as i hit 40% it will display my animation and then the temp and humidity values start jumping like crazy from 11% to about 60% and relay is clicking on and off too for some reason. the temp reading is not as drastic but im wondering if i messed up my millis and its checking the sensor at the same rate as my animation or if im overloading the amount of data im saving to millis how fast can the ardunio(uno) read a loop?

the dht11 is voltage sensitive so when the load on the board changes that can cause the readings to go nuts for a few seconds.
Google unstable readings from a dht11 which will tell you how to stabilize the sensor

roughly stabilizing means

1/ dont read more than once a second
2/ sensor ground needs to go to arduino ground pin not to a breadboard
3/ a 100uf cap across the sensor + and -
4/ a pull up resistors on the sensor data pin

been a while since ive played with the dht11 but I know that it can be stabilized

A schematic or wiring diagram would have been helpful. Nonetheless, I am going to take a leap here and guess that your relay is part of the problem. Perhaps you are powering it off the Arduino, or perhaps you are powering it off the same power supply as is used for the Arduino?

Try disconnecting the relay. This will test whether the relay is at the root of your problem.

These types of problems are often associated with magnetic components and high current components such as motors and relays.

The relay should be filtered (as well as the sensor as another poster explained). The relay should have its own power supply but with its ground connected to the Arduino ground.

I have a 5v breadboard power supply and the dht is grounded in the breadboard the power supply is also powering the uno I am gonna see if I have a cap to add to the dht and see if running the uno off of battery changes anything