I have 2 UNO R4 WiFi boards and I have tried multiple times to use OTA through the IDE (not Arduino Cloud) to wirelessly upload sketches with no luck. I can do this all day long with an ESP32 with no issues and it is great! The UNO R4, not happening. I have come to the conclusion that this board is designed for OTA via Arduino Cloud only. I hope someone tells me I’m wrong and tells me how to do it. I am running the latest release of the IDE and have updated all my libraries and boards.
Hi @Kadams58. Arduino does not provide official support for OTA uploads to the UNO R4 WiFi via Arduino IDE's built-in "network" port upload feature. However, it is possible to use it by with the excellent 3rd party "ArduinoOTA" library.
There is a discussion here that contains some useful information on the subject:
I have tried all 3 of these sketches with no success. Now, what I tried was to upload the sketch using a usb cable, then disconnect the cable, supply the R4 with power only, try uploading a simple blink sketch wirelessly by looking for a port with an IP address and none is found. I cannot upload wirelessly. What am I doing wrong?
I follow this procedure all day long with a garden variety ESP32 and it works flawlessly. I thought the R4 WiFi would do the same. Haven’t figured out a way yet.
See post #2 for the solution.
By "this procedure", do you mean something like this:
(the developers of the "esp32" boards platform didn't provide documentation for using the feature with those boards, so I used the ESP8266 documentation reference, but the procedure is the same for ESP32)
So are you saying if I follow the instructions covered in Post #2 (arduino ota with the uno r4-wifi), that’s the solution?
Yes Sir, that is what I used on my ESP32 and it works well with the Arduino IDE.
The R4 WiFi, a different animal.
Exactly, as well as a few of the other newer boards. Lots of new stuff.
Sweet! I will give it a try. I'll report back to let you know if I had success. Thank you for the info!!
Any luck getting this to work? I've tried everything I can find. Wi-Fi connects reliably, USB uploads work fine but IDE network uploads: "Failed uploading: no upload port provided". CLI uploads fail with Error flashing: Unauthorized.
Tried (per 1372388 and ArduinoOTA README):
Bootstrap sketches with WiFiS3, ArduinoOTA.begin() (static IP, various passwords, blank password).
CLI: arduinoOTA with .bin file, multiple usernames/passwords—always Unauthorized.
Fake programmer: Set platform.local.txt (timeout) and programmers.txt (custom IP), but I can't get programmer to appear in Tools > Programmer.
Reinstalled IDE/ArduinoOTA v1.1.0, cleared Wi-Fi settings.
I have tried but I’m sure I’m missing something. I probably need a very simple, step by step to get it to work but I’ve had no luck. I’ve come to the conclusion that Arduino wants the R4 UNO to stick with strictly cloud based operations through the Arduino Cloud which is subscription based to do anything significant, including OTA programming. It works great with that! Stand alone OTA programming with the Arduino IDE (no Arduino Cloud), good luck! I hope someone proves me wrong.
Once again, if I’m willing to stick with the garden variety ESP32, no problems at all. OTA works fantastic, every time, with just the IDE (no cloud service needed). I was just hoping the R4 UNO would do the same. Perhaps I’m just not smart enough to figure it out. And that’s okay.
Hi @RBT.
There is a bug in Arduino IDE 2.x that causes it to not recognize newly added programmers.
Try this:
- Select Tools > Reload Board Data from the Arduino IDE menus.
- Wait until you see a "Board data reloaded." notification appear at the bottom right corner of the Arduino IDE window.
The notification is hidden after a few seconds, so if you aren't watching closely you might miss it. If so, you will see it in the "notification center", which is opened by clicking the bell icon at the bottom right corner of the Arduino IDE window.
Now try to select your programmer from Arduino IDE's Tools > Programmer menu.
Did you follow the instructions from the ArduinoOTA library's documentation?:
https://github.com/JAndrassy/ArduinoOTA#installation
You do need to make the adjustment described by the library developer @Juraj here:
By that, they mean change this line of the sketch:
#include <WiFiNINA.h>
(WiFiNINA is the Wi-Fi library for boards like the Nano 33 IoT and MKR WiFi 1010)
to this:
#include <WiFiS3.h>
(WiFiS3 is the Wi-Fi library for the UNO R4 WiFi)
If you provide a detailed description of exactly what you tried and the problems or doubts you encountered while doing that, the forum helpers might be able to provide assistance.
I don't think it is a fair assessment. Obviously if you want to use the Arduino Cloud service then you must use the Arduino Cloud service. But Arduino Cloud is an option, not a requirement. You are free to do a nearly infinite number of other very significant things with the UNO R4 WiFi board without any use of Arduino Cloud at all if you don't want to use the service. You can find many such projects that Arduino community members have shared on the Internet. You are really only limited by your imagination and perseverance to work through the challenges that are to be expected when undertaking any complex technical endeavor.
There is absolutely nothing about the UNO R4 WiFi board that locks you into using the Arduino Cloud service. The Arduino company has created a free open source boards platform that implements the full standardized standardized Arduino core API for this hardware, as well as compilation, uploading, and debugger support. You can use that platform with open source desktop tools such as Arduino IDE, Arduino CLI, or 3rd party alternatives such as PlatformIO. The firmware on the board's "bridge" module is open source, and can be easily modified or replaced entirely with a simple Arduino sketch. The hardware is also open source.
Ptillisch, you make a fair point. What you heard was probably some frustration in trying to get OTA programming with the R4 to be as simple as the ESP32 which was not realistic on my part. I respect what you said and realize I was a bit hasty expressing the negative comment I made. Thanks for responding.
it is
#include <WiFiS3.h>
#include <ArduinoOTA.h>
#include "arduino_secrets.h"
///////please enter your sensitive data in the Secret tab/arduino_secrets.h
/////// Wifi Settings ///////
char ssid[] = SECRET_SSID; // your network SSID (name)
char pass[] = SECRET_PASS; // your network password
int status = WL_IDLE_STATUS;
void setup() {
//Initialize serial:
Serial.begin(9600);
// check for the presence of the shield:
if (WiFi.status() == WL_NO_SHIELD) {
Serial.println("WiFi shield not present");
// don't continue:
while (true);
}
// attempt to connect to Wifi network:
while ( status != WL_CONNECTED) {
Serial.print("Attempting to connect to SSID: ");
Serial.println(ssid);
// Connect to WPA/WPA2 network. Change this line if using open or WEP network:
status = WiFi.begin(ssid, pass);
}
// start the WiFi OTA library with internal (flash) based storage
ArduinoOTA.begin(WiFi.localIP(), "Arduino", "password", InternalStorage);
}
void loop() {
// check for WiFi OTA updates
ArduinoOTA.poll();
// add your normal loop code below ...
}
J.R., thank you for your response.
I will say I have made some progress with this. At least now, the IP address is showing up as a port to connect to to program the R4 OTA. I copied your exact sketch you just posted, however, now, I'm getting the error message of:
Connecting to board ... done
Uploading sketch ... done
Flashing sketch ... done
Error flashing the sketch:Unauthorized
Failed uploading: uploading error: exit status 1
Any suggestions?
