RTC in ESP8266

Discussion about programs, libraries and tools that work with MicroPython. Mostly these are provided by a third party.
Target audience: All users and developers of MicroPython.
Post Reply
cyrano1960
Posts: 39
Joined: Fri Mar 29, 2019 7:08 pm

RTC in ESP8266

Post by cyrano1960 » Fri Apr 16, 2021 8:19 pm

I'm kind of at a loss at the moment... :oops:
usually it's like you need the RTC time and somehow it's not right, with me it's the other way round. My ESP8266 knows exactly what time it is, but I have no idea how it knows. I don't have wifi configured and it's only connected to the PC via the USB port, but after:

Code: Select all

from machine import RTC
rtc = RTC()
rtc.datetime()
he displays the correct data. How does it know? Could anybody help me... :roll:

kevinkk525
Posts: 969
Joined: Sat Feb 03, 2018 7:02 pm

Re: RTC in ESP8266

Post by kevinkk525 » Fri Apr 16, 2021 8:45 pm

If you use rshell to connect to the esp8266 then rshell sets the rtc to the PC time.
Kevin Köck
Micropython Smarthome Firmware (with Home-Assistant integration): https://github.com/kevinkk525/pysmartnode

cyrano1960
Posts: 39
Joined: Fri Mar 29, 2019 7:08 pm

Re: RTC in ESP8266

Post by cyrano1960 » Sat Apr 17, 2021 6:56 pm

Hi Kevin,

you hit the bull's eye. I tried it with putty and HTerm and there is a default start time displayed. I work with Thonny and that probably also sets the RTC from ESP to PC time. Thanks for your help.

Post Reply