I just got a hold of an LED Clock that is driven by the TM1628 LED driver chip.
The clock board is VERY inaccurate. It looses about 15 to 20 seconds per day and find I have to adjust it after only a couple of weeks.
My plan is to program a PIC to use GPS time for accuracy. The PIC to GPS code has already been figured out and all I have to do is drive the LED display.
The cpu board that came with the clock is completely separate from the LED driver board. The two boards are connected by a convenient 5 pin ribbon cable with the following connections:
VCC ------> 5V (3.3V min)
GND------> GND
STB -------> Strobe (main difference between TM1628 and TM1637)
CLK -------> Clock
DIO -------> Data
It seems the only difference is the Strobe pin, being set to low before the write, then set back to high:
Here is a note I found on the used of the STROBE pin:
The strobe pin is used when sending data to the board – you set the strobe pin to LOW before you start sending data – one or more bytes – and then set the strobe pin back to HIGH.
thanks
Jeff
Last edit: Jeff Weinmann 2022-09-05
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Ok Another few days of staring at Datasheets and tinkering. I got the TM1628 to work, but it has a totally different mapping scheme the GCB and any existing library out there (Ardino) will not work.
Here is my first pass at getting a functional program working. I may plan a pcb board of my own with a button to change the hour to +- daylight savings / Time zone adjustment. Right now its hard coded for Eastern Standard time so i will have to modify in a few weeks.
It wasn't fun trying to get LEDs to light up. The project WAS fun once the pretty lights started flickering!
The GPS module is what makes this thing 'tick'. Once a GPS fix is attained very accurate times can be extracted from the GPS reports.
If anyone has a better method of converting UTC 24 hour time to Eastern (or any timezone) 12 hour time let me know. My brain cells ran out so I brute forced it.
This code will save me a button for adjusting for Daylight Savings Time in my area.
Most of the US observes Daylight Savings Time. It Starts Nov 6th and Ends March 13th. My UTC offset is -4 hours, so I convert this offset for my area, which is Eastern Standard Time. The conversion handles crossing over into the next day. So at 8pm my time Greenwich is at 12:am, or 00:00:00
So I derive the UTC time from the GPS sentence, and check to see if the current month/day timespan is within DST. If it is, I subtract 1 hour from UTC, so now I'm 5 hours behind. This is the code that handles DST:
'Get the time by finding 1st commaget_val("R","M","C",1)Hour=Val(Mid(DataStr,1,2))Minute=Val(Mid(DataStr,3,2))Second=Val(Mid(DataStr,5,2))'Get Date. Find the 9th comma in the stringget_val("R","M","C",9)Day=Val(Mid(DataStr,1,2))Month=Val(Mid(DataStr,3,2))Year=Val(Mid(DataStr,5,2))SelectCaseMonthCase12'December Fall backIfHour>0thenHour=Hour-1elseHour=23endifCase1'January Fall backIfHour>0thenHour=Hour-1elseHour=23endifCase2'February Fall backIfHour>0thenHour=Hour-1elseHour=23endifCase3IfDay<13then'DST Ends on March 13'Fall backIfHour>0thenHour=Hour-1elseHour=23endifendifcase11ifDay>=6then'DST Starts on Nov 6'Fall backIfHour>0thenHour=Hour-1elseHour=23endifendifendselect
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello Jeff, probably a bit late now you have the display lit up.
I am almost finished a new TM1638_OEM_Lib cloned from TM1637_OEM_Lib. (still in alpha/beta)
Its all working except for some of the subs with ComAnode display.
The Fixed address mode of the TM1628 looks the same as TM1638.
Anyway, I have attached a test program (its a simple clock), i just pulled a few subs from the TM1638 lib, it was quite easy as it has a very modular structure.
cheers
Toni.G
Buffer send sub...
SubtmSndBuf(OptionalInDig_pos=TM_DispLen,OptionalInNum_Digs=TM_DispLen,OptionalInDbuf()=TM_DispBuf)'' Common Cathode display, up to 8 digits - no segment transpose (Reg C0 bits 0-7 is digit 1)#IfndefCom_Anode' Com_CathodesetTM1638_STB0TM1638_WrVal(TMcmd2)' Fixed address mode 44hsetTM1638_STB1WaitTMdlyusForBufIndx=Dig_pos-(Num_Digs-1)toDig_possetTM1638_STB0TM1638_WrVal(TMaddr+(BufIndx-1)*2)' Digit addrTM1638_WrVal(DBuf(BufIndx))' Digit datasetTM1638_STB1WaitTMdlyusNexttmCtrlSnd#endifEndSub
Thanks for the code - I may check it out and test it when my PCB comes in. Right now my breadboard is serving up the time via GPS, and I don't want to mess with it while its working!
Attached is the PCB that will replace my breadboard and make my old clock a real appliance lol.
If it works as planned, I have 5 boards on order and can send you one for your project. I see the 1638 uses the STROBE line so I'm pretty sure you could use it in your projects.
The board is based on the PIC18F16Q40 so far a VERY versatile chip. It also has a Northern software programmer chip and will be able to program the PIC via the micro USB connection.
No buttons in my application. The clock did come with a PCB board with 3 buttons, but I've decided to go buttonless. My clock application is centered around data from a GPS module and I harded coded EST daylight savings right into code as I can sense dates as well as times.
ebay has a nice 1638 board to tinker with. I have to say my interest in this driver has greatly increased !
If you want to share your code, by all means that would be awesome for key sensing.
I had bought this clock a couple of years ago and to my surprise, the back comes off revealing the real time clock and MCU and the TM1628 is connected with just a ribbon cable. Now I have full control of the full display, but for now I'm just displaying 12hour time with the big segments:
The clock I have has a crystal that loses 15 seconds per day. The clock LEDS are sharp and crisp, and the black background really looks nice by a TV in the dark. maybe i'll look for a bunch of these wholesale just the shell!
Jeff
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
TM1638 Button Test code is nearly ready, will post a link.
Its great when we find hackable products to improve or repurpose. So many have such cheap/customized parts making it not viable.
Our local Tip-Shop won't sell anything electronic now, saying its e-waste, I argue it's not if someone can use it.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
I just got a hold of an LED Clock that is driven by the TM1628 LED driver chip.
The clock board is VERY inaccurate. It looses about 15 to 20 seconds per day and find I have to adjust it after only a couple of weeks.
My plan is to program a PIC to use GPS time for accuracy. The PIC to GPS code has already been figured out and all I have to do is drive the LED display.
The cpu board that came with the clock is completely separate from the LED driver board. The two boards are connected by a convenient 5 pin ribbon cable with the following connections:
VCC ------> 5V (3.3V min)
GND------> GND
STB -------> Strobe (main difference between TM1628 and TM1637)
CLK -------> Clock
DIO -------> Data
It seems the only difference is the Strobe pin, being set to low before the write, then set back to high:
Has anyone used the GCB and modified it for use with the STROBE PIN?
Here is my attempt at adding the Strobe :
Here is a note I found on the used of the STROBE pin:
thanks
Jeff
Last edit: Jeff Weinmann 2022-09-05
Ok Another few days of staring at Datasheets and tinkering. I got the TM1628 to work, but it has a totally different mapping scheme the GCB and any existing library out there (Ardino) will not work.
Here is my first pass at getting a functional program working. I may plan a pcb board of my own with a button to change the hour to +- daylight savings / Time zone adjustment. Right now its hard coded for Eastern Standard time so i will have to modify in a few weeks.
It wasn't fun trying to get LEDs to light up. The project WAS fun once the pretty lights started flickering!
The GPS module is what makes this thing 'tick'. Once a GPS fix is attained very accurate times can be extracted from the GPS reports.
If anyone has a better method of converting UTC 24 hour time to Eastern (or any timezone) 12 hour time let me know. My brain cells ran out so I brute forced it.
Thanks for reading !
Jeff
For anyone who may find this useful:
This code will save me a button for adjusting for Daylight Savings Time in my area.
Most of the US observes Daylight Savings Time. It Starts Nov 6th and Ends March 13th. My UTC offset is -4 hours, so I convert this offset for my area, which is Eastern Standard Time. The conversion handles crossing over into the next day. So at 8pm my time Greenwich is at 12:am, or 00:00:00
So I derive the UTC time from the GPS sentence, and check to see if the current month/day timespan is within DST. If it is, I subtract 1 hour from UTC, so now I'm 5 hours behind. This is the code that handles DST:
Hello Jeff, probably a bit late now you have the display lit up.
I am almost finished a new TM1638_OEM_Lib cloned from TM1637_OEM_Lib. (still in alpha/beta)
Its all working except for some of the subs with ComAnode display.
The Fixed address mode of the TM1628 looks the same as TM1638.
Anyway, I have attached a test program (its a simple clock), i just pulled a few subs from the TM1638 lib, it was quite easy as it has a very modular structure.
cheers
Toni.G
Buffer send sub...
Last edit: ToniG 2022-09-10
Toni.G,
Thanks for the code - I may check it out and test it when my PCB comes in. Right now my breadboard is serving up the time via GPS, and I don't want to mess with it while its working!
Attached is the PCB that will replace my breadboard and make my old clock a real appliance lol.
If it works as planned, I have 5 boards on order and can send you one for your project. I see the 1638 uses the STROBE line so I'm pretty sure you could use it in your projects.
The board is based on the PIC18F16Q40 so far a VERY versatile chip. It also has a Northern software programmer chip and will be able to program the PIC via the micro USB connection.
thanks again!
Are you reading buttons from 18F pins or TM key inputs?
I have got some code working for TM1638 buttons & it should work for TM1628.
No buttons in my application. The clock did come with a PCB board with 3 buttons, but I've decided to go buttonless. My clock application is centered around data from a GPS module and I harded coded EST daylight savings right into code as I can sense dates as well as times.
ebay has a nice 1638 board to tinker with. I have to say my interest in this driver has greatly increased !
https://www.ebay.com/itm/155044572762?hash=item2419606e5a:g:jy0AAOSwMVhir-Cc&amdata=enc%3AAQAHAAAAkHldm4k%2BQCNiX25Nq3iDzW8CXHxpQ8Z3aUqKYWzseyIVVO9n2qThcQWQ5ISokCduTgd9bi%2BMMpqjF7x3QRR4mGB53CQux5xYg1LfZ4fuX2tONkL9KiEZuZVPiHIWmA6zAD0KwnzxGp0lfyA4h2qHLvHt5LXhaFbJua8pRI7ZgLuOvx5sqLYSCKUJWcVqAIUcYA%3D%3D%7Ctkp%3ABk9SR5D35rfmYA
If you want to share your code, by all means that would be awesome for key sensing.
I had bought this clock a couple of years ago and to my surprise, the back comes off revealing the real time clock and MCU and the TM1628 is connected with just a ribbon cable. Now I have full control of the full display, but for now I'm just displaying 12hour time with the big segments:
https://www.ebay.com/itm/403213552701?var=673297699900&hash=item5de1668c3d:g:xP8AAOSwRH1fB676&amdata=enc%3AAQAHAAAAoAt7z8zsX3UGx7JuWaySaelYGV3vOewXCUj6XBeUoYf5rrn7ff%2Bl24pxPYG0FMIwvuR1V7kc9Szt64%2Foga9YPDJrmlJMlX9gKvXMipiuKJVNNyj8G4tBAHpd46XiIavPm87Kl0%2BjIvE79huYLAoM9sYiehEbSe52AHxmECXNhQHtHezZuPXSQCwbqShTZoVfGXIaVN5vxSqfaIKXuGfLyh8%3D%7Ctkp%3ABk9SR_TC9rfmYA
The clock I have has a crystal that loses 15 seconds per day. The clock LEDS are sharp and crisp, and the black background really looks nice by a TV in the dark. maybe i'll look for a bunch of these wholesale just the shell!
Jeff
TM1638 Button Test code is nearly ready, will post a link.
Its great when we find hackable products to improve or repurpose. So many have such cheap/customized parts making it not viable.
Our local Tip-Shop won't sell anything electronic now, saying its e-waste, I argue it's not if someone can use it.
TM1638 Button code is here, you can try it when you get your new TM1638 board.
The full TM1638_OEM library should be ready soon...