After checking the forum it does not help me directly further. Or maybe I have not searched very well.
I have made a datalogger with a Pi Pico, SD card, sensor and DS3231 timer.
The script I have made is running from Thonny which delivers the pc system time (actual time) to the DS3231. The content of logfile is three colums with data. Actual Date, Actual time and sensordata.
The logfile has the right creationdate/time (seen in the Windows Explorer.
Then I upload the script as main.py to the Pi Pico in the logger. The content of the logfile is still correct (Actual date/Time en sensor data). The logfile has the right creationdate/time.
Now I unplug or disconnect the USB cable from the Pc and plug this cable in a 5V wall adapter, so the logger act as a standalone machine. The content of the logfile is still correct (Actual date/Time en sensor data). Now the logfile has a wrong creation date. It is 31-12-2020 00:00:00.
How can I repair that creation date? I have the correct Date and Time on board of the logger (DS3231) and I suppose that I must use some code to give the RTC in the Pi Pico the right (current) date/time before the logfile is created. I have also looked at https://docs.micropython.org/en/latest/ ... e.RTC.html
As a beginner this is a bit too hard for me, I can't grasp it.
Although it is a Pi Pico W I do not want to use the WIFI option. I like to use the DS3231 if possible.
Thank you for your help.
I have made a datalogger with a Pi Pico, SD card, sensor and DS3231 timer.
The script I have made is running from Thonny which delivers the pc system time (actual time) to the DS3231. The content of logfile is three colums with data. Actual Date, Actual time and sensordata.
The logfile has the right creationdate/time (seen in the Windows Explorer.
Then I upload the script as main.py to the Pi Pico in the logger. The content of the logfile is still correct (Actual date/Time en sensor data). The logfile has the right creationdate/time.
Now I unplug or disconnect the USB cable from the Pc and plug this cable in a 5V wall adapter, so the logger act as a standalone machine. The content of the logfile is still correct (Actual date/Time en sensor data). Now the logfile has a wrong creation date. It is 31-12-2020 00:00:00.
How can I repair that creation date? I have the correct Date and Time on board of the logger (DS3231) and I suppose that I must use some code to give the RTC in the Pi Pico the right (current) date/time before the logfile is created. I have also looked at https://docs.micropython.org/en/latest/ ... e.RTC.html
As a beginner this is a bit too hard for me, I can't grasp it.
Although it is a Pi Pico W I do not want to use the WIFI option. I like to use the DS3231 if possible.
Thank you for your help.
Statistics: Posted by user-10 — Fri Apr 25, 2025 12:54 pm