Connect ESP32 to WiFi - Step-By-Step Tutorial

Поділитися
Вставка
  • Опубліковано 2 гру 2024

КОМЕНТАРІ • 102

  • @ashokvannarath5155
    @ashokvannarath5155 2 роки тому +9

    One of the most comprehensive ESP tuto available "IN THIS PLANET EARTH". Thanks!

  • @erich7431
    @erich7431 2 роки тому +14

    keep up with the great work. As i already said in a previous video, one of the most comprehensive ESP tuto available on YT. Thanks!

  • @MarceloRodrigues-nr6ni
    @MarceloRodrigues-nr6ni 2 роки тому +3

    good night Tomasz
    I'm in Sao Paulo, Brazil. Trying to learn a little automation, your video was the first one I was able to watch and I was able to understand and also verify by the presentation of the screens that I am at least with the correct abiente, I will continue to follow your videos, Thank you very much.

  • @blehprojects5776
    @blehprojects5776 Рік тому +1

    Great video! I like how you explain what you’re doing in the code in plain english

  • @josealejandroorbechavarria6229
    @josealejandroorbechavarria6229 2 роки тому +1

    Thanks you for your videos, you teach very well, keep it up!!!
    I am from Mexico and my English is not good but your way of explaining and speaking are perfect, thanks to you I learn about ESP32 and English

  • @dave_dennis
    @dave_dennis 2 роки тому +5

    Thanks so much for another excellent video. I love the detail you go into. Just like in the beginning how you explain you click platform IO icon again to close and make more room on the screen. Anyone else would just click that and I would be left wondering how or why you did that. This is so helpful and most other YT tutorials skim over these details which are critical for someone new. I love your style Tomasz.

  • @indiumgalliumnitride5492
    @indiumgalliumnitride5492 Рік тому +2

    I like VSC and i hate the Arduino IDE, but the Arduino platform is really good for non commercial projects at home. VSC and the PlatformIO was exactly what i was looking for! Your explanations are easy step by step. Additionally the source code you have shown is able to be used directly in projects! Thank you so much!
    If someone is interested in my home project:
    I replaced the relay-based swimming pool control with a Siemens Logo. It was clear that with the water temperature the running time of the filter pump is automatically adjusted. Then also an outdoor temperature sensor was installed and i knew, that i need a HMI.
    At first i wanted to take a Raspberry Pi and PyQt because i have experience and with the Qt Designer i'm really fast and the python-snap7 for communicating with the logo works fine! But then i wanted a compact HMI with a small display and the indoor temperature and humidity should be measured with a BME280. So the ESP32 with the Arduino platform and Settimino to communicate with the logo should be the better option for this project!

  • @bobwtech
    @bobwtech 2 роки тому +3

    I am just about to try a ESP32 wifi board and this video was very helpful. I use VSC and PlatformIO, so it was directly relevant for me. Thanks for your work and I subscribed to your channel.

  • @zdenekspacek2845
    @zdenekspacek2845 5 місяців тому +1

    Thank you Tomasz for your amazing tutorial! It's long, but it is strait forward, its working and it is easy to follow. I learn from you to use VS and lot more! Thank you!! 👍👍

  • @vfd8165
    @vfd8165 19 днів тому

    Well explained and delivered excellently, looking for learning C# for my nephew.. and you are far most a great teacher!

  • @JohnJaggerJack
    @JohnJaggerJack Рік тому

    Thank you very much for this video, I now have a clear path for future wifi projects.

  • @handryraya2853
    @handryraya2853 2 роки тому +1

    Tq... I will follow all your tuts on esp32 and projects around esp32. 👍

  • @matiasgays4356
    @matiasgays4356 2 роки тому +1

    Very nice video Tomas. Greetings from Argentina

  • @balintweber4751
    @balintweber4751 Рік тому +1

    Great tutorial. I have an ESP32-WROOM-32E board, but I didn't find it in platformIO. I choosed the WROVER, but I haven' any LED too.
    The HelloWorld project worked, but here my ESP can not connect to my WIFI. It says "...run(): no matching wifi found", but the modem is 2 meters away.

  • @zyghom
    @zyghom 2 роки тому +2

    to minimise the connection time:
    1- assign static IP
    2- use static channel
    3- change delay to 20ms
    I am getting in average 200ms to get connected (since boot) with these settings - crucial for battery operated devices that go to sleep

  • @technohelp21
    @technohelp21 2 роки тому +1

    Another great video! This is very useful. Thank you!

  • @zandanshah
    @zandanshah 2 роки тому +2

    Super Thanks! just a stupid question, what do you mean by Blocking and Non-Blocking .. and which one is the best practice?

    • @kkoshar
      @kkoshar 2 роки тому +1

      I came to the comments with the same question. Which one should I use and why. Which one would be more effective if I'm running off a battery?

    • @tomasztarnowski4434
      @tomasztarnowski4434  2 роки тому

      Hi Zandan,
      Blocking means it won't execute any code that you placed past WiFi connection code in the setup function and the code in the loop function until it successfully connects to WiFi - we can call it synchronous way of connecting.
      Non-blocking is asynchronous which means it will execute all the code in the setup and then it'll keep calling the loop function continuously so you can run other operations while ESP32 is connecting to WiFi
      Order of execution for blocking approach:
      1. Call the code before while (wifiMulti.run() != WL_CONNECTED) { ... })
      2. Connect to WiFi and do only this. If it doesn't manage to connect keep trying don't do anything else.
      3. Call the rest of the code in the setup()
      4. Call the code in the loop() continuously
      for non-blocking:
      1. Call the code in the setup(), start connecting to WiFi in the background
      2. Call the code in the loop() continuously regardless whether ESP32 manages to connect or not

    • @tomasztarnowski4434
      @tomasztarnowski4434  2 роки тому

      Hi Katrina, in general I'd recommend non-blocking approach since you can run other operations simultaneously although if you run on battery you need to remember about adding some sort of timeout to your code after which ESP32 powers off if still not connected to WiFi
      main advantage of the blocking approach is simplicity - it's easier to keep track of synchronous code :)

  • @Sinnn777
    @Sinnn777 Місяць тому

    Thank you so much for this video - it has helped me solve a very frustrating problem!!

  • @gkhan753
    @gkhan753 2 роки тому +2

    Hey Tomasz, this is an excellent tutorial. I have been looking for something like this for months. Can you do a tutorial incorporating Javascript into this code. GREAT WORK EXPLAINING!

    • @tomasztarnowski4434
      @tomasztarnowski4434  2 роки тому

      Thanks, Gary! I'm glad my video helped you. I've got a project on my todo list to use TypeScript/JavaScript to program the board remotely :)

  • @raycarberry1089
    @raycarberry1089 Рік тому

    You're a legend Mate, thanks

  • @kno2843
    @kno2843 Рік тому

    Awesome, thanks!
    Well made explanation!

  • @Jey187
    @Jey187 5 місяців тому

    Man, thank you soooooo much! 🎉

  • @markusr.2115
    @markusr.2115 2 роки тому +1

    greatings from Germany ... I like your tutorials ... can you make one about reading a ntp server clock and switch a output

    • @tomasztarnowski4434
      @tomasztarnowski4434  2 роки тому +2

      hey Markus, thank you. NTP Server Clock Synchronisation is on my list of videos to make :)

  • @S--xc4rv
    @S--xc4rv Рік тому

    Is there any video of yours to connect esp32 with web page like react or html ??
    By the way great video

  • @robertszafirowski1795
    @robertszafirowski1795 2 роки тому +1

    Thank you for helpful video!

  • @noelminduin
    @noelminduin 2 роки тому +1

    Hello, thanks for the video, helps me alot. Can I make a question? Can you explain why esp8266 we don't need press de boot button and the esp32 need?

    • @tomasztarnowski4434
      @tomasztarnowski4434  2 роки тому

      Hey João, the reason is the way ESP32 has been designed - it now requires a button pressed to enter the BOOT mode whereas on ESP8266 it enters that mode automatically. You can solder/connect a capacitor to ESP32 to not have to press the BOOT button - it's explained here: randomnerdtutorials.com/solved-failed-to-connect-to-esp32-timed-out-waiting-for-packet-header/

  • @manjula_1
    @manjula_1 6 місяців тому

    Love From INDIA 💌🤟

  • @kevy1yt
    @kevy1yt 2 роки тому +1

    Very Nice. Thanks for posting.
    How scalable do you think this might be for a consumer product that might sell thousands or tens of thousands of units? It seems this implementation is really more for home hobbyists and Maker projects. No?

    • @tomasztarnowski4434
      @tomasztarnowski4434  2 роки тому

      Thank you🙏 . Very good question. I would say it depends on the product that you're building - I can imagine applying the Arduino framework in a consumer product given the code is properly tested and there are good quality insurance procedures in place (especially in highly competitive industries when the speed of development and rapid prototyping are important). However, if you need good task prioritization where time plays a critical role I'd suggest going for real-time operating system like FreeRTOS.

    • @kevy1yt
      @kevy1yt 2 роки тому +1

      @@tomasztarnowski4434 Thanks Tomasz! Can the Arduino framework be embedded in a custom design of thousands, real? Have you heard of anyone doing this at scale?

    • @tomasztarnowski4434
      @tomasztarnowski4434  2 роки тому

      There's lots of discussion about it around the internet but yes I think it can be. Have a look at this post on reddit: www.reddit.com/r/arduino/comments/iqrszs/using_arduino_framework_to_create_an/

  • @Mr_Ponzo
    @Mr_Ponzo 2 роки тому +1

    I really enjoy how you explain things. Keep the good work and thanks a lot for sharing with us.

  • @lawa9629
    @lawa9629 5 місяців тому

    very useful thanks💙

  • @pari1529
    @pari1529 2 роки тому +1

    hello, the serial monitor doesn't stop running and it doesn't show if wifi connected or it failed, can you give me your advice?

    • @tomasztarnowski4434
      @tomasztarnowski4434  2 роки тому

      hello, what do you mean by serial monitor doesn't stop running? does it print out anything? which method of connecting you're trying to apply? blocking or non-blocking?

  • @СергейВорончук-е5р
    @СергейВорончук-е5р 9 місяців тому

    Thanks for the good content!

  • @alex58326
    @alex58326 8 місяців тому

    Hi how can I receive data via the serial port in the form of bytes and display them on the screen
    help me please
    Nothing has worked for a week now

  • @vedoxg
    @vedoxg Рік тому +1

    Nice man, tnx

  • @3goldfinger
    @3goldfinger 11 місяців тому

    Is it the same for Bluetooth setup

  • @robertviens6104
    @robertviens6104 Рік тому

    OK, I don't see my ESP32 WROOM...what can I select that will/Could work in it's place? and where do I get this main.cpp file? Thanks

  • @ukaszkowalski725
    @ukaszkowalski725 2 роки тому +1

    Mam pytanie.
    Czy warunke w void setup jest nadrzędne, względem void loop?
    Czy dobrze zrozumiałem, że void loop nie było wykonane, dopóki pętla while, w void setup nie została wykonana?

    • @tomasztarnowski4434
      @tomasztarnowski4434  2 роки тому +1

      hey,
      tak dokładnie, żeby funkcja "loop" została wykonana wszystkie instrukcje w funkcji "setup" muszą być najpierw wykonane - w przypadku pierwszego sposobu jeżeli połączenie nie zostanie nawiązane to instrukcje w "loop" się nigdy nie odpalą

  • @rizmyabdulla
    @rizmyabdulla 2 роки тому +1

    Pleeeeeeease Upload More Tutorials❤❤❤

  • @sergeyivanov7636
    @sergeyivanov7636 Рік тому

    Напишу по русски. Спасибо, очень хорошее видео! Очень подробно.

  • @kaczkawil1
    @kaczkawil1 2 роки тому +1

    ja tak tylko chce powiedzieć ze Tomek... kurwa... uratowałeś mnie, dzięki za tutorial i na pewno jeszcze wrócę :D

  • @נדבלוי-כ5ב
    @נדבלוי-כ5ב Рік тому

    Amazing Thanks you 👏👏

  • @HiTo-kt4ve
    @HiTo-kt4ve 6 місяців тому

    Thank You dear

  • @samsaraAI2025
    @samsaraAI2025 2 роки тому +1

    All my code is Ok. I tried both methods and is not connecting.. Any idea. It says error (6)... It seems to be an interference with the DHT11 temp sensor which is conected to the pin D4. I dont understand why

    • @tomasztarnowski4434
      @tomasztarnowski4434  2 роки тому

      Does ESP32 connect to WiFi when DHT-11 is disconnected?

    • @samsaraAI2025
      @samsaraAI2025 2 роки тому +1

      @@tomasztarnowski4434 yes

    • @tomasztarnowski4434
      @tomasztarnowski4434  2 роки тому

      this might be related to the following issue:
      stackoverflow.com/questions/65125302/can-you-use-all-the-esp32s-gpio-pins-when-the-wifi-is-working
      can you try to connect DHT-11 to one of the ADC1 pins?

  • @kamikazeshibarushi8548
    @kamikazeshibarushi8548 2 роки тому +1

    I use the non-blocking method but it only shows "E (180970) wifi:Set status to INIT"

    • @tomasztarnowski4434
      @tomasztarnowski4434  2 роки тому +1

      hey, I've done a quick search and it might be either power source issue (not enough power supplied to the microcontroller) or there's too many devices connected to your network.
      Have a look at this conversation here:
      gitter.im/espressif/arduino-esp32?at=5cf7ed58faac64393445739f
      You can also try to add "WiFi.disconnect();" right before "WiFi.begin(..);"

  • @RixtronixLAB
    @RixtronixLAB 7 місяців тому

    Creative video, thanks :)

  • @66sebolek
    @66sebolek Рік тому

    Dlaczego w metodzie non-blocked nie korzystasz z funkcji AP?

  • @cedrikkaurit3078
    @cedrikkaurit3078 5 місяців тому

    Trying to get setup in VS and I am struggling with libraries. I get an error for "#include " that the file does not exist. I don't get how you just had it? I have had this issue with another tutorial as well, is there a mega pack of libraries I need to install somewhere?

    • @cedrikkaurit3078
      @cedrikkaurit3078 5 місяців тому

      ChatGPT helped me out here. I have an ESP8266 and in order to get it working I needed to add the appropriate lib_deps into the platformio.ini configuration file. So I added " lib_deps = ESP8266WiFi " - that got then accepted with no errors. Back in the main code I changed the include to "#include " and also corrected the instance: " ESP8266WiFiMulti wifiMulti; ". Then the errors cleared out and compilation was a success. Upload worked and connecting worked as well.
      I tried to search the tutorial again a few times but I think this part is missing from it or maybe in some cases the general "WiFiMulti.h" just works but in special cases you need to know to adjust some things.

    • @cedrikkaurit3078
      @cedrikkaurit3078 5 місяців тому

      I also had the same problem with "WiFi.h" it doesn't just work for me only by including it in the beginning of main. Then I consulted GPT again - it seems ESP8266 works different from ESP32 and I can only use the "ESP8266WiFiMulti.h" library which includes the "WiFi.h" functionality. The more you know.

  • @pasinduchandrasekara
    @pasinduchandrasekara Рік тому

    Thanks, nice one

  • @PDHiepp
    @PDHiepp 2 місяці тому

    my esp32 no cornect internet . because module fail or code ?

  • @ariqintea1272
    @ariqintea1272 6 місяців тому

    Help plis sir tutorial eyes teeny 4.0 Tft display 1.28inch

  • @ahmedibrahim1330
    @ahmedibrahim1330 Рік тому

    how do i install this library whats its name

  • @canoreyesmiguelangelingeni4365

    the flag Code mas very useful for me

  • @SebastianPachla73
    @SebastianPachla73 5 місяців тому

    Cześć. Dlaczego nie ma polskich napisów natywnie? :D Pozdro.

  • @borakececi8472
    @borakececi8472 Рік тому

    Thanks

  • @2012daffyduck
    @2012daffyduck Рік тому +1

    Is there a bluetooth step by step tutorial?

    • @tomasztarnowski4434
      @tomasztarnowski4434  Рік тому

      Not yet, but I'm going to make one.

    • @2012daffyduck
      @2012daffyduck Рік тому

      @@tomasztarnowski4434 if you make one, I'll name my first son after you!

  • @dantecant
    @dantecant 2 місяці тому

    Will connect ESP32 to WiFi work with Arduino?

  • @tomekzb7
    @tomekzb7 Рік тому

    Dobry program ale stary bardzo przydatna przydała by się poprawka nowej wersji

  • @AhmadMehraGohar
    @AhmadMehraGohar 2 роки тому +1

    hi

    • @tomasztarnowski4434
      @tomasztarnowski4434  2 роки тому

      hello 👋

    • @AhmadMehraGohar
      @AhmadMehraGohar 2 роки тому

      my visual code arduino runing problem

    • @tomasztarnowski4434
      @tomasztarnowski4434  2 роки тому

      can you describe the problem?

    • @AhmadMehraGohar
      @AhmadMehraGohar 2 роки тому

      sweet brother.
      visual code arduino not compile and
      error
      arduino extension..
      this extension has repeated (1 uncaught error)

    • @tomasztarnowski4434
      @tomasztarnowski4434  2 роки тому +1

      @@AhmadMehraGohar can you please create new issue here: github.com/ttarnowski/esp32-wifi-connect/issues/new
      and add detailed description of your problem (please explain all the steps you have done and attach screenshots/error messages) I need more information to help you :)

  • @Прогулкивокругсвета-ф2ю

    Странный акцент) Немного на индийский похож, но я так понимаю какой-то славянский язык твой родной?

  • @danielalejandroismael2536
    @danielalejandroismael2536 Рік тому

    arduino 🤮🤮🤮🤮🤮🤮🤮🤮🤮🤮🤮🤮

  • @raffi9436
    @raffi9436 Рік тому

    NEED HELP!
    I can't get this code running anymore. It worked a couple of times, but now the USB connection always crashes, even when I'm trying your simple examples. I figured out that it always crashes on the wifiMulti.addAP or WiFi.begin commands. When it crashes, the red LED on the ESP32 is flickering/dimming, and the USB symbol (I'm on Windows 10) in the taskbar is also flickering really fast.
    I tried reinstalling the USB driver a couple of times and tried different USB cables and USB ports. I also connected my ESP32 to a USB charger (because I read there may not be enough power through the USB port). Additionally, I tried changing the Wi-Fi mode via "WiFi.mode(WIFI_MODE_STA);" and changed the flash mode via "board_build.f_flash_mode = dio", but nothing worked.
    During several tries, I also had to factory reset a couple of times via "python -m esptool --chip esp32 erase_flash" because I couldn't upload any code anymore since the port couldn't be found by VSC. When I'm not calling the Wi-Fi commands mentioned above, the code runs just fine.
    Can someone please help me?

  • @yassineraoufrebei8810
    @yassineraoufrebei8810 Рік тому

    instead of have the "connected" message i have that message : [WIFI] no matching wifi found!
    what's the problem ?
    there is the code i'm compiling :
    #include
    #include
    #define WIFI_SSID "mywifi"
    #define WIFI_PASSWORD "1234567890"
    WiFiMulti wifiMulti;
    void setup() {
    Serial.begin(921600);
    pinMode(LED_BUILTIN,OUTPUT);
    wifiMulti.addAP(WIFI_SSID,WIFI_PASSWORD);
    while(wifiMulti.run() != WL_CONNECTED )
    {
    delay(100);
    }
    Serial.println("connected");
    }
    void loop() {
    digitalWrite(LED_BUILTIN, WiFi.status() == WL_CONNECTED);
    }
    is it normal ?