ESP32 Real Time Clock faild

Any bugs you encounter with Flowcode should be discussed here.
Post Reply
stefan.erni
Valued Contributor
Posts: 758
http://meble-kuchenne.info.pl
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 149 times
Been thanked: 171 times

ESP32 Real Time Clock faild

Post by stefan.erni »

Hi Ben

I would like to use the RTC of the ESP32 without wifi. But when I initialize the component I get a "failed"

regards

Stefan

ESP32 RTC
rtcc_2022-09-29_15-04-22.jpg
rtcc_2022-09-29_15-04-22.jpg (7.15 KiB) Viewed 1580 times

BenR
Matrix Staff
Posts: 1742
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 443 times
Been thanked: 604 times

Re: ESP32 Real Time Clock faild

Post by BenR »

Hi Stefan,

I beleive if you add the wifi component, even if you're not using it then hopefully that should allow the compilation to complete.

I'll investigate and see if there is a way to allow the build regardless.

stefan.erni
Valued Contributor
Posts: 758
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 149 times
Been thanked: 171 times

Re: ESP32 Real Time Clock faild

Post by stefan.erni »

Hi Ben

Yes with the wlan the RTC works.
I can also set the time with the server. All this is with Flowcode very easy to do

But with the wireless connection, the HX711 no longer works properly. Is there a way to do the waln like unconnect or can you add a dissconnectSSID command for the wlan.
That would be useful if you only need the wifi for a short time.

regards

Stefan

BenR
Matrix Staff
Posts: 1742
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 443 times
Been thanked: 604 times

Re: ESP32 Real Time Clock faild

Post by BenR »

Hi Stefan,

You can disable interrupts for a while on the ESP32 by using this in a C icon. Do you want to try adding this just before sampling the HX711 and hopefully that should solve the problem for you.

c code icon
portDISABLE_INTERRUPTS();

HX711 sample

c code icon
portENABLE_INTERRUPTS();

If it works for you then I'll put the code into the time critical part of the component.

stefan.erni
Valued Contributor
Posts: 758
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 149 times
Been thanked: 171 times

Re: ESP32 Real Time Clock faild

Post by stefan.erni »

Hi Ben

Unfortunately, disable interrupts is not an option for my program
this would be my wish...
Setting the time and date with WiFi, USB or Bluetooth
The time is set via Wlan:
If I press a button when starting up, it should turn on wifi and set the clock and date. Then the wifi should be turned off again. with an additional command disconnect SSI)

The time is set via USB or Bluetooth:
For this I wrote FC9 APP where it already works well. Sending the PC timeDate to the ESP32
with an additional command set TimeDate string while Wlan is turned of

read the time and date:
If the ESP32 starts normally I should be able to read the time and date. Just read one string is enough.
with an additional command get TimeDate string while Wlan is turned of

I will test if the ESP32 let the time run in deep sleep mode. Unfortunately I did not find a pin for an additional battery for RTCC


regards

Stefan

BenR
Matrix Staff
Posts: 1742
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 443 times
Been thanked: 604 times

Re: ESP32 Real Time Clock faild

Post by BenR »

Hi Stefan,

We can certainly look at adding a disconnect macro. Does the following C code do what you need?

Code: Select all

 esp_wifi_disconnect();
 esp_wifi_stop();
 esp_wifi_deinit();

stefan.erni
Valued Contributor
Posts: 758
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 149 times
Been thanked: 171 times

Re: ESP32 Real Time Clock faild

Post by stefan.erni »

Hi Ben

Yes it's working fine.

If the password is correct it's set the time (with 2hours offset)

If the password is bad it's set the time to 00:00:00 ( 2hours offset is set to 0)

Always the HX711 is working nice.

These 3 commands could also be useful for other applications, if it is not too complicated I would add them to the component.
But for me it's already perfect.


regards


Stefan
wlan_2022-10-12_15-34-01.png
wlan_2022-10-12_15-34-01.png (106.64 KiB) Viewed 1474 times

stefan.erni
Valued Contributor
Posts: 758
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 149 times
Been thanked: 171 times

Re: ESP32 Real Time Clock faild

Post by stefan.erni »

Hi Ben

One more reason to turn off the wifi when not in use.

A Board with Esp32, display various hardware and wlan connected, needs 165mA
If I do the commands to disconnect wlan, the board just needs 120mA

If I use a deepsleep command , the board needs 10mA and the clock(time) keeps running

But after a reset (power off), the time must be set again

regards

Stefan

Post Reply