ArduinoOTA Integration
NORTHSTARSHOW SYSTEMS
ArduinoOTA Integration
How Polaris firmware accepts OTA updates
| Document Number | Revision | Date | Platform Version |
|---|---|---|---|
| NSSS-DOC-0094 | A | 2026-05-20 | 1.0 |
Library
Polaris firmware uses the ArduinoOTA library shipped with the arduino:renesas_uno board package. The library provides a UDP+TCP listener that accepts firmware pushes, verifies MD5, and writes to the secondary flash bank.
Code Pattern
Compose injects the following pattern into every generated .nsss.ino:
#include <ArduinoOTA.h>
const char* OTA_PASSWORD = "<16-hex project-derived password>";
void setupOTA() {
if (WiFi.status() != WL_CONNECTED) return;
IPAddress ip = WiFi.localIP();
ArduinoOTA.begin(ip, NODE_NAME, OTA_PASSWORD, InternalStorage);
}
void setup() {
// ...
connectWiFi();
udp.begin(UDP_PORT);
setupOTA();
registerWithHelm();
}
void loop() {
ArduinoOTA.poll(); // process any pending OTA push
// ...
}
Protocol Summary
- Client UDP packet to board:65280 — auth_method ourTcpPort size md5
- Board responds OK (or AUTH nonce if password required)
- Client (if auth) sends md5(password + nonce). Board responds OK.
- Board opens TCP connection back to client at ourTcpPort
- Client streams firmware bytes over the TCP connection
- Board writes to secondary flash bank as bytes arrive
- Board verifies MD5 of the received bytes
- Board commits the new bank and reboots
Storage
The Renesas RA4M1 microcontroller in the UNO R4 WiFi has dual-bank internal flash. The InternalStorage object passed to ArduinoOTA.begin selects the secondary bank as the target. The bootloader commits the new bank only after MD5 verification succeeds, so power loss mid-transfer is recoverable.
Password Derivation
The OTA password is computed deterministically in Compose's firmware generator using FNV-1a 64-bit over the seed string:
northstar-ota:<projectName>:<first-8-chars-of-nodeId>
The 64-bit hash is hex-encoded and truncated to 16 characters. HelmOS computes the same value when pushing, so the password matches without any shared secret beyond the project file itself.
Compile-Time Dependencies
- arduino:renesas_uno board package version 1.5.3 or newer
- ArduinoOTA library — bundled with the renesas_uno core
- WiFiS3 library — bundled
- ArduinoJson 7.x for heartbeat payload encoding
Related Documents
- NSSS-DOC-0061Firmware OTA Update Guide
- NSSS-DOC-0055Polaris Firmware Bootstrap
Revision History
| Revision | Date | Description |
|---|---|---|
| A | 2026-05-20 | Initial publication |