g0hjq / lcd_nixie_clock

Pseudo Nixie LCD clock in Micropython for the Waveshare kit and Pi Pico
MIT License
3 stars 5 forks source link

Time not ticking #6

Closed AFstache closed 1 month ago

AFstache commented 1 month ago

Just wondering why the time doesn't tick. Is it because I don't have a battery in/power going to the RTC? If so, that's an easy enough fix, and I noticed that in the readme pictures, you have wires attached to where the battery would be, just wondering if that's a requirement.

g0hjq commented 1 month ago

If I remember correctly, I'm using the 1Hz signal from the RTC chip as the timing signal, so yes, that's probably the issue. I didn't have the correct sized battery at the time so I attached wires to an external larger CR2032.

AFstache commented 1 month ago

Rog, once I get the clock home (been working on it at work in spare time) I'll connect it to my bench and give it a try. I'll comment again with the results.

Thank you for your help and good work. I'd been trying to reverse engineer the full python code for a while (again, spare time at work) to no avail.

g0hjq commented 1 month ago

I've just had a quick look at the code to refresh my memory, and yes, it does use the 1Hz RTC pulse to generate the timing signals.

There is an interrupt handler at line 17 of main.py which sets the global variable "tick" true once per second. Because it's an interrupt routine, I have kept it as simple and fast as possible.

Line 369 in main.py continually checks the "tick" global variable, and if set reads the current time from the RTC chip whenever it is true. If the RTC chip is not working, the clock will not either.

Please do let me know how you get on. If you've any questions about the code, please do ask.

  if tick:  # wait for the next 1 second tick            
        tick = False
        hr24,min,sec = RTC.Read_Time()
AFstache commented 1 month ago

I'm getting some weird voltage readings across the battery socket so I'm going to need to investigate further.