My first post on WeMos D1 was about the installation and upload of basic blink program. To refresh the details on installation and basic programming of WeMos D1, Click here. Well,this one is about Basic OTA(Over The Air) programming.
A WeMos D1 board (You can buy it from our online Store)
Micro USB cable for connecting your PC and the board.
12V,2A Power adapter or a Power Bank will be sufficient.
- Arduino IDE 1.6.4 or its newer versions- (Download it from here)
- Arduino IDE should then be installed with ESP8266 packages as explained in the previous blog.
Now,let’s start doing the OTA programming. Just follow my lead.
1. Connect WeMos D1 using micro USB cable to your PC.
2.Open your Arduino IDE. Select the WeMos D1 board from Tools>Board.
3. Select the corresponding port for the board from Tools>Port in Arduino IDE.
4. Open in Arduino IDE File>Examples>In the section containing Examples for WeMos
5. In Basic OTA program, edit the SSID and password.
const char* ssid = “……….”; //Type name of your WiFi here
const char* password = “……….”;//Type password of WiFi in //the dotted region
6. After changing SSID and Password, upload the program into WeMos D1 board using micro USB cable.
Open your serial monitor. After connecting to WiFi some unknown characters will appear on it, if WiFi is connected.
7. If WiFi is connected, then network port will appear. We can check it using Tools>Port , whether an additional network port has appeared or not. If the WiFi or OTA port has not appeared, wait for a few seconds for it to emerge and then connect.
If it has not, then restart your Arduino IDE. Then the network port might appear like this. Select the network port as shown from Tools>Port.
8. Then you can disconnect the micro USB cable from PC and power it using power bank or an adapter. Now, your board is wirelessly connected to PC . So far so good.
9. Next, the real question lies in the fact that how successful you are in uploading a single program code once or uploading codes multiple times wirelessly.
Former is very simple, where you can upload any program after following the previous eight steps. But, it can be done only once wirelessly.
In order to upload programs multiple times wirelessly, you have to add your program codes into Basic OTA.
To instantiate let me take the Blink example. Eventually, what we require is the blinking LED and the program should be uploaded wirelessly. We paste the contents of setup () and loop () from Blink into setup () and loop () of Basic OTA respectively.
10. Compile and upload this program. It will upload wirelessly and run in the board.
From now on, you are blessed with the capability to upload programs to WeMos D1 wirelessly.