Keep WiFi Connection Alive with FreeRTOS Task (ESP32 + Arduino series)

Поделиться
HTML-код
  • Опубликовано: 31 дек 2024

Комментарии • 40

  • @piconano
    @piconano 3 года назад +5

    Loved your ESP32 FreeRTOS playlist.

  • @raspberrypi2475
    @raspberrypi2475 3 года назад +10

    Move the localIP() to a separate print statement (because its not actually a string)
    Serial.print("WiFi connected ");
    Serial.println(WiFi.localIP());
    The demo works in the video because it never uses this bit of the code, since its already connected.

  • @kellyanderson7115
    @kellyanderson7115 2 года назад +2

    Good demo. Always good to see examples of FreeRTOS. It helps convert the beginner to a more advanced level. In my case I can't see where breaking out the WiFi check into a thread would have any advantage and maybe has some disadvantages. At the top of my loop() I call an ensureNetworkConnection() and ensureMqttConnection(). That way I know the the connection should be good after those calls.
    void ensureNetworkConnection(void)
    {
    if ( WiFi.status() != WL_CONNECTED )
    connectNetwork();
    }

    • @kellyanderson7115
      @kellyanderson7115 2 года назад

      Where I did find a separate thread to be very useful was in controlling the color/blink rate of a NeoPixel that I use for status information. The NeoPixel color/blink is set based on an indoor air quality value which I set from the main loop and the NeoPixel control thread uses that to determine what to do. In this case the IAQ getter/setter uses a mutex.

  • @SamirRAMDANI-g6j
    @SamirRAMDANI-g6j Год назад

    It's a very good video ... but i have another point, i think the best way is to create registers for wifi connection.... when wifi connected we suspend the task (to free resources ...etc) and when the wifi is disconnected we resume our task.... i think it's better than keeping the task running for long time and event the wifi is connected.

  • @younesjeihouni
    @younesjeihouni Год назад

    Appreciate it, fantastic. Also thank you for your excellent explanation in an easily understandable manner.

  • @darktherapy
    @darktherapy 9 месяцев назад

    One thing to note. There’s 2 ADC’s on the esp32. ADC1 and ADC2. ADC2 cannot be used at the same time as using WiFi as they share resources. I found this out the hard way. Continuous spurious results using that ADC2 and WiFi.

  • @agah7885
    @agah7885 2 года назад

    Bro, You are the king!

  • @hansratzingerselbstandiger9786
    @hansratzingerselbstandiger9786 9 месяцев назад

    Thank you! Super explained and useful!

  • @tamnguyenac1268
    @tamnguyenac1268 Год назад +1

    I uploaded and found Guru Meditation Error: Core 0 panic'ed (LoadProhibited)Exception was unhandled, i tried to fix it but not success. Please help me fix it. I am very appreciate that.

  • @kleindavid9416
    @kleindavid9416 8 месяцев назад

    Thanks, great explanation!

  • @pellax
    @pellax 2 года назад

    This video was great, I subscribe inmediately.

  • @robertb7003
    @robertb7003 3 года назад +2

    @Simply Explained You were using VS Code right? How are you uploading to the board without the Arduino ide? Is there some extension that does this? Thanks

    • @simplyexplained
      @simplyexplained  3 года назад +2

      Yes, PlatformIO. Check the earlier videos in this series on how to set it up ;)

    • @robertb7003
      @robertb7003 3 года назад +1

      @@simplyexplained Ok, thanks. You have my sub with notifications

  • @bestofkings9793
    @bestofkings9793 Год назад

    Why does'nt it print out "Connected! and the IP address", you did not explain that. it just jumps straight to the "WiFi Still Connected".

  • @pottingermusic
    @pottingermusic 3 года назад

    Great video, many thanx. But i have one question. It seems that WiFi.begin() ends an active Wifi AP connection. In my case i want to have the AP of the ESP32 ALWAYS available and only if connection to Router gets lost, reconnect the STATION part. Is this possible or does Wifi.begin() automatically disconnect the active AP?

    • @pottingermusic
      @pottingermusic 3 года назад

      OK, got it: you must do a WiFi.reconnect() then the active AP is not disconnected. Only the STATION is reconnected.

  • @steveread4090
    @steveread4090 10 месяцев назад

    For some reason my ESP32 does not boot rather it continuously reboots and I do not know why? I have watched the video many times, started over and recreated the code from the video three times and tried multiple ESP32 boards. Oh, and I tried fixing the core to 0 then one with no change. I really want to use this but how do I fix this?

  • @MI-bm2yy
    @MI-bm2yy Год назад

    I am having an issue with the wifi:
    E (3446) wifi:Expected to init 4 rx buffer, actual is 1
    What to do in this case? I used xTaskCreatePinnedToCore but it made the whole code slow and it didn't connect to wifi either?

  • @fernandoi8958
    @fernandoi8958 2 года назад

    why use 'continue' instead of just going for an if-else approach? you even explained it like this... I think it would be better for readability purposes, but I might be wrong...

  • @andrisetianabrata
    @andrisetianabrata 3 года назад

    Ouuhhh i see. When i try before i see this video, i trying code some blynk connection without xTaskPinnedToCore its will stacked error. So if i put thats syntaks won't it crash again?

  • @tcl78
    @tcl78 3 года назад

    Why to use the WiFi Library do i have to run it on the same core of the Arduino library? Is it true for every library that uses the Arduino framework? For instance, if i use, say, an LCD display with a library developed for Arduino, do i have to make sure it works on the same core? How do i know if a library requires me to do this? Will this not be a problem if i have to use a single core everytime i use libraries from the Arduino framework even though my ESP32 has more cores? Is there a way to bypass this limitation? Is the Arduino framework even necessary? Aren't there native libraries for ESP32 that let me use the cores i like?

  • @ipatman
    @ipatman 2 года назад

    Is there anywhere to DL the code?

  • @svenfischer4557
    @svenfischer4557 Год назад +1

    Does anyone else also have problem to get this code running on an esp32-s3? I always get ESP Guru errors.

    • @syahmiizani757
      @syahmiizani757 Год назад

      I also had this problem when connecting to WiFi blynk, do you find any solution on how to solve the guru errors?

    • @marceloaguilarsanchez9414
      @marceloaguilarsanchez9414 Год назад

      The code worked perfectly in my esp32 NODEMCU

  • @mychannel-cm1ce
    @mychannel-cm1ce 3 года назад +3

    Esp idf already has a task that takes care of reconnection.

    • @Hercules159
      @Hercules159 3 года назад

      What if you have multi wifi - home network, mobile hotspot. will esp idf do it

  • @QAYWSXEDCCXYDSAEWQ
    @QAYWSXEDCCXYDSAEWQ 3 месяца назад +1

    Ok, late to the party; but copied this on a Seeed Studio and it simply crashes again and again complaining about a StackOverflow. I am not enjoying freeRTOS

    • @JanDahl
      @JanDahl 3 месяца назад

      The example working here is in VSCode with PlatformIO and ESP-IDF.

    • @QAYWSXEDCCXYDSAEWQ
      @QAYWSXEDCCXYDSAEWQ 3 месяца назад

      @@JanDahl PlatformIO and ESP-IDF do the same thing?

    • @JanDahl
      @JanDahl 3 месяца назад

      @@QAYWSXEDCCXYDSAEWQ You can use ESP-IDF without PlatformIO but not the other way 'round. They're different tools.