ArduinoOTA with the Uno R4 WiFi

My Uno R4 WiFi has the latest firmware (UNOR4-WIFI-S3-0.3.0-rc1.bin) and the OTA sketch works on it.

I would now like to set up IDE 2.2.1 to upload sketches to my Uno R4 WiFi via OTA. The library ArduinoOTA should allow this, the Uno R4 WiFi is included in the supported micro-controllers and in the boards tested. However none of the examples work with my Uno R4 Wifi board and I have searched the internet for an example without success. Does anyone have an example of the library ArduinoOTA working with an Uno R4 WiFi and the IDE 2.2.1 to upload a sketch via OTA?

Is there any error message that you can see while trying to upload your code to the UNO R4?

The WiFi101_OTA example should work if you replace the WiFiNINA include to WiFiS3.

and
https://github.com/JAndrassy/ArduinoOTA#installation

For Uno R4, RP2040, nRF5 and STM32 boards, platform.local.txt from extras folder has to be copied into boards package installation folder.

1 Like

Thank you, that worked.

Greetings.

I am still having the issue of the programming network port not appearing in the IDE 2 with Uno R4.

I have followed the instructions, replaced the WiFiNINA to WiFiS3, added platform.local.txt from "renesas" to local "renesas_uno\1.1.0" folder. Still no luck.

I have even tried the " OTA Upload from IDE without 'network port' " by modifying the "programmers.txt" file (in the "renesas_uno\1.1.0" folder), but the programmer does not appear in the list for some reason.

I am out of ideas and would really appreciate any help on this issue.

Best regards,

Marek J.

Hi @Manki.

There is a bug in Arduino IDE that can cause this. It caches the contents of the Tools Programmer menu and uses that cached data instead of generating the menu from the updated contents of the programmers.txt file as expected.

I'll provide instructions you can follow to clear that cache, which will force Arduino IDE to load the data from programmers.txt again:

  1. Select File > Quit (or Arduino > Quit Arduino for macOS users) from the Arduino IDE menus if it is running.
    All Arduino IDE menus will close.

  2. Delete the following folder to clear the menu cache:

    • Windows:
      C:\Users\<username>\AppData\Roaming\arduino-ide\
      
      (where <username> is your Windows username)
      :exclamation: If looking for it with your file manager or command line, note that the AppData folder is hidden by default. On Windows "File Explorer", you can make it visible by opening the "View" menu, then checking the box next to "☐ Hidden items".
    • Linux:
      /home/<username>/.config/arduino-ide/
      
      (where <username> is your Linux username)
      :exclamation: The .config folder may be hidden by default in your file manager and terminal.
    • macOS:
      /Users/<username>/Library/Application Support/arduino-ide/
      
      (where <username> is your macOS username)
      :exclamation: The Library folder is hidden by default. You can make it visible by pressing the Command+Shift+. keyboard shortcut.

    :warning: Please be very careful when deleting things from your computer. When in doubt, back up!

  3. Start Arduino IDE.

  4. Select Tools > Board > Arduino UNO R4 Boards > Arduino UNO R4 WiFi from the Arduino IDE menus.

You should now see the "Arduino OTA" programmer option under the Tools > Programmer menu.

Thank you very much!

The fix worked and although the upload failed at first, when I increased the timeout (as per ArduinoOTA instructions), the sketch uploaded successfully.

However, any ideas why the OTA network port is not appearing in the tools menu, despite trying all the suggestions?

Great work on achieving a successful OTA upload!

Unfortunately I'm not very knowledgeable in this subject area. My experience is limited to using the network ports of the MKR 1000 WiFi, ESP32, and ESP8266 boards. Even then, I don't have a deep understanding of how they work at the network level. Hopefully one of the other forum helpers will be able to provide better assistance.

There are multiple layers to the system:

  • Arduino IDE displays the list of discovered ports to the user
  • Arduino CLI provides the list of all discovered ports to Arduino IDE
  • mdns-discovery provides the list of discovered "network" protocol ports to Arduino CLI
  • Mysterious (to me) network layers (something to do with mDNS)

If you would like to check whether mdns-discovery is discovering the port, I can provide instructions for doing that. Just tell me which operating system (e.g., "Windows") you are using.

This can be useful for troubleshooting because if mdns-discovery is discovering the port then you will know that the problem is at one of the layers above (and I might be able to help with that). Conversely, if mdns-discovery is not discovering the port then you will know the problem is either with mdns-discovery or a layer below it.

I am using Windows 10.

A few days ago, at one time, I saw a network port in Arduino IDE during development.
However, the next day it disappeared again. It could be that something in Windows is interfering with the discovery.

Please provide the instructions on how to debug it, if possible.

If you would like to do some troubleshooting, you can check whether the low level mdns-discovery tool used by the Arduino development software to find ports is behaving and able to see the port of your board.


:exclamation: This procedure is not intended to solve the problem. The purpose is to gather more information.


I'll provide instructions you can follow to do that:

During all this, keep an eye out for anything that doesn't match the expected behavior as described at each step.

  1. Open the following folder in Windows "File Explorer":
    C:\Users\<username>\AppData\Local\Arduino15\packages\builtin\tools\mdns-discovery
    
    (where <username> is your Windows username)
    Note that the AppData folder is hidden by default in "File Explorer". You can make it visible by opening the "View" menu, then checking the box next to "☐ Hidden items".
  2. The mdns-discovery folder will contain a subfolder for each of the versions of mdns-discovery which are installed on your computer.
    For example:
    mdns-discovery/
    ├── 0.9.2/
    ├── 1.0.2/
    └── 1.0.5/
    
  3. Hold the Shift key while clicking the right hand button on the mouse on the folder with the highest version (1.0.5 in the example above).
  4. From the context menu, click "Open PowerShell window here".
    PowerShell will now open.
  5. Type the following command:
    mdns-discovery
    
  6. Press the Enter key.
    mdns-discovery will now start. There won't be any obvious sign of this other than that there is no longer a command prompt at the cursor in the terminal.
  7. Type the following command:
    HELLO 1 "arduino-cli 0.21.0"
    
  8. Press the Enter key.
    You should now see a response printed exactly like this:
    {
      "eventType": "hello",
      "protocolVersion": 1,
      "message": "OK"
    }
    
  9. Disconnect your Arduino board from its power source if you have it powered.
  10. Type the following command:
    START_SYNC
    
  11. Press the Enter key.
    You should now see a response printed exactly like this:
    {
      "eventType": "start_sync",
      "message": "OK"
    }
    
    You might also see some additional objects in the output depending on which network ports are available on your computer.
  12. Power your Arduino board.
    You should eventually see a response printed that looks something like this:
    {
      "eventType": "add",
      "port": {
        "address": "192.168.254.127",
        "label": "esp32-b4e62dbf693d at 192.168.254.127",
        "protocol": "network",
        "protocolLabel": "Network Port",
        "properties": {
          ".": "node32s",
          "auth_upload": "no",
          "board": "node32s",
          "hostname": "esp32-b4e62dbf693d.local.",
          "port": "3232",
          "ssh_upload": "no",
          "tcp_check": "no"
        }
      }
    }
    
    This is only an example of what you might see. The output will be different depending on the board you connected.
  13. Disconnect your Arduino board from its power source.
    You should eventually see a response printed that looks something like this:
    {
      "eventType": "remove",
      "port": {
        "address": "192.168.254.127",
        "label": "esp32-b4e62dbf693d at 192.168.254.127",
        "protocol": "network",
        "protocolLabel": "Network Port",
        "properties": {
          ".": "node32s",
          "auth_upload": "no",
          "board": "node32s",
          "hostname": "esp32-b4e62dbf693d.local.",
          "port": "3232",
          "ssh_upload": "no",
          "tcp_check": "no"
        }
      }
    }
    
    This is only an example of what you might see. The port data should be the same as the "add" event you saw when you plugged the board in.

You should continue to see the same results if you repeat steps (10) and (11).

Once you are done with your experiments with the "mdns-discovery" tool, follow these instructions to exit:

  1. Type the following command:
    STOP
    
  2. Press the Enter key.
    You should now see a response printed exactly like this:
    {
      "eventType": "stop",
      "message": "OK"
    }
    
  3. Type the following command:
    QUIT
    
  4. Press the Enter key.
    You should now see a response printed exactly like this:
    {
      "eventType": "quit",
      "message": "OK"
    }
    
    You should now be back at the shell command line.

Hello, again.

Sorry for the delayed response. Last week vas very busy.

I have tried to diagnose the problem using the provided steps, but there seems to be an issue at step 12.
Nothing is happening in the mdns-discovery tool (PowerShell) when Arduino is connected. Not with my sketch, nor the ArduinoOTA example sketch.

Everything before that is exactly as provided in the steps.

Is there anything else I can do to diagnose the issue in more detail?

What is the exact folder one should add to?
e.g.:
AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.2.2

Doesn't work for me:


[Starting] Analyzing sketch 'ota_test.ino'

[Warning] Output path is not specified. Unable to reuse previously compiled files. Build will be slower. See README.

loading library from C:\Users\xxxx\OneDrive\Documents\Arduino\libraries\HALocalData: invalid library: no header files found

C:\Users\xxxx\OneDrive\Documents\Arduino\ota_test\ota_test.ino: In function 'void setup()':

C:\Users\xxxx\OneDrive\Documents\Arduino\ota_test\ota_test.ino:42:20: error: no matching function for call to 'ArduinoOTAMdnsClass<WiFiServer, WiFiClient, WiFiUDP>::begin()'

ArduinoOTA.begin(); // Starts OTA

Thanks!

platform.local.txt configures the upload, not the compilation.

what is ota_test.ino?

Hello,
I am also using Uno R4 Wifi and try to get the OTA updates running
What I did:

  • Installing JAndrassy/ ArduinoOTA lib from github
  • Added the Code to my sketch to allow for OTA updates
  • Downloaded the sketch per serial to my Arduino. Wifi connection established also webserver send/receive commands I have added to my code are working fine - thus Wifi and computer/board communication well established and stable
    Now I see in IDE 2.3.3 "Tools" the "Arduino at xxx.xxx.xx.xx" looks like it is connected to the network port with the right IP
    When I push the compile & upload button IDE says "done compiling" and "done uploading" but I do not see any updated code ond my device running.
    The output on the screen also shows
  • "Der Sketch verwendet 100732 Bytes (38%) des Programmspeicherplatzes. Das Maximum sind 262144 Bytes.
  • Globale Variablen verwenden 12932 Bytes (39%) des dynamischen Speichers, 19836 Bytes für lokale Variablen verbleiben. Das Maximum sind 32768 Bytes."
    but there is no indiaction that the uploading has been done.
    What I have not done is to add the "platform.local.txt" from the "extras/renesas" folder to my "..AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.2.2" folder because when I was trying this, I have always obtained a "missing FQBN error" and after that I could not run anything ...
    Would really appreciate some help on this topic

I tested it and everything works with IDE 2 and IDE 1. What error exactly do you get?

ich erhalte keine Fehlermeldung. Meldung "Done compiling" und dann "Done Uploading"
Der Code ist aber nicht auf dem Arduino.
Über die serielle Schnittstelle werden idR die beschriebenen Pages In der "Outbox" angezeigt. Das ist nicht der Fall, wenn ich es OTA übertrage. Die Upload Anzeige kommt unmittelbar nach dem kompilieren ...ist irgendwie viel zu schnell schätze ich ... seriell dauert es ja auch eine ganze Weile... Ich habe aber wie gesagt, die oben genannte Textdatei nicht installiert, siehe Thread...
im code habe ich in der Ini ArduinoOTA.begin(WiFi.localIP(), "Arduino", "password", InternalStorage);
commands und im loop() dann ArduinOota.handle() verwendet

@Arduinorookie2205 please write your posts in English when posting in the English language forum categories. You are welcome to compose posts in your native language, then use an automatic machine translation service (e.g., Google Translate) to convert it to English before posting.

If you prefer to communicate in the German language, we have a forum category dedicated to that language:

https://forum.arduino.cc/c/international/deutsch/47

I am really sorry for that. For the next three days I can communicate by smartphone only. And due any reasons the replies appeared on my smartphone in german only (maybe auto translated?). That is why I continued in german as well. ...thus let me reply again in english

I don't get any error message. I get the message “Done compiling” and then “Done Uploading” But the code is apparently not on the Arduino. When downloading the code via the serial interface the progress of writing pages to the Arduino can be also seen in the outbox. That's not the case when I transfer it OTA. The upload success is displayed immediately after the successful compiling message... it's somehow too fast, I guess... serially it takes quite a while... But as I said, I didn't install the text file mentioned above as i always received the FQBN error , see former thread... in the code I have added after initializing the Wifi communication in the in setup() ... ArduinoOTA.begin(WiFi.localIP(), "Arduino", "password", InternalStorage); command and in the loop() then ArduinOota.handle() command

1 Like

this is what you need to solve

Hi @Arduinorookie2205

Maybe it is caused by the contents of the file having been corrupted in some way.

Download a fresh copy of the file from here:

https://raw.githubusercontent.com/JAndrassy/ArduinoOTA/refs/heads/master/extras/renesas/platform.local.txt

Put the file in the 1.2.2 folder, then restart Arduino IDE and try again. Hopefully this time it will work. If not, let us know and we'll try something else.