OC
OceanRemote
Low-code IoT platform
Back to Troubleshooting Hub

Firmware Flash Success But No Connection

Your firmware uploaded successfully to ESP32, ESP8266, or Pico W, but the device never appears online in OceanRemote dashboard. The Serial Monitor shows connection attempts or errors. This guide covers registration token expiry, WiFi issues, MAC binding failures, and server communication problems.

Last updated: April 22, 2026 | 12 min read

Symptoms

  • Arduino IDE shows "Done uploading" but device never appears online
  • Serial Monitor shows WiFi connected but registration fails
  • Error message: "[REG] Registration failed: Token already used or expired"
  • Error message: "[REG] HTTP Response: 401" or "410"
  • Device appears as "Pending" in dashboard but never changes to "Online"
  • Serial Monitor shows endless "Connecting..." loop
  • Device worked before but stopped after re-flashing

Common Causes

  1. Registration Token Expired Most common issue. Token generated more than 24 hours ago, never used
  2. Registration Token Already Used Token was used by another device or previous flash attempt
  3. WiFi Credentials Incorrect SSID or password wrong, or 5GHz network
  4. MAC Address Mismatch Token bound to different device's MAC address
  5. Server Connection Blocked Firewall or network blocking HTTPS outbound to www.oceanremote.net
  6. Device ID Generation Failed EEPROM corruption preventing unique device ID creation
  7. Clock Skew Device time differs from server time by more than 5 minutes

Device Registration Process Flow

1. Device boots, reads firmware from flash
         
         
2. Connects to WiFi using SSID/password in firmware
         
          WiFi fails  Check credentials, 2.4GHz band
         
         
3. Generates unique Device ID 
         
         
4. Sends registration request to /api/device/register/
   Payload: {token, device_id, mac_address, ip}
         
          401/410  Token expired or already used
          200  Registration success
         
         
5. Server returns permanent token
         
         
6. Device saves permanent token to EEPROM
         
         
7. Device requests session 
         
         
8. Device appears ONLINE in dashboard

Step-by-Step Fixes

1. Check Registration Token Age

Registration tokens expire after 24 hours:

  • Go to OceanRemote dashboard "Your Device" page
  • Check when firmware was last generated
  • If more than 24 hours ago, token is expired
  • Click "Generate New Code" to get fresh token
  • Flash new firmware within 24 hours
// Serial Monitor output for expired token:
// [REG] Registering device...
// [REG] HTTP Response: 401
// [REG] Token already used or expired
// 
// Solution: Generate new firmware and flash within 24 hours

2. Verify WiFi Credentials in Firmware

Check that SSID and password are correct:

  • Open generated firmware code in Arduino IDE
  • Find these lines near top: const char* WIFI_SSID = "Your_SSID"; const char* WIFI_PASSWORD = "Your_Password";
  • Verify SSID and password are exactly correct
  • Ensure network is 2.4GHz
  • Check for spaces at beginning or end of credentials
  • If using special characters, try simpler password temporarily

3. Monitor Serial Output During Boot

Watch the entire boot sequence:

// Open Serial Monitor at 115200 baud
// Press RESET button on device
// Watch for these messages:

//  Good flow:
// [WiFi] Connecting... Connected!
// [WiFi] IP Address: 192.168.1.100
// [REG] Registering device...
// [REG] HTTP Response: 200
// [REG]  Registration successful!
// [SESSION] Got session ID: a1b2c3d4
// [INFO] Device ONLINE

//  Problem indicators:
// [WiFi] Connecting... Failed!
// [REG] HTTP Response: 401   Token expired
// [REG] HTTP Response: 410   Token already used
// [REG] HTTP Response: 429   Rate limited

4. Clear EEPROM and Re-flash

Previous failed registration may leave corrupted data:

// Add this temporary code to clear EEPROM
#include <EEPROM.h>

void setup() {
  Serial.begin;
  EEPROM.begin;
  
  // Clear all EEPROM
  for  {
    EEPROM.write;
  }
  EEPROM.commit();
  
  Serial.println;
}

void loop() {}

// After running once:
// 1. Remove this code
// 2. Generate fresh firmware from OceanRemote
// 3. Flash normal firmware

5. Check for MAC Address Binding Issues

Permanent token is bound to specific MAC address:

  • In Serial Monitor, look for: [SYSTEM] Device ID: ESP32_XXXXXXXXXXXX
  • This ID is derived from MAC address
  • If you changed network hardware , MAC changes
  • If device ID changed, permanent token is invalid
  • Solution: Regenerate token from dashboard

6. Regenerate Token from Dashboard

Force new permanent token for device:

  • Log into OceanRemote dashboard
  • If device appears in "Pending Devices", delete it
  • Go to "Your Device" page
  • Generate fresh firmware
  • Flash new firmware to device
  • Device will register as new device with new token

7. Test Server Connectivity

Verify device can reach OceanRemote servers:

// Add this test to your firmware 
#include <ESP8266HTTPClient.h>  // or WiFiClientSecure for ESP32

void testServerConnection() {
  HTTPClient http;
  http.begin;
  int code = http.GET();
  Serial.print;
  Serial.println;
  http.end();
  
  // Should return 200 OK
  // If returns -1, check WiFi and firewall
}

Serial Monitor Message Reference

Message Meaning Solution
[WiFi] Connecting... Failed! WiFi credentials incorrect Check SSID/password, ensure 2.4GHz
[REG] HTTP Response: 401 Token expired or invalid Generate new firmware within 24 hours
[REG] HTTP Response: 410 Token already used Generate new firmware
[REG] HTTP Response: 429 Rate limited Wait 5-10 minutes, try again
[REG] HTTP Response: 200 Registration successful! Device should appear online
[SESSION] No session ID in response Session creation failed Check server connectivity, retry

Prevention Tips

  • Always flash firmware within 24 hours of generation
  • Verify WiFi credentials before flashing check case sensitivity
  • Use 2.4GHz network
  • Save generated firmware code in a text file for backup
  • Open Serial Monitor immediately after flash to see registration process
  • If registration fails, generate fresh firmware don't re-flash same code
  • Keep device within range of router during first registration

Related Issues

Frequently Asked Questions

Q: Why does my device register successfully but never appear online?

A: Registration creates the device record, but session creation may fail. Check Serial Monitor for "[SESSION]" messages. If session fails, device won't appear online. Regenerate firmware and try again.

Q: Can I reuse the same firmware code on multiple devices?

A: No. Each registration token is one-time use. Using same code on multiple devices causes token already used error. Generate separate firmware for each device.

Q: Device worked yesterday but won't connect today. What happened?

A: Most likely: 1) WiFi credentials changed, 2) Server maintenance, or 3) Permanent token corrupted in EEPROM. Check Serial Monitor for specific error. Try power cycling device first.

Still having connection issues? Contact Support or return to the Troubleshooting Hub.