|
| 1 | + |
| 2 | +# Arduino OTA |
| 3 | + |
| 4 | +## About |
| 5 | + |
| 6 | +OTA (Over the Air) update is the process of loading the firmware to ESP module using Wi-Fi connection rather that a serial port. |
| 7 | + |
| 8 | +This example is adapted from https://github.com/esp8266/Arduino/blob/master/doc/ota_updates/readme.md |
| 9 | + |
| 10 | +## Execute the example |
| 11 | + |
| 12 | +Change directory to the example and edit src/main.cpp to set the SSID and password of your WiFi network. |
| 13 | + |
| 14 | + const char* ssid = "WIFI_SSID"; |
| 15 | + const char* password = "WIFI_PASS"; |
| 16 | + |
| 17 | +Compile and upload to your esp8266: |
| 18 | + |
| 19 | + pio run -e esp8266 -t upload |
| 20 | + |
| 21 | +## Test OTA |
| 22 | + |
| 23 | +Use another example ([blink is good option](https://github.com/platformio/platformio-examples/tree/develop/wiring-blink)) to generate the firmware and upload: |
| 24 | + |
| 25 | + pio run -e nodemcu -t upload --upload-port IP_ADDRESS |
| 26 | + |
| 27 | +IP address of board is printed on the serial interface (115200 bps): |
| 28 | + |
| 29 | +``` |
| 30 | +$ pio device monitor -b 115200 |
| 31 | +--- Miniterm on /dev/ttyUSB0 115200,8,N,1 --- |
| 32 | +--- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H --- |
| 33 | +Ready |
| 34 | +IP address: 192.168.10.190 |
| 35 | +``` |
| 36 | + |
| 37 | +This is a demo of OTA uploading: |
| 38 | + |
| 39 | +``` |
| 40 | +$ pio run -e nodemcu -t upload --upload-port 192.168.10.190 |
| 41 | +
|
| 42 | +[Mon Dec 19 21:35:48 2016] Processing nodemcu (platform: espressif8266, board: |
| 43 | +nodemcu, framework: arduino) |
| 44 | +------------------------------------------------------------------------------ |
| 45 | +Verbose mode can be enabled via `-v, --verbose` option |
| 46 | +Collected 23 compatible libraries |
| 47 | +Looking for dependencies... |
| 48 | +Project does not have dependencies |
| 49 | +Looking for upload port... |
| 50 | +Use manually specified: 192.168.10.190 |
| 51 | +Uploading .pioenvs/nodemcu/firmware.bin |
| 52 | +21:35:49 [DEBUG]: Options: {'esp_ip': '192.168.10.190', 'host_port': 31639, |
| 53 | +'image': '.pioenvs/nodemcu/firmware.bin', 'host_ip': '0.0.0.0', 'auth': '', |
| 54 | +'esp_port': 8266, 'spiffs': False, 'debug': True, 'progress': True} |
| 55 | +21:35:49 [INFO]: Starting on 0.0.0.0:31639 |
| 56 | +21:35:49 [INFO]: Upload size: 226272 |
| 57 | +21:35:49 [INFO]: Sending invitation to: 192.168.10.190 |
| 58 | +21:35:49 [INFO]: Waiting for device... |
| 59 | +Uploading: [============================================================] 100% |
| 60 | +Done... |
| 61 | +
|
| 62 | +21:35:53 [INFO]: Waiting for result... |
| 63 | +21:35:53 [INFO]: Result: OK |
| 64 | +===================== [SUCCESS] Took 4.67 seconds ========================== |
| 65 | +
|
| 66 | +============================= [SUMMARY] ==================================== |
| 67 | +Environment uno [SKIP] |
| 68 | +Environment nodemcu [SUCCESS] |
| 69 | +Environment teensy31 [SKIP] |
| 70 | +Environment lpmsp430g2553[SKIP] |
| 71 | +===================== [SUCCESS] Took 4.67 seconds ========================== |
| 72 | +``` |
| 73 | + |
| 74 | + |
| 75 | + |
0 commit comments