I am new to SBC and modules. I am sorry if this question is stupid. I bought a TM1637 (datasheet) that looks like below. It was marked as "for Arduino", but I thought Pi and Arduino uses the same modules. I tried to find tutorials for connecting it to Pi, but I could not find one, and the top result was connecting a similarly-looking module to a Pi. The tutor was connecting the data pin to the pin 3 (GPIO 2 - SDA) and the clock pin th the pin 5 (GPIO -SCL). I connected TM1637 like that.

enter image description here

Now, I expected I could display a number with a few simple lines of Python, but the search results were all for Arduino, and I have discovered that Arduino libraries cannot be used with Pi. After some more searching, I have found this Github library. I ran the example code but it did not work. I moved the data/clock pins to the Pin 38 (GPIO - PCM_DIN) and the Pin 40 (GPIO - PCM_DOUT) as the picture on the Github page, and then it worked.

Image on the Github page, not mine Image on the Github page, not mine

According to an existing answer, those pins are for "PCM is how uncompressed digital audio is encoded. ". So, my question is I must connect the TM1637 to Pin 38 and 40, not other GPIO pins? Or is it only because the programmer of the library wrote the the library in a particular way so that only those pins work? I am asking this because if the answer is the former, my plan of connecting multiple modules to a single Pi shall not be possible. I thought that since there are many GPIO pins, I could connect at least 4 or 5 modules, but there is only one "GPIO - PCM_DIN", so, for example, I could not connect two TM1637's to a single Pi.

  • First thing I would check is if that module is suitable for the 3.3v signals from the Pi as most Arduino boards use 5v signals. As for your question - no pins can be used for general signals - it’s just some are set for different protocols and may need some functions turning off. – user115418 Jul 16 '20 at 20:51

The github resource you have found has a line where your connection is defined. Check this one:

Display = tm1637.TM1637(CLK=21, DIO=20, brightness=1.0)

Now, let's check the connection - picture:


Please note the code saying CLK=21 and DIO=20 and two wires connected there. If you want to use other pins, for example GPIO2 and GPIO3 change them in the constructor's line, like below:

Display = tm1637.TM1637(CLK=3, DIO=2, brightness=1.0)

And - of course you have to change your wired connection to correspond to the code.
This will be possible, as you can see the github note (github page, below all pictures) saying:

Note: Most GPIO pins will work in place of the above pins (Such as DIN - GPIO 24 & CLK- GPIO 23)

Last note helpful in future: Do not worry now about PCM_DIN or SDA, CLK. This is the other PIN purpose, but before you can use it, you must configure the processor's output to work this way. For example, those two - GPIO2/SDA and GPIO3/SCL may be useful when you want to use your Raspberry Pi with any module with I2C interface, for example OLED display(with I2C interface) or INA219 (quantity of different modules is endless). Other useful interface is SPI, again: when you choosing the module, you check for specific interface. If you going to use your RPi more, you will find more info later.

For now, the most important is to use GPIO's in most basic way, and your TM1637 gives you this possibility.

Good luck!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.