TM1637 7Segment module behaving erratically

Hello everyone. I am having issues with a TM1637 module controlling a 7segment 4 digit display, and I just cannot figure out what is wrong. I hope you are able to help me. Thank you a lot in advance.

Project context

I am building a KTAN-like game:


in a physical medium, where the player has various boxes (each module/minigame fits into a box) and can join in boxes together, to create the defusable bomb.

Right now, I have developed the "controller box" that will deal with communication between all the minigames, and will serve as the starting point to the user, and I have developed the first minigame, morse code. I am having issues in the controller box. Here are some photos, to get the general feeling for what I am talking about:

FRONT VIEW, with 7segment display missing

Partial wiring

Here is the wiring that I think is critical to understand what is connected to what:

Not everything is in this diagram (the application I was using did not have many of the things I needed, and I do not think they are that useful anyway). What is missing is a LCD display (as seen in the front view photo), and encoder, and a buzzer, all properly connected to the arduino as they work just fine. They are all connected to the 5V rail as well.

In the diagram, I depicted the rest of the wiring. A 7segment 4 digits module connected to the arduino, and finally a fan also controlled by the arduino. The fan is part of the minigame requirements, and there are 3 of them connected in a similar fashion ( to different output pins of course). They are turned on and off by the microcontroller at certain instances throughout the game duration.

Everything is powered by an outside 12V source, and I use a stepdown to lower the voltage to the necessary 5v for the arduino and other components, whilst I feed the 12v directly to the DC fans.

Problem

When I start the game, the 7segment display should show the time ( like a ticking bomb) left to defuse the bomb. It is updated every second. Everything worked fine at first, but, at some point, the display starts showing gibberish with every update, until inevitably stops showing anything at all. That's pretty much it. I could not find a pattern to when it shuts down, for how long it stays working correctly, or if its related to other components wired in the same rails (I am especially suspicious of the fans)

What I tried and my suspicions

I have tried I could remember. My first step was to remove the display and try a simple sketch on a different arduino, to see if it would work. To my surprise, it did not. The power led was on, but nothing showed. Weird. I connected a second module, and it worked just fine. Maybe the first module was defective? I put the new module in my minigame and it worked for a while... until, sure enough, it went crazy and black. What I discovered though, was that, if you give some time to the modules to " rest ", they will start working again just fine, after some time disconnected. This raises my suspicion of some capacitance accumulation or something?

I have tried other tests, but I do not know how relevant they are to mention here. I think that it is likely that something is going on with the fact that these sensitive modules are connected to the same rails as DC motors, close by physically, but I dont have enough knowledge or experience to understand what it could be. Given that this was the only thing that I did not previously tested on a breadboard ( the fans with the rest of the hardware) it also makes some sense that the fans are the culprit. But why? And how to possibly fix it?

I hope the explanation was not too confusing. Thank you so much for your time, and any help provided.

EDIT 1: A bit of context from myself, which could help with the replies. I have a masters in electrical engineering, but I work on a totally different field (chess coaching), which means that I will know some technical stuff if you mention it to me, and I am used to programming, but I lack the "on field experience" which could be helpful on this case

Connect only the TM1637 display unit with MEGA using DPin-3 at CLK pin and DPin-4 at DIO pin and ten run the following test sketch. Report the result.

// Include the library
#include <TM1637Display.h>

// Define the connections pins
#define CLK 3
#define DIO 4

// Create a display object of type TM1637Display
TM1637Display display = TM1637Display(CLK, DIO);

// Create an array that turns all segments ON
const uint8_t allON[] = {0xff, 0xff, 0xff, 0xff};

// Create an array that turns all segments OFF
const uint8_t allOFF[] = {0x00, 0x00, 0x00, 0x00};

// Create an array that sets individual segments per digit to display the word "dOnE"
const uint8_t done[] = {
  SEG_B | SEG_C | SEG_D | SEG_E | SEG_G,           // d
  SEG_A | SEG_B | SEG_C | SEG_D | SEG_E | SEG_F,   // O
  SEG_C | SEG_E | SEG_G,                           // n
  SEG_A | SEG_D | SEG_E | SEG_F | SEG_G            // E
};

// Create degree celsius symbol
const uint8_t celsius[] = {
  SEG_A | SEG_B | SEG_F | SEG_G,  // Degree symbol
  SEG_A | SEG_D | SEG_E | SEG_F   // C
};

void setup() 
{
 // display.showNumberDec(1234);     // Prints _-12
 // while(1);delay(2000);

}

void loop() 
{
  // Set the brightness to 5 (0=dimmest 7=brightest)
  display.setBrightness(5);

  // Set all segments ON
 // display.setSegments(allON);

  delay(2000);
  display.clear();

  // Show counter 0-9
  int i;
  for (i = 0; i < 10; i++) {
    display.showNumberDec(i);
    delay(50);
  }

  delay(2000);
  display.clear();

  display.showNumberDec(-12);     // Prints _-12
  delay(2000);
  display.clear();

  display.showNumberDec(-999);    // Prints -999
  delay(2000);
  display.clear();

  display.showNumberDec(31, false); // Prints __31
  delay(2000);
  display.clear();

  display.showNumberDec(31, true);  // Prints 0031
  delay(2000);
  display.clear();

  display.showNumberDec(14, false, 2, 1); // Prints _14_
  delay(2000);
  display.clear();

  display.showNumberDec(-5, false, 3, 0); // Prints _-5_
  delay(2000);
  display.clear();

  // Prints 12:34
  display.showNumberDecEx(1234, 0b11100000, false, 4, 0);

  delay(2000);
  display.clear();

  // Prints 15°C
  int temperature = 15;
  display.showNumberDec(temperature, false, 2, 0);
  display.setSegments(celsius, 2, 2);

  delay(2000);
  display.clear();

  // Prints dOnE
  display.setSegments(done);

  while (1);
}

2 requests

  1. Please post completic schematics.
  2. Please post a link to the display datasheet

Thank you for the reply.

I assumed that you wanted me to disconnect all the wires in the box and just keep the display, using the stepdown and all the wires that were already in place for the supply.

Everything seems to work totally fine. I tried running it a few times, as, as I mentioned, sometimes in my setup they also worked for a while, but it worked perfectly every time.

Thank you for the reply.

1.Could you please advise on a schematic maker for a project with so many wirings? I did not include everything because the ones I found were weird to use (and I could not include some of the components at all) and I did not see the point in showing the connections of a lcd1602 display, wire by wire, as I felt that it would include unnecessary clutter. I was trying draw.io now.

  1. Its a typical aliexpress display: Módulo de exibição de tubo digital LED de 0,56 "4 bits TM1637 Módulo de exibição de tubo decimal de 7 segmentos amarelo/branco/vermelho/verde/azul - AliExpress 502 I assume this means that the relevant datasheet is the TM1637 one?

Thank you, in the meantime I will try to use draw.io

EDIT: Nevermind, I think draw.io is horrible for this. I found out that fritzing is downloadable for free (an older version) and I will try that instead. I will upload the schematic to the original post in an edit once I have it

My intention was to help you finding the cause of the intermittent functioning of your TM1637 Display Module.

The approach was to connect only the display module with MEGA and chceking that it worked well. After that connect/add the remaining ardware/software with the base unit in an incremental way.

As I mentioned in the original post, I did some tests that I did not mention. Connecting only the microcontroller was one of them.

As for incrementing gradually - if everything was tested successfully working with the LCD + Encoder + TM1637 + Buzzer, and the only new hardware that was added between those tests and the final "product" were the fans, it must be the fans right? Or could I be missing something?

Thank you

If fan conection makes the TM1637 to malfunction, then try to connect 0.1 uF capacitor very close to the Vcc-pin of TM1637. The capa will kill the noise that might be appearng when the fan motor starts.

Make sure to switch to schematic view in Fritzing. It starts up in breadboard view by default. Diagrams drawn in breadboard view are not schematics!

I would suggest trying a 0.1uF cap directly across the terminals of the motor/fan to suppress noise.

It is 4 digits, not 4 bits.

If it were 4 bits, each digit could only display 0 or 1 :wink:

True lol, my mistake, will edit it now

I knew about trying a capacitor on the TM1637 module, but not on the fans. Will try that as well, thank you!

Sometimes the voltage is too low for the display to function reliably. Use a multimeter to measure the voltage. Noise can also be a problem. If you use a breadboard or long jumper wires, try using short wires without breadboard.

Using pull-up resistors and/or small capacitors can help to clean up a noisy signal, but do affect the maximum communication speed. Noise can cause a a command to change, eg. into a display off command or change of address. Having the loop() contain the command to enable the display or to reset the intensity, can help recover from mangled commands.

Pen, paper, Your hand and a posted photo.

That specifies nothing. Sales sites are not datasheets. Please dig up English datasheets when posting in the English section of forum.

Don't go for that. Forum doesn't accept them.