Data not displaying in Device Dashboard despite connecting

Hardware:
Adafruit Feather HUZZAH with ESP32
HX711 breakout board with load sensors

Blynk Library 1.0.1

Problem: I have a sketch to upload the weight from a scale to Blynk. I had it working with the Legacy Blynk. I created the Template and device in blynk.cloud. The simplified sketch shown here connects to wifi, uploads to Blynk, disconnects, then goes to sleep for 58 minutes. (The more complex version uses NPT for time and an EP Display.) When the sketch runs, it connects to Blynk. While connected for the short time, my Blynk console shows that the device is connected. However the datastream is not updated with the weight. Can someone take a look to see if I’ve made a mistake in my sketch code?

Update:
So I just realized that the weight IS displaying on the Blynk App (New)!!! That’s great!!
But it still doesn’t display on the web Blynk Console (using Apple Safari) on the dashboard for the device. Any ideas why that might be?
-Newby

Code:

//------------------ BLYNK INFO --------------------------------//
#define BLYNK_TEMPLATE_ID ""
#define BLYNK_DEVICE_NAME ""
char auth[] = "";
#define BLYNK_FIRMWARE_VERSION        "0.1.0"

//---------------- LIBRARIES ------------------------------------------//
#include "HX711.h"  // HX711 connects controller to loadcell
#include <WiFi.h>   // Library to connect ESP32 to WiFi. Includes WiFiUDP
#include "driver/adc.h" // Needed to power down ADC
#include <esp_wifi.h> // Needed to turn off WiFi radio
#include <esp_bt.h> // Needed to turn off BT radio
#include <BlynkSimpleEsp32.h>  //Library for uploading data to to Blynk

//-------------- DEFINE TIMERS --------------------------------------------//
#define DEEP_SLEEP_DAY  58      // # minutes for Deep Sleep during day
#define uS_TO_MIN_FACTOR 60000000ULL  // Conversion factor for micro seconds to minutes (deep sleep function uses micro seconds)

//------------- HX711 LOADCELL AMPLIFIER BOARD INFO ----------------------//

//Define HX711 load sensor interface pins
#define DOUT  26 //A0 on ESP32
#define CLK  25  //A1 on ESP32
HX711 scale;
float weight;
const long loadcell_offset = 379285;  // by calibration
float calibration_factor = 138.50;     // by calibration


// ----------------- WiFi INFO ------------------------------------------//

const char *ssid = "ssid name";
const char *password = "ssid password";


//===================================================================//
//                         SETUP
//===================================================================//

void setup() {

  Serial.begin(115200);
  delay(2000);
  Serial.println();
  setCpuFrequencyMhz(80);
  Serial.println("CPU Frequency set to 80 Mhz");
  adc_power_on();
  Serial.println("ADC power ON");

  //----------Initialize and Read Scale---------------------------------//

  scale.begin(DOUT, CLK);
  scale.set_scale(calibration_factor);
  scale.set_offset(loadcell_offset);
  Serial.println("Taking 100 weight measurments and will use last one ...");
  weight = scale.get_units(100);
  Serial.print("Weight: ");
  Serial.print(weight, 1); //number indicates # of decimal places
  Serial.println(" g  ");

  //------ Connect to WiFi and Blynk ---------------------------------------------//
  WiFi.persistent( false );
  delay( 1000 );
  WiFi.mode(WIFI_STA);
  Serial.print("WiFi on and connecting ...");
  WiFi.begin(ssid, password);

  // Keep track of when we started our attempt to get a WiFi connection
  unsigned long startAttemptTime = millis();

  // Keep looping while we're not connected for 10 sec (10,000 millisec)
  while (WiFi.status() != WL_CONNECTED &&
         millis() - startAttemptTime < 10000) {
    delay(10);
  }

  // If not connected, serial print notification and move on.
  if (WiFi.status() != WL_CONNECTED) {
    Serial.println("FAILED WiFi CONNECTION");
  }
  // If connection successful, show IP address and update BLYNK.
  else {
    Serial.println();
    Serial.print("Connected to ");
    Serial.println(WiFi.SSID());  // Tell us what network is connected
    Serial.print("IP address:\t");
    Serial.println(WiFi.localIP()); // Send the IP address to serial monitor
    Serial.print("RSSI: ");
    Serial.println(WiFi.RSSI());
    delay(1000);

    Serial.println("Connecting to Blynk...");


    Blynk.config(auth);  // in place of Blynk.begin(auth, ssid, pass);
    Blynk.connect(2000);
    if (Blynk.connected() == true ) {
      Serial.println("Blynk connected");
      delay(500);
      Blynk.virtualWrite(V0, weight);
      Blynk.run();
      Serial.println("Blynk updated");
      Blynk.disconnect();
      Serial.println("Blynk disconnected");
    }
    else {
      Serial.println("Blynk Connection Failed");
    }
  }

  //----- Disonnect from Wifi -------------------------------------------------------//
  WiFi.disconnect(true);
  delay(1);
  WiFi.mode(WIFI_OFF);
  Serial.println("WiFi off");

  //--------- Preparation for Deep Sleep ------------------------------------------------//
  scale.power_down(); // put the ADC in sleep mode
  Serial.println("Scale ADC in sleep mode");
  adc_power_off();
  Serial.println("ADC powered down");
  esp_wifi_stop();
  Serial.println("WiFi radio powered down");
  esp_bt_controller_disable();
  Serial.println("BT radio powered down");

  //--------- Go into Deep Sleep ---------------------------------------------------------//


  esp_sleep_enable_timer_wakeup(DEEP_SLEEP_DAY * uS_TO_MIN_FACTOR);
  Serial.print("Going into deep sleep for ");
  Serial.print(DEEP_SLEEP_DAY);
  Serial.println(" minutes");


  Serial.println();
  esp_deep_sleep_start();
}


void loop() {}

You’re probably looking at the template view, not the device view in the web console.

The template shows some random data (apparently for visualisation purposes, but secretly I think it’s just there to confuse us)

Pete.

1 Like

Thanks, Pete. But I am looking at the Device. I got to the “Search” icon. Select my device (I only have one). Then it takes me to the Dashboard. It shows no data. And the Timeline has no history. In case you answered before I updated my post just now: the app is displaying the weight correctly. But the website still isn’t. Any thoughts?

BTW - Some of your answers on this forum have been very helpful to me. Thanks for all you do!

-Newby

1 Like

Hmm, might be connected to the virtual steam V0 issue, which is supposed to be fixed now….

Pete.

Thanks, Pete. Does that mean using V1 might work?

Or clearing your browser cache.

Pete.

For my opinion it’s quite logical because the template designed not only for 1 device but for many of it, so it would be insane trying to display all devices data in one template, that’s why every single device has it’s own dashboard. There is nothing about to confuse our users :wink:

@newby_is_my_name Did you provisioned the device via mobile app?

Dmitriy,
No. I used the Web-based console for everything.
-Newby

You only have to look at the number of times people have posted on the forum about the dashboard showing random data, of the dashboard not reflecting the data in the app, to see that it does confuse users. I flagged this up early in the beta testing program, but Blynk clearly think that it’s beneficial to persist with showing random data in the template view and not add a warning to alert the user to the fact that they aren’t viewing the actual data from the datastream.

Pete.

u should have put v pin names as in apps developer mode to the preview mode in web

Work in progress

SOLVED!
After getting the data to appear in the app, but not on the web dashboard, I realized that I needed to set up the web dashboard in the template on the web. The Device Dashboard on the web was showing a Label, but it had no value. Either one is shown by default or I added the label (then forgot) but did not set up the data stream.

Apologies for mistakes by this Newby (in name and application). I do suggest some more thorough descriptions in the walk-through documentation. The current documentation seems to assume robust experience with Blynk by the user. I’m implementing a single device now for a client. I envision implementing many devices for several clients in the future thus paying for a subscription. However, I need to learn how to use the service first. I think more robust documentation for beginners would shorten my time to buying a subscription and give newcomers the confidence to use Blynk as a service.
-Just thoughts from a Newby.

Note: I don’t do IT or tech consulting. I do CEA (controlled-environment agriculture) consulting. So I’m not a tech pro. But I am experimenting with sensors and automation in CEA. The beauty of Blynk is that it gives non-professional tech people like me the tools to find and implement IoT solutions for real-world problems. I just think better documentation for non-professional tech people like me could really help. :slight_smile:

If you are in the agriculture world, and sending infrequent (low band width) environment data, look at using LoRa (RFM95) to send the data from a remote node to the ESP which then communicates with Blynk.

Its perfect for the example you have provided, and can be very low powered. For example a ATMega328 running at 1.9v and using its 1khz internal clock combined with sleep modes and a LoRa chip can run for around 1 year on 2 AA batteries, so pretty unlimited on Solar. Also the range can be quite a few km’s which is great for fields and farmyards.

1 Like

GDay,
Excellent suggestion. I have considered this. I just haven’t had the funds or time to experiment with LoRa yet. I think it’s the next logical step. This project is in a large commercial greenhouse, and WiFi was already available. Do you think LoRa could reach through about 1,000 ft through the greenhouse (through 3 steel-framed walls with glass), and through two warehouse walls (steel frame with metal siding) to the office?

Really can’t tell without testing, but it has a much better chance than WiFi. In open air, 1000ft for LoRa is a walk in the park. I’m, using it to transmit through 2" x 3" steel mesh, one external brick wall and a internal frame walls over a distance of 175ft. I have only used a mid range power setting for transmission so far with no problems.

I’m sending Temp, Humidity, Air Pressure, Heat index, Moisture (via Mass (HX711)) and Air resistance. using just 14 bytes (octets) per transmission, so really low bandwidth.

This is an excellent tutorial series which addresses many of the potential challenges, you may encounter.

You would need to interface the LoRa receiver with the ESP then send it to Blynk (that’s the easy bit).

1 Like

Thanks for the recommended tutorial!
The client has WiFi spots throughout the facility, so that’s why WiFi was easy to go with. But the power consumption is definitely a downside. Currently using a 6600 mAh battery pack (expensive) that gets me about 30 days. That’s with a sketch that takes about 30 seconds to run between wakeup and deep sleep. Connected to WiFi about 15 seconds of that. Deep sleep is 1 hour throughout the day and 8 hours at night.