3

I have a very simple setup which works fine with an Uno.

enter image description here

#include <SevenSegmentTM1637.h>
#include <SevenSegmentExtended.h>
const byte PIN_CLK = 2;
const byte PIN_DIO = 3;
SevenSegmentExtended display(PIN_CLK, PIN_DIO);
void setup() {
 Serial.begin(9600);
 display.begin();
 display.print(F("TEST"));
}
void loop() {}

When I use the very same setup with a Pro Mini (XCSOURCE ATMEGA 328P, 5V 16Mhz), the display doesn't light up. I get monitor outputs and can blink the onboard LED, but no reaction from the TM1637 display.

I get this output in the console:

�E%MA1e� 10001111
Acknowledged: 0
ADDR : 11000000
DATA0: 0
write byte: 84
ADDR : 11000000
DATA0: 1111000
write byte: 69
ADDR : 11000000
DATA0: 1111000
write byte: 83
ADDR : 11000000
DATA0: 1111000
write byte: 84
ADDR : 11000000
DATA0: 1111000

Does anyone have an idea how to debug or fix this?

asked Nov 29, 2016 at 0:01
7
  • Could you please post a schematic? Commented Nov 29, 2016 at 0:33
  • I just added it to my original question. Commented Nov 29, 2016 at 9:10
  • You haven't created the display object. Shouldn't you have a line somewhere that creates the object: SevenSegmentTM1637 display(PIN_CLK, PIN_DIO); Commented Nov 30, 2016 at 18:45
  • Yes, sorry. I forgot to copy that in. I edited the question now. Commented Dec 1, 2016 at 9:04
  • What would be the output of the console on an UNO? Commented Dec 1, 2016 at 10:25

2 Answers 2

1
+100

Since you're using a Grove Display, I believe it will be using I2C.

For better debugging, try using the actual I2C pins on your Pro mini, which are A4 and A5.

I2C: A4 (SDA) and A5 (SCL). Support I2C (TWI) communication using the Wire library. https://www.arduino.cc/en/Main/ArduinoBoardProMini

I2C may need pull-up resistors on your data lines.

(https://en.wikipedia.org/wiki/I%C2%B2C)

It can also be nice to use "verified to be working" code, like example code from the manufacturer.

/*
 * TM1637.cpp
 * A library for the 4 digit display
 */
#include "TM1637.h"
#define CLK 39 //pins definitions for TM1637 and can be changed to other ports
#define DIO 38
TM1637 tm1637(CLK,DIO);
void setup()
{
 tm1637.init();
 tm1637.set(BRIGHT_TYPICAL);//BRIGHT_TYPICAL = 2,BRIGHT_DARKEST = 0,BRIGHTEST = 7;
}
void loop()
{
 int8_t NumTab[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};//0~9,A,b,C,d,E,F
 int8_t ListDisp[4];
 unsigned char i = 0;
 unsigned char count = 0;
 delay(150);
 while(1)
 {
 i = count;
 count ++;
 if(count == sizeof(NumTab)) count = 0;
 for(unsigned char BitSelect = 0;BitSelect < 4;BitSelect ++)
 {
 ListDisp[BitSelect] = NumTab[i];
 i ++;
 if(i == sizeof(NumTab)) i = 0;
 }
 tm1637.display(0,ListDisp[0]);
 tm1637.display(1,ListDisp[1]);
 tm1637.display(2,ListDisp[2]);
 tm1637.display(3,ListDisp[3]);
 delay(300);
 }
}

You will need to adapt the pin numbers.

But after these steps it should work just fine.

Source: http://wiki.seeed.cc/Grove-4-Digit_Display/

answered Dec 1, 2016 at 10:22
10
  • 1
    You will need pullups resistors 4.7K are normally a good value. Commented Dec 1, 2016 at 13:13
  • Your answer is false, the TM1637 uses CLK and DIO not I2C. playground.arduino.cc/Main/TM1637 Commented Dec 1, 2016 at 15:36
  • olimex.cl/website_MCI/static/documents/Datasheet_TM1637.pdf The wiring does show the pull-ups. And a note on the datasheet includes: "Microprocessor data realize the communication with TM1637 by means of two–wire bus interface (Note: The communication method is not equal to 12C bus protocol totally because there is no slave address)". So I believe that, in hardware it's I2C but not completely in software. But it indeed appears that you can put it on any of the pins. Commented Dec 1, 2016 at 15:43
  • I'm actually unsure if the pull-ups are on the board already. And it seems to work with regular pins aswel, but then again, there also is a software I2C library. But if it doesn't work, I would use the hardware-wise method. Commented Dec 1, 2016 at 15:48
  • Holy s***. The pins A4 and A5 really are the solution. Commented Dec 1, 2016 at 19:31
0

4.7k resistors on 2 and 3 pins does not help.

Works great if the tm1637 directly connected to 12 and 13 pins.

answered Jan 28, 2017 at 17:32

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.