My small tft monitor is disturbed by the loose Type-C cable, causing snowflakes that cannot be eliminated

hi all;

I've tried re-uploading the code and pressing the rest key, but neither can get rid of the snowflakes,thanks for you help.

Does your code fill the screen with black to start with?

I can only recommend redoing the TFT display jumper wires ohterwise.

Are you certain you are using the correct library for that display?

The soldering on the header pins looks questionable.

#include <Arduino.h>
#include <TFT_eSPI.h>
#include "I2Cdev.h"
#include "MPU6050.h"
#include "Wire.h"

#define WIDTH  128
#define HEIGHT 160

int16_t ax, ay, az;
int16_t gx, gy, gz;

MPU6050 accelgyro;
TFT_eSPI tft = TFT_eSPI();
TFT_eSprite spr = TFT_eSprite(&tft); 


void setup() {
  Serial.begin(115200);
  Wire.begin();

  accelgyro.setXGyroOffset(220);
  accelgyro.setYGyroOffset(76);
  accelgyro.setZGyroOffset(-85);

  spr.createSprite(WIDTH, HEIGHT); 
  tft.init();
  tft.setRotation(1);
  spr.fillScreen(TFT_BLACK);
  spr.setTextFont(2);
  spr.setTextSize(1);
  spr.setTextColor(TFT_GREEN);
  
  accelgyro.initialize();
  accelgyro.testConnection();
  
  if (accelgyro.testConnection())
   {
    Serial.println("MPU6050 connection successful");}
    
    else
    {Serial1.println("MPU6050 connection failed");}
  

}
  
  
void loop() {

  // accelgyro.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);
  accelgyro.getAcceleration(&ax, &ay, &az);
  accelgyro.getRotation(&gx, &gy, &gz);
  
  spr.fillScreen(TFT_BLACK);
  spr.setCursor(0, 0);
  
  
  spr.drawString("X:" +String(ax), 0, 0);
  spr.drawString("Y:" +String(ay), 0, 40);
  spr.drawString("Z:" +String(az), 0, 80);
  spr.drawString("GX:" +String(gx), 70, 0);
  spr.drawString("GY:" +String(gy), 70, 40);
  spr.drawString("GZ:" +String(gz), 70, 80);


  spr.pushSprite(0,0);
  
  delay(1000);
  
}

There was no problem when I uploaded the code, but snowflakes appeared on the Type-C cable after shaking for a while. I also reconnected the jumper, but it didn't seem to work, but thank you for your suggestion.

Do you have another cable that makes a more solid connection?

Alternatively, power the board using a mechanically secure connection from a power supply.

1 Like

Does it work if you disconnect the power then reconnect?

TFT_eSPI

I am using this library, but the problem is not with the soldering. I heard the computer prompt that the Type-C cable shook a little, and snowflakes appeared.

What happens when you unplug the Type-C cable then plug it back in?

1 Like

Re-inserting the Type-C cable did not solve it, but I used the code tft.setRotation(1); to rotate to parameter 3, and then rotated back to parameter 1, which solved most of the snowflakes, thank you for your help.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.