DS3231 Programmer ESP32

Use this section to discuss your embedded Flowcode projects.
Post Reply
mnfisher
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

DS3231 Programmer ESP32

Post by mnfisher »

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...
IMG_20220122_201626.jpg
IMG_20220122_201626.jpg (206.77 KiB) Viewed 1772 times

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.
TimeMachine.fcfx
(18.16 KiB) Downloaded 125 times
DS3231.fcpx
(6.31 KiB) Downloaded 120 times
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

medelec35
Matrix Staff
Posts: 1432
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 506 times
Been thanked: 468 times

Re: DS3231 Programmer ESP32

Post by medelec35 »

Hi Martin.
Thank you for an excellent project.
The more choices to do the same thing the better.
mnfisher wrote:
Sat Jan 22, 2022 8:35 pm
I also used my own DS3231 component (modified to use transactions)
The Flowcode version currently uses transactions so it should work with ESP32/ST ARM.
Martin

mnfisher
Valued Contributor
Posts: 938
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 104 times
Been thanked: 502 times

Re: DS3231 Programmer ESP32

Post by mnfisher »

Thanks Martin
The Flowcode version currently uses transactions so it should work with ESP32/ST ARM.
Yes - I just wanted to be 'component' lite...

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

Post Reply