Firmware version does not show in New Shipping Device list

Monitoring water pressure on my home domestic water system (pressure tank from a well)
Sketch & device work perfectly, updates to the Web Dashboard and to my Android phone
Alarm works correctly
Code seems to have all the necessary parts for OTA updates, but updated firmware version number doesn’t show on OTA screen. Have updated firmware number, saved, exported binary a couple of times, no luck. Also, when OTA shipment starts, under “Status” it says “Live” but “Target: 0 devices”!
Sketch didn’t have a BLYNK_DEVICE_NAME on the first iteration, so I made one up - no change to OTA behavior.
Can’t seem to find more specific instructions

• Sketch code. :point_up:Code should be formatted as example below.

#define BLYNK_TEMPLATE_ID                      "TMPLcH71gq1m"
#define BLYNK_TEMPLATE_NAME               "Water Pressure"
#define BLYNK_DEVICE_NAME                    "Bowen Water Pressure"
#define BLYNK_FIRMWARE_VERSION        "0.1.3"
#define BLYNK_AUTH_TOKEN                      " my auth token was here, correctly "

#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <ESP8266mDNS.h>
#include <WiFiUdp.h>
#include <ArduinoOTA.h>

#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define SCREEN_WIDTH 128  // OLED display width, in pixels
#define SCREEN_HEIGHT 32  // OLED display height, in pixels

// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
#define OLED_RESET -1        // Reset pin # (or -1 if sharing Arduino reset pin)
#define SCREEN_ADDRESS 0x3C  ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

BlynkTimer timer;  // Create a timer object

// WiFi credentials
char ssid[] = " my ssid was here ";
char pass[] = " my pw was here ";

// Input/output pins
const int analogPin = A0;
#define alarmLEDPin 14

// Pressure range (psi)
float pressure;
const float pressure_comp_factor = 1.273; // Factor is linear; at gauge 70 psi it reads 55 psi, so factor = 70/55
const float minPressure = 0;
const float maxPressure = 100;

// Voltage range (VDC)
float voltage;
const float minVoltage = 0.306;
const float maxVoltage = 3.1;

// Blynk virtual pins
const int pressureVPin = V0;

// Other variables
int lowPressAlarmLimit = 10;
bool lowAlarm = false;

void myTimer() {

  // Read voltage from analog input
  voltage = analogRead(analogPin) * (3.1 / 1023.0);

  // Scale voltage to pressure reading, apply compensation factor
  pressure = pressure_comp_factor * ((voltage - minVoltage) * (maxPressure - minPressure) / (maxVoltage - minVoltage) + minPressure);
  #define constrain(pressure,minPressure,maxPressure)

  // Print pressure value to serial monitor
  Serial.print("Pressure (psi): ");
  Serial.println(pressure);
  Serial.print("Voltage (VDC): ");
  Serial.println(voltage);
  Serial.print("Alarm State: ");
  if (lowAlarm == false) {
    Serial.println("NORMAL");
  } else if (lowAlarm == true) {
    Serial.println("ALARM");
  }

  // Send pressure value to Blynk
  Blynk.virtualWrite(pressureVPin, pressure);

  // Check for alarm, set LED, & send status to Blynk
  if (pressure < lowPressAlarmLimit) {
    lowAlarm = true;
    digitalWrite(alarmLEDPin, HIGH);
  } else if (pressure >= lowPressAlarmLimit) {
    lowAlarm = false;
    digitalWrite(alarmLEDPin, LOW);
  }
  Blynk.virtualWrite(V2, lowAlarm);

  // Print to the OLED display
  // Clear the buffer
  display.clearDisplay();
  display.setTextSize(1);               // Normal 1:1 pixel scale
  display.setTextColor(SSD1306_WHITE);  // Draw white text
  display.setCursor(0, 0);              // Start at top-left corner
  display.print(F("Water Pressure: "));
  display.setTextSize(2);
  display.setCursor(0, 9);
  display.print(pressure);
  display.print(" ");
  if (lowAlarm == false) {
    display.print(F("psi"));
  }
  if (lowAlarm == true) {
    display.print("Alarm");
  }
  display.display();
}

BLYNK_CONNECTED() {
  // request V1 value on connect
  Blynk.syncVirtual(V1);
}

BLYNK_WRITE(V1) {
  lowPressAlarmLimit = param.asInt();  // assigning incoming value from pin V1 to variable "lowPressAlarmLimit"
}

void setup() {
  // Start serial communication
  Serial.begin(9600);

  // Connect to Blynk
  Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);

  char auth[] = "ZUzaF8TPs6GdTuoEC1K7M-rhNdZZE6CH";  // Replace with your Blynk auth token
  char ssid[] = "Redish01";                          // Replace with your Wi-Fi network name
  char pass[] = "da7d7226bf";                        // Replace with your Wi-Fi network password

  Blynk.begin(auth, ssid, pass);

  // Set Pin mode
  pinMode(alarmLEDPin, OUTPUT);

  // Set analog reference voltage to default (3.3V)
  analogReference(DEFAULT);

  // Setup a function to call the timer function every two seconds
  timer.setInterval(2000L, myTimer);

  // SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally
  if (!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
    Serial.println("SSD1306 allocation failed");
    for (;;)
      ;  // Don't proceed, loop forever
  }

  // Show initial display buffer contents on the screen -- Adafruit splash screen.
  display.display();
  delay(2000);  // Pause for 2 seconds

  // Clear the display buffer
  display.clearDisplay();
  //  display.setTextColor(WHITE);

  ArduinoOTA.setHostname("wemos-d1-mini-pro");  // Replace with your desired hostname
  ArduinoOTA.onStart([]() {
    String type;
    if (ArduinoOTA.getCommand() == U_FLASH) {
      type = "sketch";
    } else {  // U_SPIFFS
      type = "filesystem";
    }

    // NOTE: if updating SPIFFS this would be the place to unmount SPIFFS using SPIFFS.end()
    Serial.println("Start updating " + type);
  });
  ArduinoOTA.onEnd([]() {
    Serial.println("\nEnd");
  });
  ArduinoOTA.onProgress([](unsigned int progress, unsigned int total) {
    Serial.printf("Progress: %u%%\r", (progress / (total / 100)));
  });
  ArduinoOTA.onError([](ota_error_t error) {
    Serial.printf("Error[%u]: ", error);
    if (error == OTA_AUTH_ERROR) {
      Serial.println("Auth Failed");
    } else if (error == OTA_BEGIN_ERROR) {
      Serial.println("Begin Failed");
    } else if (error == OTA_CONNECT_ERROR) {
      Serial.println("Connect Failed");
    } else if (error == OTA_RECEIVE_ERROR) {
      Serial.println("Receive Failed");
    } else if (error == OTA_END_ERROR) {
      Serial.println("End Failed");
    }
  });

  ArduinoOTA.begin();
}

void loop() {

  Blynk.run();
  ArduinoOTA.handle();
  timer.run();
}


I think that part of the problem might be that I didn’t include the following:

  1. before void (setup), I didn’t include a line like this:
    #include <BlynkEdgent.h>
  2. in void (setup), I didn’t include the following:
    BlynkEdgent.begin();
  3. and in void (loop), I didn’t have the following:
    BlynkEdgent.run();

However, when I add these items and try to compile, I get the following compile error:
exit status 1

Compilation error: BlynkEdgent.h: No such file or directory

But I can see BlynkEdgent.h in the file tree and the horizontal tab list for this project. Still a mystery…

I am using Arduino IDE Version 2.0.4, in case that matters…

You have totally misunderstood the concept of Blynk.air.

You have included the OTA code for updating it locally via the IDE not via the internet.

Blynk.air allows you to update the device from anywhere around the world.

I think you should take a step back and upload a Blynk.edgent example sketch and see how things work.

Your existing code will not work. It’s totally wrong when it comes to pushing OTA from Blynk end.

Hmm - I think I understand what you’re saying - it’s all the stuff about the Arduino OTA, then, isn’t it? I don’t exactly remember where that stuff came from - I sure didn’t type it in line by line! I’ll try removing it all.

If I open a Blynk.edgent example sketch, can I save it under another name and have it still work?

Go to your examples under that choose your board
ESP32 or ESP8266 under that choose edgent.

Now just fill in your template name and id . Thats it. Upload the code.

The example code seems to work, but (of course) it doesn’t actually DO anything. So where do I insert the actual code that I want to run?

Please keep in mind that I don’t want to re-provision my device OTA - I just want to load updated firmware to a device that is already provisioned and talking on my WiFi network. So I don’t want to use Blynk.Inject, just Blynk.Air.

Are you new to coding/iot/arduino ? If yes then its really hard to explain each and every step. Because without basic knowledge you cannot get things running. If you are copying stuff from the internet, and not analysing how it works, you will face difficulties in the future.

I said this because,

You need to learn what is setup and loop and where to place the code.

If you want only ota part follow this link

And OTA will not re provision your device. It will only update the firmware.

I think I made it clear that the device was already running as desired, and talking on my WiFi network. I did the coding for the basic device function myself, and the WiFi and Blynk connection too. I’m not new to Arduino or coding or IoT - I’m new to Blynk and specifically the OTA capability. I know where code goes, but you said:

“Go to your examples under that choose your board
ESP32 or ESP8266 under that choose edgent.
Now just fill in your template name and id . Thats it. Upload the code.” That wasn’t particularly useful.

It’s not the operating code of the device that is my problem - that’s working fine. The issue I have is OTA firmware update. I will follow the link you posted and see if I can make it work from there.

Thank you for trying to be of assistance.

If you use Blynk Edgent then an OTA update via Blynk.Air will nor overwrite the provisioning information. That is stored in NVRAM and is not changed via OTA.

If you don’t need the dynamic provisioning features of Edgent then you can use the “Blynk.Air OTA minimal code” example provided above.

In your initial example the first few lines of your sketch looked like this…

The formatting of these lines looks very odd. I think this may cause an issue with the Blynk.Air shipment page being able to parse the data that is needed (BLYNK_TEMPLATE_ID, BLYNK_TEMPLATE_NAME and BLYNK_FIRMWARE_VERSION).

Pete.

Dont you feel you yourself confused reading all these? How do you expect others to assist or help you ?

You don’t know where the ArduinoOTA came from, and you dint even bother to check that. That made me feel, you were new to coding. Someone who is on arduino coding for many years will know what ArduinoOTA is.

So i told you to start with a basic example sketch of edgent and get to know what it is and how it works.

I no where said that that will work and get you to the moon and beyond.

And also looking at your code looks like you have brought in pieces of codes from all over the internet and tried to stitch it together.

So i thought you were NEW to arduino.

Thanks, Pete. I think I’ve found a couple of reasonable tutorials to follow, so I’ll plug away at that. I believe that the “Blynk.Air OTA minimal code” will be what I need.
As far as the odd-looking formatting goes, the weird spacing wasn’t present in the Arduino IDE. I believe that I saw a suggestion from you on another thread that additional space(s) might be needed in front of the firmware version. I’ll correct the spacing as I come across it.
Thank you for your polite and constructive assistance.

:rofl: good one

Pete: I thought I should let you know that your suggestion led me to a working solution in fairly short order. I was able to update code OTA without difficulty, and have since used the same methods to implement OTA on some other sensors I have built. Thanks very much!

1 Like