Inspired by Martin's excellent Arduino RTC programmer (see https://flowcode.co.uk/forums/viewtopic.php?f=9&t=1026) and feeling that a PC and an Arduino was overkill for setting a RTC chip...
I came up with the ESP Time Machine(tm)
The idea is that the DS3231 board can be popped into a breadboard - power is applied and the ESP32 gets the time from an SNTP server - and programs the RTC
I couldn't get the ESP32 clock component to work see my comment in bugs (though now I see how to do it using Stefan's example in the forum) - however I've kept my own code as it lets me flash an LED whilst waiting for the SNTP sync and also means the component isn't required... I also used my own DS3231 component (modified to use transactions)
I haven't handled DST / BST- though the code does show how to retrieve it if needed...
Th prototype - I have two LEDs one for 'connection' and one for SNTP sync. I'd be tempted to add a 3rd (error) red LED to light if it can't connect to wi-fi. It outputs the time to UART after programming - though this is probably unnecessary as it id intended to program RTCs for other projects. The ESP32 board doesn't sit well on the breadboard - but I'd envision it in a 'custom' case with a (labelled) socket for the RTC board.
You'll need to set SSID and Password.... I was also tempted to do without resistors for the LEDs and use the ESP32 pullups instead (keep the project cost down !)
One oddity - adding the DS3231 component doubles the i2c address - need to set to 104 (which had me scratching my head for a while)
Martin
DS3231 Programmer ESP32
-
- Valued Contributor
- Posts: 938
- http://meble-kuchenne.info.pl
- Joined: Wed Dec 09, 2020 9:37 pm
- Has thanked: 104 times
- Been thanked: 502 times
-
- Matrix Staff
- Posts: 1432
- Joined: Wed Dec 02, 2020 11:07 pm
- Has thanked: 506 times
- Been thanked: 468 times
Re: DS3231 Programmer ESP32
Hi Martin.
Thank you for an excellent project.
The more choices to do the same thing the better.
Thank you for an excellent project.
The more choices to do the same thing the better.
The Flowcode version currently uses transactions so it should work with ESP32/ST ARM.
Martin
-
- Valued Contributor
- Posts: 938
- Joined: Wed Dec 09, 2020 9:37 pm
- Has thanked: 104 times
- Been thanked: 502 times
Re: DS3231 Programmer ESP32
Thanks Martin
The i2c on esp32 had me stumped for a while - SDA and SCL can be selected to any (or nearly any?) pin - however unless you use the 'correct' pins then the esp32 throws an 'i2c driver isn't installed' error..
Martin
Yes - I just wanted to be 'component' lite...The Flowcode version currently uses transactions so it should work with ESP32/ST ARM.
The i2c on esp32 had me stumped for a while - SDA and SCL can be selected to any (or nearly any?) pin - however unless you use the 'correct' pins then the esp32 throws an 'i2c driver isn't installed' error..
Martin