OTA Updates - Resinchem/LED-Matrix-Clock_WS2812b GitHub Wiki

After completing the intial upload via USB, it is possible to then update the clock .ino file via over-the-air (OTA) updates, eliminating the need to power down the clock and remove the board. There are a few prerequisites for making this work.

Prerequisites

  • You must complete the initial upload, with your local settings, via USB the first time
  • Your clock must be on local wifi and the source device for sending the update must be on the same network/subnet
  • Your network and source device must support and recognize Multicast DNS (mDNS)*
  • You need to know the current IP address of the clock board (get from router or other tools if you do not have this already)

*The mDNS requirement is a requirement of the Arduino IDE, which will only recognize network ports via mDNS. The most recent builds of Windows 10 support mDNS. If you have an older build or operating system (or if you cannot get the clock port to show up), you may need to install Apple's Bonjour for Windows on the machine where you are using the Arduino IDE.

Performing an OTA Update

  • Launch the Arudino IDE and open the updated .ino file you wish to upload.
  • Verify you have the right board selected
  • For the port, select the network port 'matrix at your-clock-ip-address'

If you do not see the clock IP address listed under network ports, see the mDNS prerequisites above. You might also try restarting the clock and relaunching the Arduino IDE. I have found that on occasion, the port disappears. But a restart of the clock generally resolves this issue.

  • Verify your code via the Arduino IDE to assure there are no errors.
  • Open a web browser and enter the IP address of your clock followed by /otaupdate (example: http://192.168.1.103/otaupdate)
  • After a few seconds, the clock display should change to UPLOAD, showing it is ready to accept an upload:

upload

  • Click the Upload button in the Arduino IDE to upload your new file. If a successful connection is made, the output window of the IDE should show Uploading..........
  • After the upload completes, the clock will automatically reboot and execute your new code.

NOTE: If the clock does not beginning receiving data within about 20 seconds, it will leave the upload mode and return to the previous clock mode. If this happens, simply reissue the browser /otaupdate command to enter the OTA update mode again. Since this window is relatively short, it is recommended that you already have the Arduino IDE open and your code verified and ready to upload prior to putting the clock in update mode.

Performing an OTA Reboot/Restart

In addition to uploading code to the clock, you can also remotely issue a reboot or restart of the clock. The clock may be in any mode and the reboot will occur within a few seconds of issuing the restart command.

To reboot the clock remotely, simply enter the IP address of the clock, followed by /restart (Example: http://192.168.1.103/restart)

If something goes wrong...

In the event that something in the new code prevents the clock from successfully booting, fixes obviously cannot be pushed over-the-air. In this case, unless the memory of the board has been corrupted or the board is stuck in an unrecoverable boot loop, it should be possible to remove the board from the clock assembly and reflash it via USB with a known good .ino file. Worst case, you can flash a replacement board with a known good version and install that back into the clock assembly.