Hey, Neil. Glad to have you back! I'm glad it helped you out, but remember if you get stuck to either shoot me an email or ping me on Social Media (Twitter or the YT community tab, preferably!).
ESP32 provides a very convenient core library (Preferences.h) which uses ESP32's NVS (non-Volatile Storage). It is even easier than accessing SPIFFs, and of course there is no need to reserve SPIFFs space. Unfortunately that is not available in the ESP8266
I was wondering how you set the Server up as an access point beforehand. Looking through your code, it doesn't seem obvious how you made the ESP enter station mode firs before even entering the function.
Hello thanks for the comprehensive tutorial. Is there any other way to set initial ssid and password without switching esp8266 as an AP first? I wonder why it's so easy to do this on plug and play devices on the market like Tuya smart devices.
Hello, thank you for the video and excellent work. I want to implement the same thing on ESP-Wroom-32 board. Would it work for it? The could won't compile for this board because the two library i.e. ESP8266WiFi.h and server library are not meant for this board. Can I use alternative libraries to achieve the same result? Thank you
Some additional info, because my AP did not show up on my network. (I had only 7 charachters in my password.) char* password = "YOUR_AP_PASSWORD"; (minimum of 8 characters. If not specified, the access point will be open (maximum 63 characters)) char* mySsid = "YOUR_AP_SSID"; (maximum of 31 characters) I find that using only 5 seconds might be a to low value, sometimes the nodeMCU connects to the STA and sometimes to the AP. if ((unsigned long)(millis() - startTime) >= 5000) break; Changing the value from 5000 to 10000 solved this problem for me. And if you dont want to be confused by what the WiFi.printDiag(Serial); spits out i added a new line: WiFi.disconnect();//Dissconnect from STA. (So that we not get the STA _ssid and _pass when displaying info from WiFi.printDiag(Serial); in AP mode). ACROBOTIC code: { WiFi.mode(WIFI_AP); WiFi.softAPConfig(local_ip, gateway, netmask); WiFi.softAP(mySsid, password); digitalWrite(pin_led,LOW); } MODIFIED code: { WiFi.disconnect(); //delay(1000);//Wait a bit for the nodeMCU to dissconnect from STA. (If needed). WiFi.mode(WIFI_AP); WiFi.softAPConfig(local_ip, gateway, netmask); WiFi.softAP(mySsid, password); digitalWrite(pin_led,LOW); }
Oh, thanks so much for sharing that info. I wouldn't have thought about that issue, I simply use 8+ character passwords by default. I'm glad you figured it out!
Thanks a lot for your awesome video, and would like to ask you about if you can make video about how to connect to nodemcu or esp8266 by both Wi-Fi and internet, i mean if you can to make video how to develop mobile app to control loads connected to esp8266 and we can control these loads by internet and Wi-Fi in the same app and the same code. I hope I explain what i want correctly.
Great videos :) I have a question related to the end of your video. If the user is connected to the AP on a phone and enters incorrect WIFI credentials on the given web page, how can the user be informed if they have entered something wrong. In my setup, I see the ESP8266 trying to connect to the WIFI but client dies before I see the status that e.g. the SSID cannot be found or the password is incorrect. Any advice would be appreciated... thanks
Do we have to update the Wemos to allow storing in the flash? I thought I saw that we need to add in a jar file to update the Wemos. I really appreciate your videos, they are a huge help to me👍👍👍
You don't have to. The .jar is to modify the Arduino IDE to have an option to send data to flash. However, you can also do it as shown in this video! Thanks for watching!
The soft AP is not turning off while I use on demand portal even when i set timeout. It happens only when I don't connect to that AP after I press that switch
Hugo Valente Yes, could this video please be updated using v6? It’s a great video and having it current would be a huge help. I’m having a bit of trouble learning v6 at the moment.
You can choose version 5 from the drop down list. Unfortunately, version 6 is not compatible with version 5, so I'll need to remake the video using version 6. Thanks for watching!
not quite yet, although i'm assuming the process is quite similar. i'll try to put it on top of my to-do list. thanks so much for watching, and for leaving a comment!
Hi, After few hours station mode automatically disconnect moves to AP mode and again after few minutes switched to station mode automatically. u have any idea why?
Not sure why. Try using Serial.print() statements to try and figure out where in the code the problems are occurring. The ESP8266 might be running out of memory and resetting itself after the code can no longer run.
Nice video .. there is a way to scan all the networks on the esp .. How is it possible to access this list with available networks on the webserver. (eg . in a dropdown list)
Thanks! A way to do this is using the HTML+JavScript code in this example. Once you get the networks, you put inside the string that's sent from the server (replace the "{status: ok" in this example}. Then, on the JavaScript side, you receive the data in the "xhr.responseText" attribute, and you can use additional JavaScript code to run a *for* loop, and create the elements on the page. HTH!
hi great content ACRO that's what i'm searching for a while for my project. I tried it on my NodeMCU but it won't change to STA mode. I debugged it a bit and found that the "/config.json" doens't exist. Do i need to create it in the filesystem?
hey, grasi. thanks for the kind words! the file should be created when you access your ESP8266's "/settings" path. once the file is created, then you can access the "/" path to do the update. the code can be changed so that the file is created even if you visit "/" first. hth!
Trying to do something similar on a ESP32... It'll connect fine with wifi details set by a hard coded string, but fails when using the JSON code presented here. But here's where it gets bizarre.... I assumed I'd done something wrong with the JSON data, so I stored the JSON results in different variables, and did a strcmp... JSON set variable is exactly the same as the hard coded string according to strcmp. But something about it is stopping the ESP32 from connecting.
I shoehorned your JSON code into my existing project... My guess is a did something wrong. I should try your entire code on my ESP32 and see how it reacts. Edit: Works fine with the Acrobotic example code. Obviously I've done something stupid in my code.
I am using a similar code along with wifi-manager for my use case, but I find my esp access point to be very unstable and it continuously gets disconnected in mobile or desktop even after multiple attempts of connecting it, can someone please help @acrobotic
Hi Acrobiotic ! Very intresting your videos... i'm trying to use httpupdate, but it downloads correctly, but after auto-restart i see trash on serial monitor. maybe some problems with programming flags and fuses ? any ideas ?
This is called "captive portal". You can do it yourself by issuing a server.send() after a client has connected to the AP. There's a built-in example that shows one way of doing it: github.com/esp8266/Arduino/blob/master/libraries/DNSServer/examples/CaptivePortalAdvanced/CaptivePortalAdvanced.ino HTH!
well, i am not sure about others but this time it was a bit confusing but at the end i totally got the idea i usually use the eeprom writing and readying another way like the stock example but this one was great too BTW this time reminds of something, can ya teach how to use dynamic urls to control each pin like 192.168.4.1/pin/"pin number"/state/"state 0 or 1" its bugging me for long time how to do this
I agree. When I was editing the video I realized that longer code examples like this one are harder to explain, and become confusing. I will add graphics next time to show better what each step of the code does! Thanks for your feedback as always!
On the dynamic URLs bit, remember to never trust user supplied data... You'd never intentionally send it bad data, of course, but mistakes happen. Also, if you were to put the web interface on the public internet for some reason, even stuff like search engines crawling the page could send busted data.
Hola, cual seria la pagina que se mostraria o la funcionalidad que logramos, una vez que configuramos en forma correcta los datos del wifi? O faltaria codificar la opcion de una pagina para ese caso? Porque si no estoy conectado a la red del wemos, si ingreso a la IP 192.168.0.11 me muestra nuevamente la opcion de configurar los datos?
Buena pregunta, Manuel! Si, como viste el root path ("/") esta configurado para solo mostrar la opcion de introducir los datos. Tendriamos que agregar otro path para mostrar los que estan guardados. Yo lo haria, por ejemplo, agregando: server.on("/settings", HTTP_GET, handleSettingsDisplay); Solo por preferencia reutilizo el path "/settings" pero con un metodo distinto (HTTP_GET), que es el que usa el navegador por default. Tendria que definir tambien la funcion handleSettingsDisplay, por ejemplo: void handleSettingsDispla(){ ... server.send(200, "text/plain", STRING_CON_DATOS_GUARDADOS); } Ahora, cuando acceda con el navegador 192.168.0.11/settings voy a ver los datos guardados, y cuando acceda 192.168.0.11 voy a poder cambiarlos.
ACROBOTIC también podría ser una opción el detectar si estamos con wifi conectado y ahí mostrar otra página. Estoy ahora en algo así, pero con la finalidad de mostrar los datos capturados de sensores y mostrar el estado de los mismos. Uniendo un par de tus tutoriales
Si, me gusta dividir cada tarea en distintos videos para que no sean complicados y/o tediosos. Acceder por nombre: ua-cam.com/video/ewrF1LzrxH8/v-deo.html Y para mostrar otra pagina, en la funcion llamada cuando se accede al root path ("/") podes usar "if (WiFi.status() == WL_CONNECTED)" y en cada caso hacer un server.send() con paginas distintas.
@@datasith yeah, indeed. The other ones Audios are great. But let me say this: overall, your videos are absolutely absolutely great. Thanks for that. It has helped me tooo much.
Your content gets better every day! Keep up the good work!
Afonso, thanks for the kind words! As people say, practice does make things easier :)
I'm learning this from one month and today I got the correct detailed and step by step explained video thank so much ...
I have just started learning about hardware programming and Arduino and your tutorials are very helpful, thank you for making these tutorials
I'm super glad that you found them helpful, thanks so much for letting me know!
Thanks for being so thorough. You are the easiest to follow along. Great Job.
thanks for the kind words, gerrit! i'm glad you found the info useful!
Thanks mate. You answered a question that's been bugging me for a while.
Hey, Neil. Glad to have you back! I'm glad it helped you out, but remember if you get stuck to either shoot me an email or ping me on Social Media (Twitter or the YT community tab, preferably!).
Thank's for all what you are doing ... I am looking for this tutorial for a will ... thank's again
Thanks for the kind comment. I'm glad you found it useful!
Your video is by far the best I have seen. I love this. Thanks for your hard work.
Thanks so much, it's been a learning process for me as well to produce video content. It makes me happy you found it useful!
Thanks you so much brother. your doing great
I just subscribed your channel. Great work!!!
I thank you greatly for this video, it was exactly what I needed to adapt to my project, since I see you're form latin America too: Muchas Gracias!!!!
Excellent work!! Thank you so much for this tutorial.
You're great man!!! Thanks for this video!
Thanks so much for the kind comment. I'm glad you found the video useful!
Great video! Down and to the point! I appreciate that!
Very helpful, thanks. It would have taken me days to work that all out for myself.
Davvero complimenti. Bravo bravo bravo.
thank you for this video! this is what I've been looking. For my Capstone project. thank again. already liked and subscribed to your channel.
Oh, awesome! Thanks for the sub, I'm glad you found the content useful!
Great work
Well done!!!
i love you
Greatings from Colombia! 🇨🇴🇨🇴
Aguante Colombia! I'm glad the content was useful to you!
Awesome explanation... thanks bro !!
No worries, thanks for watching!
ESP32 provides a very convenient core library (Preferences.h) which uses ESP32's NVS (non-Volatile Storage). It is even easier than accessing SPIFFs, and of course there is no need to reserve SPIFFs space. Unfortunately that is not available in the ESP8266
Yup, ESP32 rocks! Thanks so much for watching, and for sharing the info!
It's very helpful. Thank you very much :)
I'm glad you found the content useful, thanks for watching!
obviamente que el mejor video lo iba a hacer un argentino
Thank you for your supporting. bro
Thank you for watching my vids, I'm glad your found them useful!
Greetings from Croatia. Thanks
Heya Darko from Croatia. Thanks so much for watching my vid!
But if you reboot ESP it will not reconnect to STA and will create AP as on first boot...
Awesome content.
Nice work .. :) thanks for sharing
Thank you, I'm glad you found it useful!
This is what I looking for , Thank you from Thaialnd
Awesome, Thailand! I'm glad you found it useful!
I was wondering how you set the Server up as an access point beforehand. Looking through your code, it doesn't seem obvious how you made the ESP enter station mode firs before even entering the function.
Hello thanks for the comprehensive tutorial.
Is there any other way to set initial ssid and password without switching esp8266 as an AP first?
I wonder why it's so easy to do this on plug and play devices on the market like Tuya smart devices.
Hello, thank you for the video and excellent work.
I want to implement the same thing on ESP-Wroom-32 board. Would it work for it? The could won't compile for this board because the two library i.e. ESP8266WiFi.h and server library are not meant for this board. Can I use alternative libraries to achieve the same result? Thank you
provide example of arduino esp8266 to use on the go wifi forwarded from home LAN router.
i'll add it to my to-do list. thanks for watching!
@@datasith to stream Amazon prime video from Arduino to public IP in Arduino with home router port forward, ommiting port 80, to direct TCP off grid
Some additional info, because my AP did not show up on my network. (I had only 7 charachters in my password.)
char* password = "YOUR_AP_PASSWORD";
(minimum of 8 characters. If not specified, the access point will be open (maximum 63 characters))
char* mySsid = "YOUR_AP_SSID";
(maximum of 31 characters)
I find that using only 5 seconds might be a to low value, sometimes the nodeMCU connects to the STA and sometimes to the AP.
if ((unsigned long)(millis() - startTime) >= 5000) break;
Changing the value from 5000 to 10000 solved this problem for me.
And if you dont want to be confused by what the WiFi.printDiag(Serial); spits out i added a new line:
WiFi.disconnect();//Dissconnect from STA. (So that we not get the STA _ssid and _pass when displaying info from WiFi.printDiag(Serial); in AP mode).
ACROBOTIC code:
{
WiFi.mode(WIFI_AP);
WiFi.softAPConfig(local_ip, gateway, netmask);
WiFi.softAP(mySsid, password);
digitalWrite(pin_led,LOW);
}
MODIFIED code:
{
WiFi.disconnect();
//delay(1000);//Wait a bit for the nodeMCU to dissconnect from STA. (If needed).
WiFi.mode(WIFI_AP);
WiFi.softAPConfig(local_ip, gateway, netmask);
WiFi.softAP(mySsid, password);
digitalWrite(pin_led,LOW);
}
Oh, thanks so much for sharing that info. I wouldn't have thought about that issue, I simply use 8+ character passwords by default. I'm glad you figured it out!
Thanks a lot for your awesome video, and would like to ask you about if you can make video about how to connect to nodemcu or esp8266 by both Wi-Fi and internet, i mean if you can to make video how to develop mobile app to control loads connected to esp8266 and we can control these loads by internet and Wi-Fi in the same app and the same code. I hope I explain what i want correctly.
Thank you for this tutorial
No worries, Kester. I'm happy you found it useful!
Programming the device looks good. How did you get started writing code for this device. examples
I need help to make a dongle with esp8266, if you know a suitable site or can guide me, I need help!
Great videos :) I have a question related to the end of your video. If the user is connected to the AP on a phone and enters incorrect WIFI credentials on the given web page, how can the user be informed if they have entered something wrong. In my setup, I see the ESP8266 trying to connect to the WIFI but client dies before I see the status that e.g. the SSID cannot be found or the password is incorrect. Any advice would be appreciated... thanks
Do we have to update the Wemos to allow storing in the flash? I thought I saw that we need to add in a jar file to update the Wemos. I really appreciate your videos, they are a huge help to me👍👍👍
You don't have to. The .jar is to modify the Arduino IDE to have an option to send data to flash. However, you can also do it as shown in this video! Thanks for watching!
The soft AP is not turning off while I use on demand portal even when i set timeout. It happens only when I don't connect to that AP after I press that switch
can you send me the code to support@acrobotic.com? i'll try to see what's the problem when i get a chance!
@@datasith i just sent. Kindly check
Does it work on Generic ESP8266 board ? I want to use it on esp-01 board.
How can i save Ip subnet or other things...
Same way. Convert it to a string, and put it in a file. HTH!
Arduino IDE is asking for a JSON V.6 is there any update available to solve this?
Hugo Valente Yes, could this video please be updated using v6? It’s a great video and having it current would be a huge help. I’m having a bit of trouble learning v6 at the moment.
You can choose version 5 from the drop down list. Unfortunately, version 6 is not compatible with version 5, so I'll need to remake the video using version 6. Thanks for watching!
YOU PERFECT.
Thank you, you perfect too!
Thanks for a great video, it was just what I was looking for, except I'm using an ESP32. Do you have a similar video for that? Best regards, AB
not quite yet, although i'm assuming the process is quite similar. i'll try to put it on top of my to-do list. thanks so much for watching, and for leaving a comment!
Hi, After few hours station mode automatically disconnect moves to AP mode and again after few minutes switched to station mode automatically. u have any idea why?
Not sure why. Try using Serial.print() statements to try and figure out where in the code the problems are occurring. The ESP8266 might be running out of memory and resetting itself after the code can no longer run.
Nice video .. there is a way to scan all the networks on the esp .. How is it possible to access this list with available networks on the webserver. (eg . in a dropdown list)
Thanks! A way to do this is using the HTML+JavScript code in this example. Once you get the networks, you put inside the string that's sent from the server (replace the "{status: ok" in this example}. Then, on the JavaScript side, you receive the data in the "xhr.responseText" attribute, and you can use additional JavaScript code to run a *for* loop, and create the elements on the page. HTH!
hi great content ACRO that's what i'm searching for a while for my project. I tried it on my NodeMCU but it won't change to STA mode. I debugged it a bit and found that the "/config.json" doens't exist. Do i need to create it in the filesystem?
hey, grasi. thanks for the kind words! the file should be created when you access your ESP8266's "/settings" path. once the file is created, then you can access the "/" path to do the update. the code can be changed so that the file is created even if you visit "/" first. hth!
Trying to do something similar on a ESP32... It'll connect fine with wifi details set by a hard coded string, but fails when using the JSON code presented here.
But here's where it gets bizarre.... I assumed I'd done something wrong with the JSON data, so I stored the JSON results in different variables, and did a strcmp... JSON set variable is exactly the same as the hard coded string according to strcmp. But something about it is stopping the ESP32 from connecting.
I shoehorned your JSON code into my existing project... My guess is a did something wrong.
I should try your entire code on my ESP32 and see how it reacts.
Edit: Works fine with the Acrobotic example code. Obviously I've done something stupid in my code.
Thanks for the follow-up. Glad it worked out! If you send me the original code, I can have a look (support@acrobotic.com)
@@datasith
It's fine... I'll learn more if I try to find the problem myself.
Hey how to connect it with blynk please reply as fast as possible...god bless you sir..i mean after this switching mode
I bet there are good guides that can be found by using Google. HTH!
hi acrobotic, i have a issue, i did a project with this video and it worked well but when the esp8266 reset, it can't open the file that i create
Make sure you're not formatting SPIFFS on reset (which can be done with SPIFFS.begin(true) for example). HTH!
I am using a similar code along with wifi-manager for my use case, but I find my esp access point to be very unstable and it continuously gets disconnected in mobile or desktop even after multiple attempts of connecting it, can someone please help @acrobotic
Check my reply to your other comment. Thanks for watching!
Hi Acrobiotic ! Very intresting your videos... i'm trying to use httpupdate, but it downloads correctly, but after auto-restart i see trash on serial monitor. maybe some problems with programming flags and fuses ? any ideas ?
Hi, I'm glad you found the videos interesting. Remember to set the "baud rate" to the correct number in the Serial Monitor.
How can we force the AP to automatically open the browser on that webpage. Thank you
This is called "captive portal". You can do it yourself by issuing a server.send() after a client has connected to the AP. There's a built-in example that shows one way of doing it: github.com/esp8266/Arduino/blob/master/libraries/DNSServer/examples/CaptivePortalAdvanced/CaptivePortalAdvanced.ino
HTH!
use mata in top of your webpage .
well, i am not sure about others but this time it was a bit confusing but at the end i totally got the idea
i usually use the eeprom writing and readying another way like the stock example but this one was great too
BTW
this time reminds of something, can ya teach how to use dynamic urls to control each pin
like 192.168.4.1/pin/"pin number"/state/"state 0 or 1"
its bugging me for long time how to do this
I agree. When I was editing the video I realized that longer code examples like this one are harder to explain, and become confusing. I will add graphics next time to show better what each step of the code does! Thanks for your feedback as always!
On the dynamic URLs bit, remember to never trust user supplied data... You'd never intentionally send it bad data, of course, but mistakes happen.
Also, if you were to put the web interface on the public internet for some reason, even stuff like search engines crawling the page could send busted data.
@@tin2001 well nice suggests
My goal is for local and just testing purpose and all i need a sample script to figure out
Good tips, thanks for sharing!
Hola, cual seria la pagina que se mostraria o la funcionalidad que logramos, una vez que configuramos en forma correcta los datos del wifi? O faltaria codificar la opcion de una pagina para ese caso?
Porque si no estoy conectado a la red del wemos, si ingreso a la IP 192.168.0.11 me muestra nuevamente la opcion de configurar los datos?
Buena pregunta, Manuel! Si, como viste el root path ("/") esta configurado para solo mostrar la opcion de introducir los datos. Tendriamos que agregar otro path para mostrar los que estan guardados. Yo lo haria, por ejemplo, agregando:
server.on("/settings", HTTP_GET, handleSettingsDisplay);
Solo por preferencia reutilizo el path "/settings" pero con un metodo distinto (HTTP_GET), que es el que usa el navegador por default. Tendria que definir tambien la funcion handleSettingsDisplay, por ejemplo:
void handleSettingsDispla(){
...
server.send(200, "text/plain", STRING_CON_DATOS_GUARDADOS);
}
Ahora, cuando acceda con el navegador 192.168.0.11/settings voy a ver los datos guardados, y cuando acceda 192.168.0.11 voy a poder cambiarlos.
ACROBOTIC también podría ser una opción el detectar si estamos con wifi conectado y ahí mostrar otra página.
Estoy ahora en algo así, pero con la finalidad de mostrar los datos capturados de sensores y mostrar el estado de los mismos. Uniendo un par de tus tutoriales
ACROBOTIC faltaría manejar el poder acceder por nombre y no ip, es más fácil pensando en un usuario final
Si, me gusta dividir cada tarea en distintos videos para que no sean complicados y/o tediosos.
Acceder por nombre: ua-cam.com/video/ewrF1LzrxH8/v-deo.html
Y para mostrar otra pagina, en la funcion llamada cuando se accede al root path ("/") podes usar "if (WiFi.status() == WL_CONNECTED)" y en cada caso hacer un server.send() con paginas distintas.
ACROBOTIC excelente Cisco. Muchas gracias.
horrible horrible audio :/ my ears exploded
sending thoughts and prayers to your ears.
I am sorry man, but your audio is really really horrible... it hurts my ears... no joke :/
Thank goodness this isn't the only video out there 🙏
@@datasith yeah, indeed. The other ones Audios are great. But let me say this: overall, your videos are absolutely absolutely great. Thanks for that. It has helped me tooo much.