In this video we are going to see how to wirelessly update the code of our Arduino project, using the WeMOS D1 ESP8266 based board. We are going to perform an update to the ESP8266 OTA. This is an impressive, and very useful feature. If you want to see how to update your ESP8266 board over the air, keep reading.
WHERE TO BUY
1. WeMOS D1: http://bit.ly/WEMOS_D1
2. Powerbank : http://bit.ly/PowerBank_XiaoMi
3. Resistor: http://bit.ly/ResistorsB
4. Mini Breadboard: http://bit.ly/MiniBreadboard
5. Wires: http://bit.ly/WiresArduino
6. LED: http://bit.ly/375LEDS
Among the other features one thing caught my eye recently! We can load programs to this board not only using the usb cable, but also wirelessly! We can update the ESP8266 OTA. Check this out: I have loaded the standard blink program to the board. The led turns on and off every second. I have now modified the Blink program to flash the LED quicker, every 200ms. I am now going to press upload and load the new program to the board wirelessly. The board is not attached to the computer, it is powered by this powerbank. We wait for a few seconds and as you can see, the new program is loaded. The LED flashes very fast! We managed to program the Wemos D1 board wirelessly! Cool, isn’t it? I think this feature is very useful as well. But now let’s see how to achieve that.
First of all we have to download and install Python 2.7 in our computer. Next we load the Arduino IDE. Please use the latest version of it. If you haven’t already set-up the Wemos Board in your Arduino IDE, please watch my previous tutorial in order to see how to do it. Next we load the BasicOTA program which is available Under File -> Examples -> ArduinoOTA. We then update the SSID and password inside the program so the board can join our WiFi network. Then we select our board and we upload the program to it using the Serial port and the usb cable. After that, we open the Serial monitor, and we can see that the board is connected to the WiFi network. Only if the module is connected to the network, after a couple of seconds, the esp8266-ota port will show up in the Arduino IDE. If the port does not show up, restart your Arduino IDE and it will appear. Now we can load any program to the board wirelessly if we set the port to the OTA port. I load the Blink program and I press upload. After a few seconds the program will be loaded to the board. That’s it! But what if we want to upload a new program to the board. We can’t do it any more since the BasicOTA program in not loaded anymore and the Arduino IDE can’t connect to the board wirelessly. In order to update the program over and over again wirelessly, we have to enter the commands from the BasicOTA program to our programs. So, I updated the blink program and it now uses the OTA commands. If we upload the program again to Arduino, we can now update it wirelessly as many times as we want, as the program will connect the WiFi network at startup. That’s it! If you need to update your programs wirelessly from now on, just add a few lines of code to it and you are ready. You can find the code of the project in a link in the description of the video.
As you can see with some simple step we can enable the wireless update feature to our projects. Updating the ESP8266 OTA is so easy! Such functionality is extremely useful in case of limited or no physical access to the board. I am going to use this feature a lot in the feature. I can deploy a project to its final position and then update the code and add new functionality to it without touching the project at all. It will be very easy and practical. What do you think about this feature? Do you find it useful? Please post any comments or ideas in the comments section below. Thank you!
CODE OF THE PROJECT
SUBSCRIBE ON YOUTUBE
Never miss a video: Subscribe to educ8s.tv