Comments on: Getting Started with Thonny MicroPython (Python) IDE for ESP32 and ESP8266 https://randomnerdtutorials.com/getting-started-thonny-micropython-python-ide-esp32-esp8266/ Learn ESP8266, ESP32, Arduino, and Raspberry Pi Mon, 23 Mar 2026 16:26:44 +0000 hourly 1 https://wordpress.org/?v=6.8.5 By: Sara Santos https://randomnerdtutorials.com/getting-started-thonny-micropython-python-ide-esp32-esp8266/#comment-1171722 Mon, 23 Mar 2026 16:26:44 +0000 https://randomnerdtutorials.com/?p=80235#comment-1171722 In reply to Jos Wich.

Ok.
Thanks for sharing.
Yes. It works differently in CPython and MicroPython.
Regards,
Sara

]]>
By: Jos Wich https://randomnerdtutorials.com/getting-started-thonny-micropython-python-ide-esp32-esp8266/#comment-1171673 Mon, 23 Mar 2026 11:02:52 +0000 https://randomnerdtutorials.com/?p=80235#comment-1171673 Hi Sara,

yesterday I received the following reply from Aivar Annamaa on Github:

Are you referring to CPython returning a named tuple and MicroPython returning a regular tuple? That’s simply the way it is — there are several differences between CPython and MicroPython. Depending on MP version, even the order of the element may be different.

So, I will accept these limitations, especially as they are not really critical to me. And as usual, there are many ways to Rome……

Best regards

Jos

]]>
By: Sara Santos https://randomnerdtutorials.com/getting-started-thonny-micropython-python-ide-esp32-esp8266/#comment-1124120 Sat, 15 Nov 2025 11:15:17 +0000 https://randomnerdtutorials.com/?p=80235#comment-1124120 In reply to Jos Wich.

Thanks, then let me know.
Regards,
Sara

]]>
By: Jos Wich https://randomnerdtutorials.com/getting-started-thonny-micropython-python-ide-esp32-esp8266/#comment-1123898 Fri, 14 Nov 2025 18:16:08 +0000 https://randomnerdtutorials.com/?p=80235#comment-1123898 In reply to Sara Santos.

Thanks for your reply, Sara, really appreciated.

Still, getting time from the ntp server was not the problem. I’m fine with this. I just wanted to hear your comments if you have run into this RTC thing where the interpreter does something different than regular Python.

I’ll address this as a bug to the Thonny team and keep you informed as soon as I receive a reply.

For now, have a good weekend

Jos

]]>
By: Sara Santos https://randomnerdtutorials.com/getting-started-thonny-micropython-python-ide-esp32-esp8266/#comment-1123783 Fri, 14 Nov 2025 11:01:05 +0000 https://randomnerdtutorials.com/?p=80235#comment-1123783 In reply to Jos Wich.

Hi.
I think it might help you take a look at this example that I tested sometime ago for the Raspberry Pi Pico to keep the time correct.
https://gist.github.com/sarasantos/a97712a6e4f0db14c0aaf46c9e2fab2f

Regards,
Sara

]]>
By: Jos Wich https://randomnerdtutorials.com/getting-started-thonny-micropython-python-ide-esp32-esp8266/#comment-1123575 Thu, 13 Nov 2025 22:12:03 +0000 https://randomnerdtutorials.com/?p=80235#comment-1123575 In reply to Sara Santos.

and one more Sara, I am getting closer and closer:

my basic system is a Win11 pro, with an AMD Ryzen 5 5600 Processor , 32 Gb memory and lots of space on SSDs and hard drives
I can switch between this Win11 and other ubuntu Linux machines (Zorin 18 OS and Linux Mint 22) via the boot loader. I am running Thonny 4.1.7

The situation I have described in my earlier replies is identical on all three machines. If you select the “Local Python 3” interpreter the time difference is as described in the manuals:

import time
print (time.gmtime())
print (time.localtime())
time.struct_time(tm_year=2025, tm_mon=11, tm_mday=13, tm_hour=22, tm_min=0, tm_sec=22, tm_wday=3, tm_yday=317, tm_isdst=0)
time.struct_time(tm_year=2025, tm_mon=11, tm_mday=13, tm_hour=23, tm_min=0, tm_sec=22, tm_wday=3, tm_yday=317, tm_isdst=0)

However, as soon as you need to put your program on an ESP32, ESP8266 or Raspi Pi Pico the interpreter does something a little more different.

MicroPython v1.26.1 on 2025-09-11; ESP module with ESP8266

Type “help()” for more information.

import time
print (time.gmtime())
print (time.localtime())
(2025, 11, 13, 22, 2, 29, 3, 317)
(2025, 11, 13, 22, 2, 29, 3, 317)

I made one more test and decided to move away from the standard interpreter options, by deselecting the ticks on “synchronize device’s RTC” and also “Use local time in RTC”. Well,by calling NTP time to setup the RTC, it now takes the (time.gmtime()) as basis for the RTC, but then forgets my localtime ….

I don’t know what can be the next idea, I was hoping you, or Rui had run into this matter earlier. Or maybe that you have a hot line to Aivar Annamaa in Estonia….

for now, good night, sleep well, it has become late again

Best regards

Jos

]]>
By: Jos Wich https://randomnerdtutorials.com/getting-started-thonny-micropython-python-ide-esp32-esp8266/#comment-1123562 Thu, 13 Nov 2025 21:10:17 +0000 https://randomnerdtutorials.com/?p=80235#comment-1123562 In reply to Sara Santos.

One more for you Sara, also the Pi Pico interpreter has the same problem:

MPY: soft reboot
MicroPython v1.26.1 on 2025-09-11; Raspberry Pi Pico with RP2040

Type “help()” for more information.

import time
print (time.gmtime())
print (time.localtime())
(2025, 11, 13, 22, 8, 16, 3, 317)
(2025, 11, 13, 22, 8, 16, 3, 317)

]]>
By: Jos Wich https://randomnerdtutorials.com/getting-started-thonny-micropython-python-ide-esp32-esp8266/#comment-1123554 Thu, 13 Nov 2025 21:02:34 +0000 https://randomnerdtutorials.com/?p=80235#comment-1123554 In reply to Sara Santos.

that’s exactly what is bothering me, Sara. The docs say one thing, but the reality is different. As long as I run Thonny on my PC, it gets the time info from the hard wired router. But that is when Thonny uses “Local Python 3” interpreter and everything is fine.

When I need to save the file on a ESP32 or ESP8266, one interpreter option declares to “synchronize device’s RTC plus a tick in the options mentions to use “local time in RTC”

print (time.localtime())
(2025, 11, 13, 21, 36, 31, 3, 317)
print (time.gmtime())
(2025, 11, 13, 21, 36, 34, 3, 317)

But I cannot find an explanation where Micropython or the guys from Espressif deviate from the (time.gmtime()) definition…
Do you have a hot line to the guys from Thonny ?

Best regards (also to Rui,of course ;-)))

]]>
By: Sara Santos https://randomnerdtutorials.com/getting-started-thonny-micropython-python-ide-esp32-esp8266/#comment-1123458 Thu, 13 Nov 2025 16:46:44 +0000 https://randomnerdtutorials.com/?p=80235#comment-1123458 In reply to Jos Wich.

Hi.
The documentation mentions this “The gmtime() function returns a date-time tuple in UTC, and localtime() returns a date-time tuple in local time.”
Source: https://docs.micropython.org/en/latest/library/time.html#time.gmtime

Are you running Thonny IDE in which system? Does it have the time synchronized?

Regards,
Sara

]]>
By: Jos Wich https://randomnerdtutorials.com/getting-started-thonny-micropython-python-ide-esp32-esp8266/#comment-1122948 Wed, 12 Nov 2025 12:30:46 +0000 https://randomnerdtutorials.com/?p=80235#comment-1122948 Hi Sara, how are you ?

as a long time follower of your work, I have now gone back again to test my success with Thonny 4.1.7 using both Zorin OS 18 Core (which is based on Ubuntu) and Win11. Apart from having trouble to configure the tiny ESP-01 boards ( which is not the main problem today ), I would like to ask you if you have any suggestion why printing (time.gmtime()) and (time.localtime()) delivers the same result ?

import time
print (time.gmtime())
print (time.localtime())

For you in Portugal that is not a problem, but I live in Germany. And clearly there should be a difference of one hour, right ?

I have tested ESP8266 NodeMCU, ESP-12-E, ESP12-F and ESP32 mini D1. Any Idea ?

Best regards

Jos

]]>