[adrotate banner=”7″]

 
Again, I started the adventure to create a platform for my future things which are connected with the Internet. As mentioned in the previous videos, I was so far able to connect to a web service program. The ESP modules, even when they are soldered on a small, PCB and load some initial information from the smartphone to the module programming with my programmer and the pogo pins, is not easy. If the thing is not reachable because it’s built into something so the guys around. Even developed a completely new method to load the software on an esp8266 module, we now can load it over the Wi Fi network or, as engineers say over the air, the abbreviation is OTA. This is extremely convenient and, in addition, quite fast in this video, I show you how to do it and, of course, also some tricks. I learned during my experiments. How is it done? Even and his friends took care that the necessary programs are already implemented in the Arduino one point: 6.5 version, so on our computers, everything is already there in the ESP sketch. However, some additions have to be made to our normal sketches. Just at the beginning, OTA works only with 4 megabyte flash chips. These chips are currently used in the ESP 12 II modules to find out, you can run a sketch and get the size of your flash. Currently, my ESP or 107 and 201 only have 512 K. Flash and cannot be used for OTA.

I already ordered bigger flash chips and if successful, I will show you in a later video on how to change them. Let’S start from what we know in the old world, we load a sketch to the module using serial communication on the ESP s and also on the arduino z’. There is a program called bootloader which takes all the necessary steps on the modules. Many arduino users even do not know about this program because it’s flashed during production. I call this bootloader serial bootloader, because serial boot loaders wait for input on the serial line. They are useless in the over the air world. We need a new Wi Fi bootloader function on the ESP. Currently we have to create this vibe bootloader ourselves and it is part of our normal sketch. Unfortunately, it has no protection mechanism against unattended changes like the serial boot loaders. The principle is the same. We have to put our modules somehow in a Wi, Fi bootloader state, and then it is ready to accept the sketch from the IDE very similar to the procedure with a serial line after the upload, the module boots, and we have to make sure it ends in Our regular sketch, I show you first how simple it works. We load the example provided with the IDE and adapt the access point name and password that the module can connect to our network after a while. A new port shows up the wireless connection to our module.

You choose the OTA communication protocol and this sport, the rest stays the same and off you go with uploading, a sketch, very simple in the OTA mode of the IDE. The serial console does not work anymore and I have to use a trick to show you what happens during upload. I use another serial communications program called potty to connect to the normal serial adapter. Then you still are able to see the result of serial print commands. You see here if I reset the ESP it goes directly into this Wi Fi bootloader mode connects to the Internet and waits for input from the arduino ide. You see here its IP address after the upload, the module automatically resets itself and again waits for programming input. Of course, in future sketches we have to make sure that the sketch goes into normal operation after a successful OTA upload. But for now we loaded a new sketch without any physical connection to the module through the air. Awesome let’s look into the Wi Fi bootloader sketch. It consists of two parts, one part which has to be in the setup and the other part which has to be in the loop in order to use our ESP module not only for a software update, but also for real applications. We have to add our normal sketch in both areas set up and loop. Just after reboot, the sketch has to decide whether it wants to do upload or normal operation.

We have to find a way to signal the board if we want to upload a new sketch or run it here is my example. In my thing, I need anyway to button switches for the normal operation, so during startup, if both buttons are pressed, the sketch goes into the Wi Fi bootloader mode and after the uploading of the sketch, the module goes directly into normal operation. Because I did not push the two buttons anymore, simple trick. Now I want to show you that this really works. I change the welcome text and upload the program. As you can see, the new sketch was really uploaded. Let’S now have a closer look at the code. I will not cover the technicalities of the OTA coding. There are much brighter people out there to explain that. I include a link below to the coding I used. I unleash oh you how to embed the two code snippets into your normal sketch. First, during startup, I have to check the two buttons or you do something else, to make sure that the ESP knows that you want it in the Wi Fi bootloader mode. Then I set the OTA flag and do the part of the OTA script, which has to be placed in setup. I call this part o da in it. If the buttons are not pressed, the sketch continues into normal operation and the OTA flag is set false. My loop is very simple: if the OTA mode was selected, the sketch goes to the OTA receive part, and if not, it goes to the normal loop that’s, all again, very simple, with Arduino Sui all use serial communication for debugging.

As I said before, this does not work here, but I already showed you the trick. I use connect a simple USB to serial adapter and a small program called putty to show the results of the serial communication like that we can debug as usual. Of course, this procedure is not used for modules placed in things, but to test your sketch it is a good way. I have also to mention that this procedure is not yet completely reliable. Sometimes it does not work and the upload is interrupted without an obvious reason. Unfortunately, then, the sketch was destroyed and I had to load it the old way through the serial cable. But I know these guys work hard and I’m sure they were resolve the issues or at least make sure that during an unsuccessful load we do not lose the original program and can try another time. So, as a summary, my workflow is as follows. I still use serial communication for development with a note, MCU board. This is more convenient, but from time to time I load the release to the thing over the air just to check if everything also works in the target system. Before that, I always upload it once over the air, to my note, MCU port, to make sure that the OTA part of my sketch really works before I flash it to my thing. This was all for today in the next video. I will look deeper inside the coding of such things to make them stable and responsive.

 
 

[adrotate banner=”1″]

arduino ota Video

[mam_video id=GoQXOLB50HA]

 

 

[adrotate banner=”2″]

 

[mam_tag id=1061]

 

 

[adrotate banner=”3″]

 

arduino ota news

 

 

 

 

 

[adrotate banner=”4″]

 

 

arduino ota Social

 

 

[adrotate banner=”5″]

 

 

official.arduino
2019-09-13T20:23:14+0000

See the world through the eyes of this camera-equipped, snake-like robot.
official.arduino
2019-09-13T16:58:23+0000

This 3D-printed prosthesis uses computer vision to adjust its grip depending on the object.

femtoduino
Tue May 08 01:25:53 +0000 2012

@Kai__Facts MicroPython is separate from anything Arduino IDE related. You can upload and run a Python file using MicroPython. Some modules even do OTA updates


akirasan
Wed Mar 28 15:20:02 +0000 2007

RT @LuisLlamas: Nuevo tutorial del ESP8266, la muy interesante programación OTA
“Cómo programar el ESP8266 por WiFi con Arduino OTA”
http…

 

[adrotate banner=”6″]