#258
Simple introduction to web-enabling your ESP32 (or ESP8266).
► PCBWay $5 for 10 pieces www.pcbway.com
► 1. Introduction
Using the Arduino IDE 2.0.x available here bit.ly/Arduino... or Visual Studio Code (PlatformIO)
Many more details including pictures, code and more:
bit.ly/Web_Ena...
► 2a. Installing the libraries (Arduino method)
--------------------------------------------------------------------------
Go to the following GitHub site github.com/me-... and download the following libraries:
1. ESPAsyncWebServer
2. AsyncTCP (if you are using ESP8266 download ESPsyncTCP instead)
Go to the following GitHub site github.com/ayu... and download the following library:
1. AsyncElegantOTA (same library for ESP32 & ESP8266)
They will download as ZIP files with the suffix "-master". Ignore all that! Just remember where you downloaded them to!
Go to the Arduino IDE and click Sketch➡️Include Library➡️Add.ZIP library and click the downloaded library ZIP files.
Done!
► 2b. Installing the libraries (PlatformIO method)
-------------------------------------------------------------------------------
Ensure your platformio.ini file includes the "lib_deps" entry:
lib_deps =
me-no-dev/AsyncTCP@^1.1.1
me-no-dev/ESP Async WebServer@^1.2.3
;github.com/me-...
ayushsharma82/AsyncElegantOTA@^2.2.7
► 3. All code and more for both environments is in the GitHub:
bit.ly/Web_Ena...
Easy: Just click the big green "CODE" button in the GitHub for this video and choose the ZIP file download to your PC. Then unzip and you have everything you might need!
► 4. ESP32 Tools settings (in the dropdown Tools menu in the Arduino IDE)
Click here for essential reading:
espressif-docs...
► List of all my videos
(Special thanks to Michael Kurt Vogel for compiling this)
bit.ly/KZreadV...
► If you like this video please give it a thumbs up, share it and if you're not already subscribed please consider doing so and joining me on my Arduinite (and other μControllers) journey
My channel, GitHub and blog are here:
------------------------------------------------------------------
• / ralphbacon
• ralphbacon.blog
• github.com/Ral...
• buymeacoffee.c...
------------------------------------------------------------------
My ABOUT page with email address: / ralphbacon
Пікірлер: 275
I just found the channel and have been watching and learning so much! I wish I would’ve found your insight 4 years ago when I first started my dive into the world of MCUs. You’re an amazing instructor. 🤘🏼🤘🏼 from Texas!
@RalphBacon
Жыл бұрын
You are so welcome! But where have you been? Well, now you've found me, so happy viewing!
Frog with the sunglasses is most hilarious - love the sense of humor !
@RalphBacon
Жыл бұрын
Such a bright screen! 🐸
The warnings about security make me chuckle. A lot of people don't even have a computer anymore so all they know is how to play games and interact socially on their cellphone and I feel the few that can hack into my network have bigger fish to fry. Near none of my 20 to 30 year old relatives have a computer now, because after spending 1000 on a cellphone, they don't want to spend another 1500 on a computer. As always Ralph, this one was informative and entertaining. Thanks.
@RalphBacon
Жыл бұрын
I totally agree with "... the few that can hack into my network have bigger fish to fry." Our home Wi-Fi networks are sort of secure to casual kiddie bedroom hackers but as real hackers can bring the British Post Office to its knees I'm guessing our home networks would be hacked in minutes!
For us newbies, the whiteboard is usually the best to "get the message" of what connects where, and what runs on what. Just a thought.
@RalphBacon
Жыл бұрын
After all this time, Jorgo, you cannot serious consider yourself a "newbie" any longer?!? 😉 Anyway, thanks for the feedback.
Your videos just seem to get better and better! really nicely explained, as always.
@RalphBacon
Жыл бұрын
Thank you very much! 👍
Welcome BACK(!) to you Mr. Bacon :)
@RalphBacon
Жыл бұрын
You got that right, Christian! 👍
Great timing. I am just starting a project where I can use this information. Thanks Ralph, great job as always.
@RalphBacon
Жыл бұрын
Obviously tailor-made just for you, SteveX!
Using the library ESPmDNS.h , you can access the ESP32 using a logical name: like "office" in the address rather than a bunch of numbers. It is so much easier and only requires a few extra lines of code.
@RalphBacon
Жыл бұрын
I must admit to editing my Windows 'hosts' file so I can access my ESP32 devices from my PC, but I've not used the ESPmDNS library (yet). I will take a look. Presumably, you must create a separate (additional) DNS resolver for your local network using this?
For as long as I can remember I have always configured the DHCP server to hand out the same IP to the same MAC address, unless it runs out of addresses. Makes life so much easier, and it allows the same code to be flashed to multiple devices without specifying the IP, gateway and DNS servers within the code.
@RalphBacon
Жыл бұрын
I do that too (belt and braces) but recently I've lapsed, secure in the knowledge that I don't need to touch my router; this static address is honoured and the router just leaves it alone. Of course, it's wise to tell the router to NOT use DCHP addresses in the range that you are now allocating static addresses. And don't forget to change the code (IP address) for each device. I've never forgotten that, not once. 🤥 What? No, really I 🤥 haven't. 😁😉
Thanks again. A tip for beginners. One thing I have found useful is to copy the path of the actual .ino file on my computer into the start of the .ino file, as a variable. I then print this variable out to the console when the program first runs. That way, as I tend to leave a number of ESP32s running for some time and tend to forget which file is actually running , at every reboot it is displayed on the console. This can of course be printed to a ver.html file, which I can call to verify which version of the code I am actually running. Hope it helps.
@RalphBacon
Жыл бұрын
Great way to track what's telling the information 👍
@TheUnofficialMaker
Жыл бұрын
i do this too!
Great video Ralph. I've pretty much given up on fancy displays, knobs, and switches on my ESP32 projects. I use the methods you've just described for controlling things: Webpages, WebSerial, and OTA. My current project is a Mailbox Monitor that uses ESP32 to connect to WiFi. Powered by Solar/tp4056/Lipo, it sleeps most of the time, but uses IR sensors to tell you when there's mail in the box. Opening the mailbox door wakes it up.
@RalphBacon
Жыл бұрын
Sounds perfect! In the UK we don't have mailboxes, as such. The postman must put all the letter through the letter-box, built into most front doors. But a sensor to detect something there would work too.
Please continue with the building of the landing page. I. love your videos.
@RalphBacon
Жыл бұрын
More to come! Part 2 already been thought about...
@U8uxa8SP
Жыл бұрын
@@RalphBacon great, thanks.
A clear and enough detailed tutorial over a great tool, the OTA. Thank you, sir.
@RalphBacon
Жыл бұрын
Glad it was helpful!
Your new Texan viewer is right. You’re a very good teacher. A little bit of British humour doesn’t go astray either. Cheers mate.
@RalphBacon
Жыл бұрын
Nice of you to say! We have to have some sort of sense of humour with all our rain! Tally-ho!
Your OTA update in this video and a previous one (better for ota) is the greatest thing since sliced bread. I do not change a thing and leave bee hives and all that in there. It reminds me who is king bee. Oh no. Queen? Oh well thanks Ralph. Keep us challenged.
@RalphBacon
Жыл бұрын
Thanks for sharing!
Ralph, thank you for the clear linking of the various aspects of this. You have a great knack for focusing on the key parts, well done!
@RalphBacon
Жыл бұрын
Glad it was helpful! Don't forget to watch Part 2, coming to a screen near you soon!
Great stuff, would be nice if you could extend the example with some variables.
@RalphBacon
Жыл бұрын
Yes, Part 2!
Yet again, another great video ! Please continue by adding some inputs (open relays) and outputs (temperature) to the web page. Maybe even some security to the inputs.
@RalphBacon
Жыл бұрын
Great suggestion!
great video! I was in a need of such few years back - but I got there - no issue. Next step: button on the web that will upload the firmware from the web server directly to ESP and will initiate update of the firmware. Or even better: sketch, that would check from time to time if the new version of the firmware exists on the server and if so, it would update automatically. Challenge?.... accepted? ;-)
@RalphBacon
Жыл бұрын
The problem is that 90% of all beginners could not configure a server if their lives depended on it. Even if they did get one up and running they could not fix it if (when) it goes wrong. Lots of suggestions like this but sometimes KISS rulz!
@zyghom
Жыл бұрын
@@RalphBacon oh, so challenge... refused ;-) Don't underestimate your audience ;) It can be hosted on AWS, Github or one command in docker
Incidentally, the page heading's title will go on your browser's tab so you can return to it if you go to another tab momentarily.
@RalphBacon
Жыл бұрын
Indeed it does, Byron, and I will show this in more detail in Part 2.
Very useful -- thanks. Every time I looked at implementing OTA, I turned back 'cos it was going to take ages to work out how to do it.
@RalphBacon
Жыл бұрын
Glad it helped! Well, will help, if you try it out. Remember, demo code in the GitHub.
Really nice ... I hate to go out in the field to update - so I'll try to make e general system to all my projects ! THX for sharing !👍
@RalphBacon
Жыл бұрын
Yes, it works well. Just don't upload code that hangs the device or you'll be connecting that USB cable again! Not that I've ever done that. 🤥Nope. 🤥Not me.
@17:00 OMG! I have written a program that writes the html-code into a variable like this: cTmp += " "; cTmp += " "; 😭 Thank you for this hint!!
@RalphBacon
Жыл бұрын
Writing it to a variable is fine but you lose the overall visual structure. That doesn't matter if you know HTML but beginners need a few visual clues of how it's put together, I feel! You will still need to "break" the raw literal to inject variable values (although JavaScript would work too). Or you can modify the entire string using C++ function to replace, for example, placeholders with actual values. So if your raw literal contained the word @parm1 then you could do a string substitution of that value with an actual variable value.
@allinclusive5762
Жыл бұрын
@@RalphBacon ... and I have the advantage that I can very easily incorporate queries. f.e.: if ( iAnzFritzverbrauchersteckdosen == 2 ){ cTmp += "Aktueller Schaltp. 2 bei:" + String(iSchaltenBeiWatt[1]) + " W"; cTmp += "Akt. P FritzVerbraucher 2:" + String(fVerbrauchswatt[1],0)+ " W/ "+ String(iTemperatur[1])+ "°C"; }
@RalphBacon
Жыл бұрын
Only in German can we have a word like Fritzverbrauchersteckdosen. Why can't they just say FritzSmartPlug - all I hear is English expressions on Antenne1 all day so they are obviously understood! So ein Mist!
@allinclusive5762
Жыл бұрын
@@RalphBacon 😂 yes - i am ashamed of it too - but i was just too lazy to adjust the code
Hard-coding an IP address in C code as shown in the video is a terrible idea for the vast majority of people. It's almost guaranteed to _eventually_ create IP address conflicts that will be EXTREMELY difficult for most people to track down. Setting up DHCP Reservations in your DHCP server ("router") is the correct way to do this kind of thing -- while that's obviously an "outside the scope of this video" kind of thing, I'd strongly suggest that people avoid what Ralph shows here unless you know exactly what you're doing (and if you did, you wouldn't do it this way anyway! 🙂).
@RalphBacon
Жыл бұрын
Well, I did mention changing the range in which your router hands out DHCP addresses, although I suspect most users won't know their router well enough to do this. Assuming you did, then if you then use the same IP address for two ESP32s, well, you'll get a conflict although how that is reported remains to be seen. The other way is to tell the router to always give the same IP address for the ESP32s MAC address, but that's depending on your router just a little too much.
@danman32
Жыл бұрын
I'm not keen on static either. But there are pros and cons with any IP assignment method. A static ip assignment in the pool range might not cause a future conflict if the ESP is on most of the time as likely DHCP will possibly check if the IP candidate is already in use.
@u2bist
Жыл бұрын
DHCP reservation would be better, but I wouldn't be so emphatic about hardcoded ip addresses. The main issue is that a device could demand a specific ip that's already be in use. But if you define the range of ip addresses dhcp can use, numbers outside of that are safe to hardcode. The other issue is the decentralization, but that's just a matter of being organized.
Really terrific topic today Ralph! Thank you as always!
@RalphBacon
Жыл бұрын
Glad you liked it!
Thank you Ralph for this excellent video (I've enjoyed many of your other videos too!).
@RalphBacon
Жыл бұрын
Glad you like them, Paul!
Part 2 soon please.
@RalphBacon
Жыл бұрын
Yup, on the list!
Just came across your Channel. Your content is fantastic Please keep it coming Very cool accent also
@RalphBacon
Жыл бұрын
Thank you! Will do! I don't have an accent, everyone else does!
thanks for explaining and look forward to part 2!
@RalphBacon
Жыл бұрын
Glad it was helpful!
Thank you for this. I'll give it a try when I'm thinking a bit clearer. (I stepped in a hole, in the dark, and broke my face almost 2 weeks ago. Pain pills are working, but not real conducive to thinking.) I want to set up garage door opening, and had done it before, but there was no security code and it was opening and closing on it's own. (I think someone left their phone on the page when they were done. Hence the security code to arm next attempt.) This format will be a great help as I've never done OTA.
@RalphBacon
Жыл бұрын
Sorry to hear about your drunken 😲accident (what do you mean, you were stone-cold sober?) and I wish you a speedy and pain-free recovery. You'll find OTA is a bit of a non-event when you do it this way; it "just works". You can also detect when an OTA is underway to you can stop processing stuff in the main loop (your ESP32 continues to run whilst the OTA happens, albeit more slowly). I'll explain more in Part 17 of this video!
@gfodale
Жыл бұрын
@@RalphBacon Thanks!
Thanks for very interesting video. I didn't know this was possible, but it is what I always wanted. Well done. 👍
@RalphBacon
Жыл бұрын
Glad you liked it!
Well done - like your explanation. If I only had it before I started programming my ESP32 HTML projects.
@RalphBacon
Жыл бұрын
Well, it's never too late to jump ships mid-stream! How do you program you HTML projects?
@electronics.unmessed
Жыл бұрын
@@RalphBacon Well, I am not the greatest programmer on earth. Just straight forward using client.println( .. ). My dream is to realize nice gauge sites with HTML + ..
I've customised a similar library so that I upload the new bin file to a *private* gitHub repository and the esp32 checks there for an update during each boot (without forced update, but that is also possible) to display "new version" on landing page, with link to /update page. Needs a sketch based version tracking variable and an extra version tracking text file uploaded, so that the esp32 can detect if newer firmware than currently loaded is available and also prevents malicious update from unknown source that someone commented on. Took me ages to find a good library to use as a starting point. ElegantOTA was certainly an excellent choice though and one I looked at for a good long time. Not in front of code at the moment and can't remember the library I settled on as a starting point for customisation. My HTML pages can show real-time digitalRead updates for diagnostics/installation and facilitate downloading/deleting files (with directory browsing) from onboard SDCard, or initiate SQL INSERT INTO a remote server on the Interwebs. The project has many different libraries, so cutting it down for an OTA Update example would take some serious effort: SD card, RTC, Preferences, Wi-Fi AP/client, MORSE Code LED error flasher, MCP23017 port expander, SQL Client, NTP clock sync, I2C EEPROM, with version 2 thoughts for GPS/GPX, 9dof sensor, temp, altitude, CAN bus OBDII interface etc
@lindsaymcphee2885
Жыл бұрын
And ASync web server and OTAUpdate of course
@RalphBacon
Жыл бұрын
Sounds like you have a fully fledged auto-update system there, Lindsay. Did you publish on GitHub?
@lindsaymcphee2885
Жыл бұрын
No, not published anywhere public. It's a small part of an ongoing project. My intent was to make firmware updates super easy for non-technical people.. read computer illiterate.. "how do I save an attachment from an email to my hard drive?" and I wanted the ability to send software updates to many users with the least amount of my time and effort - rather than maintaining a user mailing list/database. I work as Tech Support for an importer/distributor in the Point Of Sale industry in Australia and I've seen some major international receipt printer/barcode scanner manufacturers write clunky flash update/Wi-Fi config utility software locked to one OS, requiring cable connections and I wanted to avoid all the pain points I've seen others foist onto their customers. Upon figuring out how I could do this, I may have made statements to the effect that I've created the easiest IoT device to connect to. Everything in my project is web based, OS agnostic, so end users can do everything from a browser - starting with out of the box config: 3x Wi-Fi client settings: home, work and away (through esp32's AP feature) and Social website account creation. All the user needs to know is that the device will broadcast an SSID (product name_serial number) and will respond on a static IP address with a default password that can be immediately changed. The initial brief was a multi digit 7 segment display with buttons to cycle through the data.. And maybe IOS and Android apps via Bluetooth etc. The gitHub repo I've cloned/forked is by romehein called ESPecial and ESPInstaller. I found his logic intriguing, freeing and limiting all at the same time, due to the scope of my project potentially having 3 distinct end user groups and product names with the same underlying hardware. Sorry, for being intentionally vague. I've added extra fields to his JSON structure to allow me, at the first run time, to load one of the 3 product software branches and thereafter it is locked into that branch. I've completely restructured his project into a library with external (??) reference for AsynchWebServer object and Wi-Fi credentials that can be passed in during instantiation or starting... Been a while since I looked at that code. So that the OTA library uses the same instance that the rest of the sketch uses - avoiding dueling web servers on the same ip:port I'm pretty new to gitHub Desktop and how to publish forks etc.. even after a bunch of reading. I'll have to think about how to publish one aspect of the project without giving away details I hope to make money on... one day... ;) demo repo, demo paths, demo apps with the common OTAUpdate library etc. Additionally, I don't know if my code is up to the standard that others will appreciate. Having seen other repos, some people aren't so concerned with this. 🤐 I need to learn more about the R string function you used... I've used HTML, CSS, JavaScript and sketch variables all encapsulated in C (C++??) strings and passed onto browser.. it's uuuugly, but it works. I'm a VB6 programmer at heart, so C strings take me some time. 👀
@lindsaymcphee2885
Жыл бұрын
The landing page (as AP) will display the ip address it has been given as a Wi-Fi client and can also use MDNS for Mac, iOS, (Linux??) and windows clients with bonjour loaded.. sadly not available on Android from my reading.
I have yet to find a decent wifi library that lets you securely store multiple wifi credentials, will automatically go to one of them that is currently present and, non-blocking, will go to AP mode if none present, and will regularly check for SSID changes to go to an already configured SSID. There's also the problem with some WiFi libraries that latch onto a specific BSSID in a multi/mesh Wifi AP environment rather than allow roaming between APs. I've used one that came close and included a built-in web platform and OTA. The web platform confused me, was JSON based and not clear to me on formatting and I/O.
@kitecattestecke2303
Жыл бұрын
Yes you are right.. Its just painful to realize if your esp project won't join a WiFi again if it lost connection and doesn't scan and join :-/ kind of pointless to have WiFi in the first place then :-/
@RalphBacon
Жыл бұрын
There is a library that allows multiple SSIDs to be scanned and it will join the one with the best signal. Of course, you still need to know the correct password (I'm sure you could design a simple, encrypted password storer using LittleFS). The library is called WiFiMulti.h from Espressif (bit.ly/3HONTlL ) and detailed here: randomnerdtutorials.com/esp32-wifimulti/
@danman32
Жыл бұрын
@@RalphBacon does said library automatically join the SSID autmatically or not? If not and you have to enter the password each time it wants to connect, that's not fitting my criteria.
@RalphBacon
Жыл бұрын
Automatically? Anything joining a Wi-Fi network has to know the SSID and Password, however that is supplied. You can't "just join", although you can programmatically make it appear that's what happens, without any manual password entry.
@danman32
Жыл бұрын
@@RalphBacon that's what I've been saying: enter and store SSID and password, or remember and store recent connections. That way when you come near one stored, it will reconnect. Like your phone and laptop does.
Excellent
@RalphBacon
Жыл бұрын
Thank you, glad you liked it!
Fantastic explanation. Thank you once again!
@RalphBacon
Жыл бұрын
Glad you liked it!
If you have another webserver (python webserver) you could redirect the query from the esp to the external webserver, adding the ip for that esp to the query, would allow you to have (big) images and let you update the webpage(s) layout without updating the esp, the extra webserver would need to add the esp ip to html output (base keyword) sent to the browser. When using several identical esp setups (like temp monitoring) these all could use the same page(s), 1 change to html would update all. Also like in test.html you can have links to all known installed devices, store this on your browser device (mail it as attachment)
@RalphBacon
Жыл бұрын
Yes, sounds very do-able but unfortunately not for noobs who struggle with the construct of a simple HTML anchor link!
@danman32
Жыл бұрын
Not to mention the IoT couldn't be mobile or would cease to work at all if the web server were down.
@jyvben1520
Жыл бұрын
@@danman32raspberry pi is mobile, cease to work like no power to the esp, should only be used for non critical systems, nice to have, also esp could still react to other simple queries with plain text answers. query like ip/text
I guess I will use your tutorial one day, thanks Ralph
@RalphBacon
Жыл бұрын
"One day" is just another way of saying "never", Ronen. 😢😲 (OK, I took this from the film _Knight & Day_ but it's true).
@ronen124
Жыл бұрын
@@RalphBacon I already have two ESP32 dev boards lying around inside my tool boxes and waiting to be used with WiFi 😊
Very informative as always Ralph. Yes some instruction/tutorial for making the html page more “useful” would be nice. Thanks!!!!!😅
@RalphBacon
Жыл бұрын
Noted! I knew that Part 2 would be needed...
@OsoPolarClone
Жыл бұрын
@@RalphBacon Ralph. Will ChatGPT write HTML code? Could it write the Part 2 type tasks?
@OsoPolarClone
Жыл бұрын
@@RalphBacon you may find this interesting. kzread.info/dash/bejne/h6Sr1bOrk5WwnNY.html
Nice introduction, could you expand on this in a future video to embed some sensor data into your webpage to make it more functional?
@RalphBacon
Жыл бұрын
Indeed, that is Part 2, out soon!
The problem with this approach of OTA is that it is unusable for devices that spend most of their time in deep-sleep. I use a different approach where each ESP when woken and having done its measurement and then sending that over the network, then also checks a server URL to see whether the firmware there has a different checksum than it is running at this time (a very simple compare of 2 numbers) and if so it downloads the new firmware and reboots into it. This way the device can still be in deep sleep most of the time (and run on battery) and if I need to push a new firmware, I just put it on the server and on the next wake-up the device will upgrade to it ...
@RalphBacon
Жыл бұрын
Yes, this is fine if you need the ESP32 to sleep lots. Personally, I don't like the approach because it can update itself (and hang, not work) at literally any hour of the day. I like to watch and see what happens! Perhaps I should have more confidence in my code! 😁 But, as I say, if the ESP32 needs to sleep then that's a good option you describe.
Thank you for this lesson
@RalphBacon
Жыл бұрын
You're welcome, Danny 👍
I'm trying to upload the github platformio code onto my ESP-32S, and I'm getting errors from the AsyncTCP library. Anyone else having this problem?
The same project with Freertos would be fun too !
@RalphBacon
Жыл бұрын
Well, the ESP32 runs FreeRTOS natively, so I'm not sure how different you expect it to be!
Thank for the video, just need to know how to put buttons onto the web screen and indicators and I will be in business
@RalphBacon
Жыл бұрын
That will be Part 3, due soon. "Soon", as in Arduino soon, Real World about 1 month, maybe less. 😮
Thanks Ralph I understand a load more now, i do know or can build a website just with HTML didn't understand how to link it together. Never mind another vid how about a whole series!
@RalphBacon
Жыл бұрын
Yes, another video showing something useful (erm, like turning an LED on and off?) is on the cards.
@danman32
Жыл бұрын
I'd like to see something a bit more complex than LED on/off. Plenty out there for on/off. Perhaps temp monitoring and adjustable thresholds.
@TheUnofficialMaker
Жыл бұрын
@@danman32 check out random nerd!
Had a terrible time getting the esp32 to connect. Kept getting 4 way handshake errors. Then found Ralph on a github forum with similar but different problem. Solved, but you did not tell us that tx power could be set higher!!!! :)
@RalphBacon
Жыл бұрын
If the TX power was the issue with you then that's fine, you've solved it. But if you have a Revision 0 of the ESP32 (shown on boot up) then throw it away because it will never play nicely. (kzread.info/dash/bejne/aHZ_lsizgsSsd7w.html )
@mainer8912
Жыл бұрын
@@RalphBacon Yes I remember that video. Fortunately I have rev 1 and it is connecting and running very stable. I remember reading how wonky those early esp32 boards were and that is why I avoided them until now. Looking forward to part two of this video.
Part 2 yes!
@RalphBacon
Жыл бұрын
Noted! 👍
@danman32
Жыл бұрын
I agree, as we haven't learned displaying variables and receiving data in web pages, nor multiple pages and embedded links allowing one to easily go from one page to another. Plenty of tutorials out there on single column pages but not so much making neat columns, especially when I/O is involved
Next part would be to move HTML over to LittleFS. So much easier to work with, and more powerful, then incode HTML. And authentication for OTA.
@RalphBacon
Жыл бұрын
But adding in variables is not such a trivial task, wherever the HTML is sited. But certainly, having the pages in a file would be a good idea.
@danman32
Жыл бұрын
I hadn't thought of that. Plus it appears the OTA allows you to update files in the ESP storage so you could in theory update the HTML without updating the whole code.
I like to use the esp32 idf, sa it gives the old grey cells a work out.
@RalphBacon
Жыл бұрын
By all means. It's more powerful (it exposes more of the bare ESP32 metal) and in a production environment I guess it would be mandatory. But for us hobbyists, I think I'll stick with the (easier to use) Arduino framework.
@fredflintstone1
Жыл бұрын
@@RalphBacon it's just TEH showing off again🙂
I do the OTA differently: 1. it is automatically looked at the reboot whether there is an update. The new version number is in a .PHP file on the server. If the version is different, the update is installed and then the .bin file is deleted. This reduces the probability of getting another file foisted.
@RalphBacon
Жыл бұрын
So the microcontroller is actively accessing a server to check for a software update? Is this a standard library function you use to do this, or is it homegrown?
@allinclusive5762
Жыл бұрын
@@RalphBacon homegrown: it's PHP. The Version is"g".
@JCWren
Жыл бұрын
@@allinclusive5762 I think he's referring to the ESP32 side of the project.
@allinclusive5762
Жыл бұрын
@@JCWren no - this is universal ( i mostly use the D1mini )
@JCWren
Жыл бұрын
@@allinclusive5762 OK. He's asking (I think) how you're doing this on the D1Mini side. What library or homegrown C/C++ code are you using to check the server for the image, download if present, and then install it for the upgrade. And if that's not what Ralph is asking, well, then I am :)
I've written a separate library for doing automatic updates by running a local web server. And the MCU just checks for a new version just once in a day or so.
@RalphBacon
Жыл бұрын
The 'problem' with your solution is this: _"I've written a separate library for doing automatic updates by running a local web server."_ Most newbies to web-enabling would not have your skills in doing this although I'm trying to think of an easy way of implementing this for such noobs.
@ami6packs
Жыл бұрын
@@RalphBacon If you are interested in showing it, i could make my source code open source and you could just showcase it. :)
Might be time for an update to this project as AsyncElegantOTA is no longer supported, and is replaced by ElegantOTA. ElegantOTA needs a small change to the .H file to enable async operation, and a call to it's loop member in the sketch's loop method.
@RalphBacon
10 ай бұрын
Indeed, and I am using the newer version in my latest project; it was just a matter of replacing one library with another (and that loop( ) call). That said, all my old project will continue to use AsyncElegantOTA as they should work going forward (and if they do ever stop working on a recompile I'll replace the library).
@lilbuzz999
10 ай бұрын
@@RalphBacon Before I suggested that this code be updated, I should have said thank you for this very helpful video, since I used this concept in a few of my projects after seeing it.
Excellent !
@RalphBacon
Жыл бұрын
Thank you! Cheers!
Awesome.. Thank you.
@RalphBacon
Жыл бұрын
You're welcome!
Hi Ralph, love your content! I do have one concern with PCB Way. Why is it they are able to have these absurd low prices? Can't get my head around that. To me there is no logic in having a commercial business and not make money. Can anyone help me understand?
@RalphBacon
Жыл бұрын
Don't think for a minute that PCBWay is not running a profitable, commercial business! When you order a PCB, it gets put on a large sheet with dozens of others. So, potentially, lots of $5 orders. Factor in the low cost of labour in the Far East (and probably the standard FR-4 substrate material too, but I'm guessing) and they will still not make anything approaching a loss. Whilst we hobbyists just order (up to) 10 pieces with a maximum size of 100mm x 100mm, there are probably many businesses ordering much larger and more complex designs - remember they do some mind-blowing advanced PCBs too, albeit at a cost. A business could easily order 5,000 boards (my electronics engineer consultant tells me). Many other PCB manufacturers would not even consider such a "small" run 😲 I do not know how they calculate their shipping, but there they offer some (much) lower cost routes (especially to the UK) so I can't believe they subsidise it from that side of things. What I do know is that in my experience with them, their products are without a doubt second-to-none, from the base PCB all the way through the solder masks and silk screen printing (I once looked at one under the microscope in a video, amazing quality). If this were not the case I would not feature them as sponsors on my videos!
Now how to do the same with a Raspberry pi pico W, please
@RalphBacon
Жыл бұрын
Hmm, the RasPi is not really a microcontroller, it's more or a SoC or probably a SoM. It has Wi-Fi capabilities right out of the box so coding an example web page using Python, and using the RasPi as a Web Server is probably a no-brainer. Probably.
Thanks for the video. My router has DHCP , after the lease time the static IP is no more useful. Need some guidance , How to overcome this ?
@RalphBacon
7 ай бұрын
Using static IP addresses is great but your router needs to be told not to issue addresses beyond a certain range (where you have your static IP range). So in the DHCP section of your router, you might say the range for IP addresses is 192.168.1.2 to 192.168.1.100 and that's it. You can then assign static address from 192.168.1.101 to 192.168.1.254 (careful! your router might be in that range) and the DHCP will not affect it. Alternatively (and I do not do this as I want better control) you can have the lease time set to "infinite" and check the box that says "always give the same IP address to this MAC address". But you are then depending more on the router.
Excellent Video as usual Ralph. Will this also work using IDE 1.8.... or does it only work with the new 2.0 IDE? Many thanks for keeping us up on new topics and our brains engaged.
@Cptnbond
Жыл бұрын
It works the same for IDE 1.8.x
@bobowen7861
Жыл бұрын
@@Cptnbond Many thanks. That info helps. Will give it a test.
@RalphBacon
Жыл бұрын
@Bob Owen Yes, as Sgt-Bond has indicated, it will work with all versions of the Arduino IDE, but I do recommend you download the new version 2.0.x and take advantage of its new features, not least of which includes code completion. 😉
@bobowen7861
Жыл бұрын
@@RalphBacon Trying out the new Arduino IDE 2.0.X version is on my list of things to do. It's only that I hate change and tend to stick with that which has worked before. Thankfully, there are content providers like yourself who make things easier by providing great resource materials. Thank you.
smart programming method :)
@RalphBacon
Жыл бұрын
Works for me!
Brilliant!
@RalphBacon
Жыл бұрын
Glad you liked it, Stu! Part 2 and Part 3 out "shortly".
Great video but can I use these libraries to update an Arduino uno with an Ethernet shield
@RalphBacon
Жыл бұрын
I believe you can use the libraries with an Arduino, after all we're not fiddling about with registry values here. You'll have to read the GitHub pages for each of the library and if it states it supports a Wi-Fi enabled UNO then you know it will work.
Where did you get that IPEX antenna? Do you have a view about the pcb antennas that are available? Cheers
@RalphBacon
Жыл бұрын
I had a lot of various IPEX antennas included with various devices but you can buy them on AliExpress for a very low price. I have "proper", case mounted and adjustable antennas, stick on ones that you can hide inside or outside of an enclosure, simple springs (mainly for the HC-12 devices I showed recently) and these ones which are probably the worst as they don't stay in place! PCB antennas (such as the ones normally included with ESP32 devices) work well enough for home use. Switching to a case-mounted, orientable device (not easy as you have to un/solder a 0Ω resistor the size of a speck of dust on an ESP32 device) is like chalk and cheese, range-wise. I use these to communicate from sensors in my attic to my workshop (about 10 metres away) and it's faultless.
I see static IP addresses used in multiple tutorials. I think it's worth while people learn how to use a dynamically assigned static IP in thier router, then use DHCP on their device. Then they can use the name they give it instead of messing with IP addresses. This is helpful for when you connect a deceive in future and you can't remember what address you gave it. Typing a shortname.local is also much easier and typing 192.168.xx.xxx.
@RalphBacon
Жыл бұрын
Well, yes, a name is preferable to an IP address although it's been my experience that it's always good practice to know the IP address of key devices in your network. But maybe this could be a Part 3 of this video? 😉I'm sure viewers would find it useful.
@hotswapster
Жыл бұрын
@@RalphBacon agreed knowing the ip address of key devices, but if you run the DHCP reservation tables, you'll know those addresses and then have a live, one-stop-shop to view these.
Could you update the code OTA using ESP32? I am thinking of changing the code to fix some bugs or implement new functionalities but my device is located in a factory far away from my home and I would love to upload a new sketch OTA using arduino IOT Cloud or these libraries.
@RalphBacon
9 ай бұрын
You're talking about a "pull" update, where the device checks for an update and pulls it down (just like your PC/Mac does). You could use an ESP32 for that by creating a simple web server with some memory for the flash image. I will have to explore this one day.
We need an OTA + WiFi selector for connecting for the first time to WiFi
@RalphBacon
Жыл бұрын
Catch-22 perhaps? You can't upload to a device with OTA without knowing its IP address. Obvs. But assuming you have uploaded at least once to a device, you can write a sketch to scan for all networks it can find (and the signal level) and then ask for a password from you, whilst it operates (temporarily) in AP mode with a known IP address (so you can talk to it on its private network). There are many examples out there.
mDNS is a bit more polished than forcing a static ip.
@RalphBacon
Жыл бұрын
Yes, it is but I do feel this is "good enough" for beginners to get to grips with things on the ESP32. Perhaps I'll introduce that topic separately.
Thanks for the nice overview. Do you need to change any partitioning details in the platform io config file for this to work?
@RalphBacon
Жыл бұрын
No need! In fact, if you look at the .ini file I use, I don't even mention partitioning because we don't specifically use that feature. I'm guessing that, by default, we're using all the memory for program space but I can't guarantee that. We'll cover that soon too.
@noweare1
Жыл бұрын
@@RalphBacon I think you need an ota partition for ota to work. Both programs are actually in flash at the same time so the esp32 can revert back to the old program if something goes wrong. The partition you are using would already have an ota partition.
Nice pjs
@RalphBacon
Жыл бұрын
My dress sense has never let me dow----- hang on, PJs? 😲😢😁
But if my firmware is kind a mess, it is divided into four parts and needs different hex code like 0x8000, 0x10000, ex000 something like that. What should do now
@RalphBacon
8 ай бұрын
Not sure what you mean by "four parts". Do you not compile a sketch with the standard entry point of 0x8000? How do the other bits get uploaded (without OTA)?
Can the esp32 serve up a web page from an sd card on a sd shield? Currently using a mega with ethernet shield for extensive web page, too much to put in the body of the code.
@RalphBacon
Жыл бұрын
Yes. Absolutely. And I will be showing you a way of doing this in Part 2 and Part 3, so keep tuned and keep practicing with Part 1 for now!
What if the new code I uploaded using the OTA, doesn't have the codes for OTA itself? Will it break the OTA function?
@RalphBacon
5 ай бұрын
Yes it will. Your new code must be able to accept future OTA updates. You should test out a new version of code on a test device before uploading it to your live device!
If esp32 is changed to AP mode, will it be simpler? But generally OTA does not seem to have this setting?
@RalphBacon
8 ай бұрын
Well, OTA could connect to the device in AP mode (or, perhaps, your app in running in that mode on the device). However, I don't see how it would be simpler; it just works when running as a standard wi-fi client (STA)!
High Ralph. I noticed the bin file was a lot smaller with the Arduino compiler. Is that always or mostly the case?
@RalphBacon
Жыл бұрын
I didn't notice that at all! I will have to check. Same compiler, same framework... how intriguing!
@danman32
Жыл бұрын
It could be platformIO natively adds support libraries that Arduino 2.0 does not.
I have tried to implement this using a wired network instead of WiFi using an ESP32 & ENC28J60 ethernet board but cannot get it working at all. I tried to replace the WiFi element with the EthernetENC library but couldn't get it to work at all, too many conflicts which I didn't understand. I currently use the EthernetENC library in some of my other script and they work fine for my needs, however, I would much rather use the ESPAsyncWebServer and AsyncElegantOTA libraries. Do you know whether this is at all possible Ralph?
@RalphBacon
Жыл бұрын
If you are using an ESP32 why not get it all working _first_ using Wi-Fi and then make a copy of the sketch and use the EthernetENC module; that way you might find where the issues or conflicts lie? I have only used that module using an Arduino (video #74, kzread.info/dash/bejne/eGahqM6Ght2-YLA.html ) but in theory it should work with an ESP32 (or there is another library for that hardware platform).
@MarkMatts
Жыл бұрын
@@RalphBacon Thank you so much for the reply and advice Ralph. I have tried many varied combinations trying to get this to work and I cannot fathom it out so I've gone back to just using EthernetENC and given up on trying to get the AsyncElegantOTA. It was only me being lazy so I can update the ESP32 without having to plug it in to a PC.
What's ElegantOTA? Thanks Ralph!
@RalphBacon
Жыл бұрын
No idea, got me beat there! 😆
@TheUnofficialMaker
Жыл бұрын
rewatch the video!
Have you messed with IOTAppstory?
@RalphBacon
Жыл бұрын
I haven't, and with good reason! It looks pretty complex for my modest needs. A bit like using a full blown NodeRed system to control a few peripherals in my workshop. I'm not doing that either! Well, not this year, anyway.
well a very nice video, do you have any asprin for my head🙂
@TheEmbeddedHobbyist
Жыл бұрын
What too much barking at the screen Fred. :-)
@fredflintstone1
Жыл бұрын
@@TheEmbeddedHobbyist No just up the wrong tree🙂
@TheEmbeddedHobbyist
Жыл бұрын
@@fredflintstone1 lol
@RalphBacon
Жыл бұрын
If you were to download the example(s) onto an ESP32 (which I know you have, Barney) it might make more sense to you! Go on, try it out!
@fredflintstone1
Жыл бұрын
@@RalphBacon I will try🙂 I see you say there will be a part 2 I best order some more Asprin🙂
hi cant you do this using espressif IDE?
@RalphBacon
5 ай бұрын
Well, if you want to use the ESP-IDF from Espressif, be my guest (and may the force be with you). Be aware that the Espressif IDF does not have any Arduino-like syntactic sugar; everything must be coded by you or use their implementations. But of course it can be done.
I dream of a day when i can just drop the bin file into a public google drive folder and my esp8266's camoflaged all around the world for total domination and a ransom of 1 million dollars can just see that new file and update my latest scheme.....
@RalphBacon
Жыл бұрын
Wake up, Lez, 💤WAKE UP, you were 💤dreaming again! 😁
@lezbriddon
Жыл бұрын
@@RalphBacon seen it done with GitHub but I like Google drive folders. I do wonder what changes it would really need to the GitHub sketch. If I get some time I'm going to hit my head against that wall but I'm busy building ebike things
Arduino boards ESP8266
@RalphBacon
Жыл бұрын
Um... this works fine with an ESP8266 but not an Arduino Uno/Nano because an Arduino hasn't got Wi-Fi. Is that what you meant?
It's not a chevron lol They're called angled brackets :)
@RalphBacon
Жыл бұрын
I've always called them chevrons although angle brackets work too. At work we called them chevrons too, must be a British thing, as we have road signs warning of sharp deviations with chevrons, see here: bit.ly/UKchevrons
😍😍😍😍🙏
@RalphBacon
Жыл бұрын
Quick off the mark, today, Yogesh!
Gawd...just came back to revisit because my system wasn't working. Note to self ------Turn off your browsers VPN if you want to visit your local network!!!!!! 🤣🤣🤣
@RalphBacon
Жыл бұрын
Who knew that a VPN doesn't allow a connection to a local network?
@hariseldon2577
Жыл бұрын
@@RalphBacon😴
@jstro-hobbytech
Жыл бұрын
@@RalphBacon i took a weekend recently to learn css and js and it's worth it because then you know how to make it easier as you have an idea how to add buttons using the built in objects added to the css file. the only thing that annoyed me was that you have to order the css file or something out of order will undo something you spent a ton of time to plan earlier. makes your code better though being aware of those things.
it would be more helpful to do that with IDF sdk not stupid unstable Arduino
@Cptnbond
Жыл бұрын
Arduino IDE 1 8.x is rock solid if you want stabilty. Personally I prefer this over the 2.x series.
@RalphBacon
Жыл бұрын
Not really a helpful comment. Arduino is not unstable in my experience as the framework has been ported from IDF by Espressif so they know what they are doing, so I guess they are not stupid, either. In fact, there are some features in the Arduino ESP32 framework that are not present in IDF because Arduino users expect them!
@browaruspierogus2182
Жыл бұрын
@@RalphBacon thisr party libraries have mostly some questionable untested code to pull for public for later to find out about bugs and crashes. I'm not sure if you even realize of what you said from programming perspective because IDF is SDK not a framework with spaghetti greasy code
I thought we were already past hardcoding WiFi credentials and IP addresses in the firmware, thanks to WiFiManager 😆 (And to get a static IP address, you should configure your *router* to do it based on MAC address.) Anyway, I came to check out the OTA stuff specifically. Did not expect to be lectured on the basics of HTML and CSS and C++ string literals and how to get the ESP32 to connect to WiFi 🙄
@RalphBacon
Жыл бұрын
Lectured? Really? 🤷♂️ You know this channel is for beginners and inexperienced coders, right? Who probably won't have your obvious level of expertise so they do get the basics included, I'm afraid. And doesn't include talk of setting a router to (hopefully) always give the same IP address; this is not about networking, it's about ESP32 stuff. As for the hardcoding of credentials, I don't know how often I have to say (or write) this, but this is a DEMO! 🤦♂️
@renxula
Жыл бұрын
@@RalphBacon A lecture is an educational talk given to an audience, so yes, really. I mean the OTA updating is super useful for ESP32 development in general but it has remained quite out of sight in KZread maker videos. Has nothing to do with crafting basic web pages though 😆
@icarossavvides2641
Ай бұрын
If you select the three dots next to the 'save' lozenge' you can disable the option that forces you to watch.😛
The only problem I see is that you talk too much. Why do you assume that your viewers are all beginners? I might be wrong, but people subscribing to your channel do it for a reason and the reason might be as simple that they know most of what you are saying without feeding them with teaspoons all the time. I stopped watching your videos for the simple reason that you made it too boring to listen to, even though the topics are quite OK.
@RalphBacon
Жыл бұрын
Well, I'm sorry you stopped watching but my videos have to assume no prior knowledge to allow the content to make sense to beginners. What I suggest is that you can watch at 1.25x speed (or even 1.5x 😮) to get to the bits you want to watch. I do this all the time with other KZread videos (not Arduino-related, so I am that beginner).
@TheFikotech
Жыл бұрын
@@RalphBacon As I said, why do you talk to much to explain for beginners? Just point them into right direction and go on with what you are doing. I'm sure you never made any survey about the level of your followers. I guess most of them knows and understands what you are talking about. All I'm saying is skip the boring talk and get to the point without wasting time.
@RalphBacon
Жыл бұрын
Thanks for the feedback and suggestion 😉
@icarossavvides2641
Ай бұрын
@@TheFikotech People who subscribe to this channel are BEGINNERS. Work it out. If you can do better, go ahead. I do hope your coding is better than your English...
I installed Moode Audio onto my Pi, which creates a wifi hotspot so you can connect to pi with your phone by connecting to hotspot, then you see the Moode web page and can configure its settings to connect to your network and reboot. On reboot you can connect to pi via a tablet (which is on your network) by going to Moode and you can connect to pi. I.e. no IP address is needed, no idea how it does it, but thought it was neat
@RalphBacon
Жыл бұрын
Yes, sounds neat and I bet it acts as a DNS server that ties in to your network. I'll take a quick look!
Great Video had to make a small change to get it to compile with platformio - platform = espressif32@3.5.0 - seems there is a conflict with the latest platform release
@RalphBacon
Жыл бұрын
There is an issue, correct and I'm very disappointed that me-no-dev has not addressed this after several months. But you can use the latest platform if you comment out the line in the platformio.ini line and enable the line to download that ESPAsyncWebServer library from the GitHub (see my example in my GitHub, it will be obvious).
I am having issues with the libraries I am using Arduino IDE 1.8.18. I have previously tried this with Esp8266 but got nowhere so ordered 6 new esp32 mini but they were the purple ones and I spent too long failing to get the drivers installed so now have received 6 x esp32 mini V1.0.0 which are seen and have got the "simplewifisever" sketch working so now comes to this lesson. After zipping code 1st error was multi versions of WiFi library so deleted the one in main documents/ libraries. But still stuck on "ESP32_OTA_AsyncWeb_Framework:5:10: fatal error: ESPAsyncWebServer.h: No such file or directory #include " the only library that the manager found and installed was ESPAsyncWebSrv.h tried to just alter spelling in code to call this one but nothing works. I am not uptdate with my lessons as I have to keep waiting for Aliexpress to deliver to NZ
@RalphBacon
Жыл бұрын
It sounds like your environment for the ESP32 is a bit mangled; I strongly suggest you archive it somewhere off your beaten (Windows) path and start again. BTW this will not work with the ESP8266 (I think you discovered that). Once you have the new environment, don't just install libraries willy-nilly that are not intended for your device; think about which ones are required (my demo sketch shows this clearly) and you are _guaranteed_ a successful build. Yup, guaranteed, but only if you use my demo sketch as the starting point - then you can expand on that for your own projects.
Sorry if you have covered this before. This is a local connection, why does it seem that you have to use some form of 3rd party cloud services to do the same thing over the web. Is it to do with security?
@RalphBacon
Жыл бұрын
Not sure to what you are referring. Can you clarify please?
@fenceup07944931177
Жыл бұрын
@@RalphBacon if I have it correct. In this example, you have to be on the same network as the ESP32 to connect to it from your browser. It seems to do the same thing from another network, using the world wide Web. You have to use a 3rd party like Arduino cloud.
@noweare1
Жыл бұрын
@@fenceup07944931177 To connect to the esp32 you would need the external address of your network and setup port forwarding so that you router wil let in external traffic. This is pretty insecure though unless there is some security turned on in the esp32, some kind of authentication. I am reading using a vpn provides safety for accessing the esp32 from outside your network. A vpn will make your outside computer look like its on the internal network. I have not read up too much on this though.
If I want to connect to the ESP32 from an other computer that isn't on the same network. How could I do that. I see many examples of this, but all use a third party cloud service like "Blink or Arduino Cloud". Sorry If this is a repeat, I'm not sure you get a notification of a reply to a reply.
@RalphBacon
Жыл бұрын
To communicate with any device on a network, you have to be on that network. The way 3rd parties do it is to connect the ESP32 to the cloud network and then you send stuff up to the cloud network from your home Wi-Fi, thus using them as a middle-man. The alternative is use a cheap, low power device (like an ESP-01) that just does the same as I described. It connects to "the other" network, receives data and sends it to the local ESP32 via a serial connection. Sounds clunky but no more so than using a 3rd party network.
@fenceup07944931177
Жыл бұрын
@@RalphBacon I'm sorry I know I must be missing something, but if the ESP is acting as a server, why can't it serve the information regardless of what network I'm on. Isn't it just a matter of connecting to it's external IP address? I'm sure that it would involve opening ports, and thing that I only have limited knowledge about. Sorry to go on but I just can't get my head around it.
@RalphBacon
Жыл бұрын
The ESP32 can indeed run as a server, but you then are connecting to it via your own home router (as you say) from elsewhere. Yes, you can "just" set up port forwarding to route all external requests for, say, port 80 to a single ESP32 device on your home Wi-Fi. Some ports won't be (easily) allowed by your browser but ports 81, 82 are OK (I've tested those). Port 103 was disallowed by Chrome. You can force it on a PC/Mac but on my phone it's just an app and verboten! Once you open that port, of course, you are increasing the risk that a knowledgeable person will hack your entire home network. I don't know how likely that is but I'd want to know before doing it. Incidentally, my CCTV allows this but I can't find an entry in my port forwarding page so it's a mystery!
I just did an OWASP cyber security and hacking course in work. Watching this makes me twitch. All the wonderful things you could do to the unsuspecting ESP32 if you discovered this page "out in the wild" on a public IP. Hmm. I can see an army of bots, just like Lez. Compromised IoT devices in the millions. I think ChatGPT will beat us all to that.
@1over137
Жыл бұрын
Assuming a certain about of "sense", you won't put it on a public IP. You also won't forward a port to it such that you can access it publicly. You might use a VPN (an actual VPN, not a Nord et al scam). Fine. Your ESP32 is behind a firewall, it's safe, right? Not if I manage to get malware on your PC to scan your network for a list of different OTA library signatures. Ideally download the firmware from the devices, inject the payload and reflash. More stealth that way. Otherwise you can just wipe the device with your own firmware. That firmware establishes an outbound web connection to "phone home" and say, "I'm in! What do you want me to do?" The firmware I would write for it would have a port scanner and port tunneling software, allowing me to bridge myself into your network and browse around to my hearts content. Maybe open a few more backdoors to keep my access if one gets discovered or blocked.
@RalphBacon
Жыл бұрын
Well, yes, nothing is secure in this world. Just ask the British Post Office how they got hacked with Ransomware over the last month and prevented us all sending parcels abroad. Yes, really. But do you really think hackers are out to cause mischief, or to make (lots of) money? I don't think my public-facing ESP32 even features on their radar! (He said, fingers crossed). And no, this was NOT a challenge 😲
@fillempie1501
Жыл бұрын
@@1over137 If you manage to access the ESP with a private IP address you have bigger problems then concerning about a ESP firmware flash .....
I would not open the ESP32 to the web with that Elegant OTA on it, does not look like there is any security! Someone could upload malicious code to allow them access to the rest of the network or worse! Also, you failed to mention how the server is started. Just including the header file for Elegant OTA is not enough, you also need to start it before starting the server: AsyncElegantOTA.begin(&server); // Start ElegantOTA server.begin(); // Start the web server EDIT: After posting this comment I found out they do have very basic security for the update page if you start Elegant OTA like this: AsyncElegantOTA.begin(&server, "username", "password"); // Start ElegantOTA server.begin(); // Start the web server It's not an ideal solution but I guess it should work for simple DIY projects, not recommended for release products! All it would take is for someone to get hold of the product and search the firmware data for the username and password as it wont be encrypted!
@RalphBacon
Жыл бұрын
If you notice, I didn't even mention exposing such a device to the outside world! Apart from requiring some router knowledge (IP forwarding) it would also require that additional level of security to stop your neighbour potentially accessing your devices. I'm pretty sure a serious hacker is not interested in my ESP32 Pond Heater Controller 😁😆😉
@danman32
Жыл бұрын
@@RalphBacon maybe not the pond controller itself but as OP said, your ESP can then be used as a jump point to the rest of your network. It has already happened with commercial IoT devices. A smart light bulb or some other IoT was used to hack into the HVAC of a hotel in Vegas What's ironic was that not long before the hack, I attended a convention by a network security vendor in that hotel that used that example to make their point.
@ManfredAckermann
Жыл бұрын
You can protect Elegant OTA with a user/password combination and additionally, as the `/update` path can be changed to e.g. `/t07pNueykXYi5XUA6tEAxIhXmP3owT7H`, is't quite secure... But securest would be to switch WiFi off. Your have to live with compromises. You can also pull the firmware from a trusted server on startup... Then you don't expose any interface. I do that for my deep-sleep on battery project.