How to get the decimal point active in this 4-Digit 7 Seg TM1637 Tube display

I would like to display decimal values with use of the decimal point. The display I use (link to the shop) has the clock colon and a decimal point with every digit. Activation of the clock colon is no problem but I cannot get one of the decimal points running.
Tried these two libraries: TM1637Display.h and TM1637.h
Any help is highly appreciated.

I have not used this library.

The lib may not be written to handle a decimal point, take a look at the .cpp source.

I studied the .cpp files of both libraries and tried the examples without success but perhaps this is because of missing knowledge of me of library files.

These are the links to the two libs: TM1637.h en TM1637Display.h

If the digital point is not supported in these libs hopefully there are others who do.

Hoi JaapDubbelaar, welkom !

The second library has some clues to how the dots can be set, but you do need to read the file and be able to (at least somewhat) understand what it does.
It is this *.cpp file (click !).
Do a search for the word 'dots', i found that by looking for 'DecEx', which tells the library to handle decimal with dot, as i understood it.

Decex is in the example that comes with it, i didn't check to see it is actually used by that example.

Thanks!

I will take a look and try.

Did you get this to work? I'm having the same issue. I can get the clock colon to appear, but none of the decimal points. I bought https://www.aliexpress.com/item/D4056B-0-56-LED-4-Digit-Display-Module-with-Clock-Point-for-Arduino-AVR-ARM-PIC/2027331863.html

Hi - I am also having the same problem. Different TM1637 device, mine is from
https://www.ebay.com/itm/0-56-TM1637-4Bit-Digital-LED-7-Segment-Clock-Tube-Display-For-Arduino-White/172971714554?epid=27013077296&hash=item2845eae7fa:g:ISAAAOSweZJaOkDh
I tried avishorp's tm1637 library as well as bremme's (from github). can get the colon to work, but not the decimal point.
thx
-yurij

I've got the same problem and no solution :-((

OK guys, let me explain it to you.

It is a clock display, with a colon.

Clocks do not have decimal points, so a display manufactured specifically for a clock will simply not have the LEDs mounted in those positions. It may not even have the "F" segment (top left) on the first digit, though I imagine this one does.

Unless it uses a DP at one corner to provide indication of PM or alarm function, however this particular display is matrixed as 8 by 4 rather than 14 by 2 as used in most inexpensive alarm clocks, so it probably does not have that indicator. :roll_eyes:

Just to clarify, I have just ordered a couple of these displays out of curiosity, white and yellow versions, so when they arrive in three weeks from China. I might have more to say. :grinning:

These displays come in two variants, clock with 4 digits and a colon, and 4 digits each with a controllable decimal point. It can be a lottery as to which you get and some adverts show all digits the colon and the decimal points all illuminated which is misleading. Others are titled clock module but in the description it says with decimal points.

The LED module internally determines the type so you cannot rewire them.

bodmer:
It can be a lottery as to which you get and some adverts show all digits the colon and the decimal points all illuminated which is misleading.

Well of course with the TM1637 there are plenty more positions available in the matrix. I would expect they could have the colon, which may count for either one or two DPs, and at least two others which may be at the edges.

I thought I would like to check, so have ordered a couple of representative displays, including one advertised as you say, with all decimals illuminated as well as the colon. They will take a while to a arrive however.

The modules I have (and see are for sale) all use a 12 pin LED module which is a clue to there only being sufficient control pins for either colon or decimal points. The LED modules are internally wired for one of these options.

The Adafruit module uses a 14 pin LED module so has the extra pins needed fto control all the LEDs. That one has a different driver chip though. You do get independant control of the decimal points and colon with the Adafruit display.

bodmer:
The modules I have (and see are for sale) all use a 12 pin LED module which is a clue to there only being sufficient control pins for either colon or decimal points.

Well only four discrete points - you could have a colon, possibly with two parallel LEDs (as below) and two or three other indicators of some sort.

bodmer:
The Adafruit module uses a 14 pin LED module so has the extra pins needed to control all the LEDs. That one has a different driver chip though. You do get independent control of the decimal points and colon with the Adafruit display.

The colon is actually wired as a fifth, in fact middle digit!

The good news is that you get independent control of the colon LEDs so you can get a centre decimal point if you don't mind it being displaced slightly. I suspect arrangement this helps equalize the LED currents.

See attached.

4 digit LED display.pdf (328 KB)

Yes, that pdf - don't know from where you dredged it up - indicates a display where four DPs can be placed on request. And has significant problems with the English language. :astonished:

As to "equalising the LED currents", there is a general design problem of making the DP match the other segments whose light pipes open to a wider area. Since these displays have only one LED per segment, if all that is focussed to a small dot, it becomes too bright.

The Adafruit display puts two colon LEDs in parallel which would arguably help to equalise matters - but this does not apply to the other DPs and prevents doing entertaining tricks with the colon. :grinning:

Well, my two modules arrived, one white and one yellow.

The ones with alternate connection spills at each end. To be honest, they arrived nearly three weeks ago and like many other "little packages from China" have been sitting in my mullock heap (well, just one of many heaps) here since, waiting for me to locate the other items required.

So first, these boards have the common fault; the two capacitors adjacent to the two pull-up resistors are the wrong value and must be removed. I did so quite easily by pressing the soldering iron tip against the side so that it melted the solder on both ends, and then tapping the iron to eject the now attached capacitor. I tested one capacitor (after losing the first) with my Ardutester to confirm that it was indeed, a useless value of 10 nF. Since I did this first, I have had no problems getting the code to work.

The white is much brighter than the yellow.

Running the test code (as below), it is conclusive that only the colon LEDs are present, not any of the decimal points. The colon LEDs are both attached to the second digit from the left (try the code!). Having them in parallel means they share the current as I explained before.

How do we know there are no "secret" decimal points? Well, it is a twelve pin display; eight segments including the decimal plus four digit lines; no free pins. So while it is noted that the library (the one in the IDE) may be limited to controlling four digits, unlike the Adafruit design with the fifth digit, there simply cannot be one.

I am calling the case closed. :grinning:

[code]
#include <Arduino.h>
#include <TM1637Display.h>

// Module connection pins (Digital Pins)
#define CLK 2
#define DIO 3

// The amount of time (in milliseconds) between tests
#define TEST_DELAY   2000

const uint8_t SEG_DONE[] = {
  SEG_B | SEG_C | SEG_D | SEG_E | SEG_G,           // d
  SEG_C | SEG_D | SEG_E | SEG_G,                   // o
  SEG_C | SEG_E | SEG_G,                           // n
  SEG_A | SEG_D | SEG_E | SEG_F | SEG_G            // E
};

TM1637Display display(CLK, DIO);

int k;
uint8_t data[] = { 0xff, 0xff, 0xff, 0xff };
uint8_t blank[] = { 0x00, 0x00, 0x00, 0x00 };

void wipe() {
  display.clear();
  for (k = 0; k < 4; k++)
    data[k] = 0x00;
}

void setup()
{
}

void loop()
{
  display.setBrightness(0x0f);

  // All segments on
  display.setSegments(data);
  delay(TEST_DELAY);

  // Selectively set different digits
  data[0] = display.encodeDigit(0);
  data[1] = display.encodeDigit(1);
  data[2] = display.encodeDigit(2);
  data[3] = display.encodeDigit(3);
  display.setSegments(data);
  delay(TEST_DELAY);

  /*
    for(k = 3; k >= 0; k--) {
    display.setSegments(data, 1, k);
    delay(TEST_DELAY);
    }
  */

  display.clear();
  display.setSegments(data + 2, 2, 2);
  delay(TEST_DELAY);

  display.clear();
  display.setSegments(data + 2, 2, 1);
  delay(TEST_DELAY);

  display.clear();
  display.setSegments(data + 1, 3, 1);
  delay(TEST_DELAY);


  // Show decimal numbers with/without leading zeros
  display.showNumberDec(0, false); // Expect: ___0
  delay(TEST_DELAY);
  display.showNumberDec(0, true);  // Expect: 0000
  delay(TEST_DELAY);
  display.showNumberDec(1, false); // Expect: ___1
  delay(TEST_DELAY);
  display.showNumberDec(1, true);  // Expect: 0001
  delay(TEST_DELAY);
  display.showNumberDec(301, false); // Expect: _301
  delay(TEST_DELAY);
  display.showNumberDec(301, true); // Expect: 0301
  delay(TEST_DELAY);
  wipe();
  display.showNumberDec(14, false, 2, 1); // Expect: _14_
  delay(TEST_DELAY);
  wipe();
  display.showNumberDec(4, true, 2, 2);  // Expect: 04__
  delay(TEST_DELAY);
  display.showNumberDec(-1, false);  // Expect: __-1
  delay(TEST_DELAY);
  display.showNumberDec(-12);        // Expect: _-12
  delay(TEST_DELAY);
  display.showNumberDec(-999);       // Expect: -999
  delay(TEST_DELAY);
  wipe();
  display.showNumberDec(-5, false, 3, 0); // Expect: _-5_
  delay(TEST_DELAY);
  display.showNumberHexEx(0xf1af);        // Expect: f1Af
  delay(TEST_DELAY);
  display.showNumberHexEx(0x2c);          // Expect: __2C
  delay(TEST_DELAY);
  display.showNumberHexEx(0xd1, 0, true); // Expect: 00d1
  delay(TEST_DELAY);
  wipe();
  display.showNumberHexEx(0xd1, 0, true, 2); // Expect: d1__
  delay(TEST_DELAY);

  // Run through all the dots
  for (k = 0; k <= 4; k++) {
    display.showNumberDecEx(0, (0x80 >> k), true);
    delay(TEST_DELAY);
  }

  // Alternate run through all the dots
  wipe();
  data[0] = display.encodeDigit(0) + 0x80;
  display.setSegments(data);
  delay(TEST_DELAY);
  wipe();
  data[1] = display.encodeDigit(1) + 0x80;
  display.setSegments(data);
  delay(TEST_DELAY);
  wipe();
  data[2] = display.encodeDigit(2) + 0x80;
  display.setSegments(data);
  delay(TEST_DELAY);
  wipe();
  data[3] = display.encodeDigit(3) + 0x80;
  display.setSegments(data);
  delay(TEST_DELAY);


  for (k = 0; k <= 4; k++) {
    display.showNumberDecEx(0, (0x80 >> k), true);
    delay(TEST_DELAY);
  }

  // Brightness Test
  for (k = 0; k < 4; k++)
    data[k] = 0xff;
  for (k = 0; k < 7; k++) {
    display.setBrightness(k);
    display.setSegments(data);
    delay(TEST_DELAY);
  }

  // On/Off test
  for (k = 0; k < 4; k++) {
    display.setBrightness(7, false);  // Turn off
    display.setSegments(data);
    delay(TEST_DELAY);
    display.setBrightness(7, true); // Turn on
    display.setSegments(data);
    delay(TEST_DELAY);
  }


  // Done!
  display.setSegments(SEG_DONE);

  while (1);
}

[/code]

Paul__B:
the two capacitors adjacent to the two pull-up resistors are the wrong value and must be removed. ... I tested one capacitor (after losing the first) with my Ardutester to confirm that it was indeed, a useless value of 10 nF.

My apologies for a late reply, but I'm having trouble with these two statements. Why are they useless at 10nF? And even if so, why must they be removed?

The capacitors screw up the signals, the circuit was poorly designed.

Get rid of them.

fdamstra:
My apologies for a late reply, but I'm having trouble with these two statements. Why are they useless at 10nF? And even if so, why must they be removed?

Sorry, did I not explain this before? Perhaps I did in another thread. :sunglasses:

The TM1637 datasheet cites 100 pF capacitors to suppress transients on the data lines if they are of excessive length. This is a value comparable to the input capacitance of an IC - perhaps ten or twenty times as much and thus well within the drive capability of most logic circuits.

Using a value one hundred times as much again grossly distorts the timing of the high speed data resulting in erratic behaviour that may work in one configuration but not in others. The 100 pF capacitors are not necessary in most situations so entirely removing the wrong capacitors will work in most cases - but do not use too long a cabling between Arduino and the display.

So "useless" in the respect that they do nothing beneficial but almost always harmful. :astonished:

I had ordered one TM1637 and as i was writing a library for the display, noticed that the dots didn't answer when i expectly gave them power. I then checked on the website and it seems SOME support the dot and others support the colon.

I don't understand why the have the useless Key scan feature, when they could have created a nice, simple and full functionning display.