Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request: TM1616 #22

Closed
NickLplus opened this issue Jun 26, 2022 · 10 comments
Closed

Request: TM1616 #22

NickLplus opened this issue Jun 26, 2022 · 10 comments
Assignees
Labels
enhancement New feature or request

Comments

@NickLplus
Copy link

Could you please add support for TM1616 (CLK, STB, DIN, 7x4), somewhat similar to TM1620.

PDF (Chinese): http://www.titanmec.com/index.php/en/project/download/id/512.html

This chip is used in Gosund SW7 dual-channel dimmer (FCC certified it this March as 2APUZSW7), and I'm trying to control it through Tasmota.

@maxint-rd
Copy link
Owner

Hello @NickLplus ,

This morning I downloaded and translated the datasheet to take a closer look. From what I can see the TM1616 is a simplified variant of the regular TM16xx chips, indeed similar to the TM1620, but even simpler. As you already mentioned, it has the same control lines (DIN/CLK/STB) as TM1620, TM1638 and others, support for only 7 segments by 4 digits and like TM1620 it doesn't support button input.

Unfortunately I don't have these chips in my supply and ordering them would take several weeks or months. From what I can see, you should be able to use the TM1620 class, as long as you initialize it using 4 digits.

This is the regular constructor:
TM1620(byte dataPin, byte clockPin, byte strobePin, byte numDigits=TM1620_MAX_POS, boolean activateDisplay = true, byte intensity = 7);
The forth parameter specifies the number of digits. Using 4 will cause the chip to initialize in 7x4 mode. From what I read in the datasheet, all commands are the same as the TM1620. Although it only has one display mode, the TM1616 datasheet states that it still needs to be initialized by sending the proper mode command. The TM1620 constructor alread does this, albeit with a different default.

Could you please see if you can confirm this chip to work okay if you use the TM1620 class?
Please be so kind to test using the TM1620 class. You could use the TM16xx_setSegments example, if you modify it to use this initialisation:

#include <TM1620.h>
TM1620 module(8, 9, 7, 4);   // DIN=8, CLK=9, STB=7, 4 digits

If it works okay I can publish a TM1616 specific class, based on TM1620 with the proper default values.

@maxint-rd maxint-rd self-assigned this Jun 27, 2022
@maxint-rd maxint-rd added the enhancement New feature or request label Jun 27, 2022
@NickLplus
Copy link
Author

Thank you, I'm already working on it, setting 1620 as a reference for 1616, just as you suggested.

The way they use TM1616 in SW7 dimmer is to control two vertical bars, each bar being composed of 7 individual LEDs: https://m.media-amazon.com/images/I/61jJzf9crRL._AC_SL1500_.jpg

@maxint-rd
Copy link
Owner

I found the dimmer on Ali (for about 50 euros). It sounds like an interesting device to hack. I see that the led-bars are touch sensitive and used to display the level of dimming. Does it have an ESP8266 inside?

(BTW. Most TM16xx chips are made for 5V, but in my experiments they usually function fine at 3.3V (white and blue leds may require a bit higher voltage). I've tested many different displays on ESP8266 and they all work fine. For ESP32 there was an object initialization issue in one of the classes, for which a have a fix, but not definitive yet).

@NickLplus
Copy link
Author

NickLplus commented Jun 27, 2022

WiFi carrier board:
WiFi (CUCU-KK-C-V1.4 contains ESP8285) + TM1616 + 2 buttons + 2 pairs of LEDs under the buttons (each pair: red + blue) + 2 bars, each contains 7 individual green LEDs; buttons and red/blue LEDs are connected to ESP8285 directly.
Touch panel: controlled by touch processor 32F101H6S6 http://en.aptchip.com/Article/Equipment.aspx?cid=82&nid=26
Power board: 2 relays, one is HF49F9, 2 triacs RS08X06-D

Tasmotizing was a bit odd:
disconnected WiFi carrier board (one flat cable to power board, two flat cables to touch panel; flip the black latch vertically, pulled the cable)
used USB2Serial in 3.3V mode to connect to GND1, 3.3V, TX1, and RX1 pads on the WiFi carrier board
connected a button between IO1 pad and USB2Serial ground (yes, the pad is marked IO1)
pressed and hold the button
powered USB2Serial while holding the button
counted 5
released the button
now tasmotizer worked.

Price - I've bought it on Amazon for USD 19:
https://www.amazon.com/Smart-Compatible-Neutral-Required-Single-Pole/dp/B09K3HQPYG

@maxint-rd
Copy link
Owner

maxint-rd commented Jul 1, 2022

Hello @NickLplus , Thanks for the info. Can you tell me your findings? If the library works on the TM1616 with the suggested initialization, I can publish a modified version of it for this chip and add it to the readme.

@NickLplus
Copy link
Author

Not yet, the switch is a bit hard to experiment with. I'm waiting for TM1616 delivery, ali promised the end of this month.

@maxint-rd
Copy link
Owner

maxint-rd commented Jul 2, 2022

Allright, no rush... I just made an order for TM16xx chips that I don't have in my collection yet. I've included the TM1616, so I can test things myself. It will probably be a bit longer before I get those and before I have some spare time to experiment. I'm looking forward to see your findings.
Thank you for your contribution so far!

@maxint-rd
Copy link
Owner

Short update: I received the TM1616 chips. When I have time I will solder one to a breakout board, do some testing and report you my findings...

@maxint-rd
Copy link
Owner

Hello, today I soldered the TM1616 to a breakout board and tested it successfully on an ESP32, using the TM1620 diver class and the TM16xxDisplay_Print and TM16xxDisplay_ScrolledPrint examples.

I defined the display as suggested previously:

#include <TM1620.h>
TM1620 module(15, 27, 26, 4);   // DIN, CLK, STB, four digits

My conclusion is: YES! You can use the TM1620 class to successfully use a TM1616 chip.
The main difference between the TM1616 and the TM1620 is that TM1616 has only one display mode: 7 segments x 4 digits.
For now I've update the readme to reflect the outcome of this test, but I might implement a TM1616 specific class in the future to properly define its properties.

@maxint-rd
Copy link
Owner

Hello, today I published a TM1616 specific class as well as an English translation of the datasheet.
Having done that I will close this issue. Thank you for your suggestion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants