Discrepancy in load cell values between serial monitor and Blynk labeled value widget when using load cells

The reality is that one of your hives swarmed because you allowed the bees to become overcrowded and raise new queen cells. That’s bad beekeeping and this Blynk solution is the beekeeping equivalent of having an alert to tell you that your horse has bolted from the stable, as opposed to ensuring that the stable door isn’t left open in the first place. :racehorse:

A better use of Blynk may be to use it as a tool to record hive inspections and the results of those inspections, and to alert you when inspections are overdue - especially in spring and early summer. But, on to your question…

There are so many things wrong with your code, and with what you’ve said about the results you’re seeing that it’s difficult to know where to start.

Your app currently has one widget set-up, which is a labeled display connected to pin V6 with the label “Current Hive Weight”
image

Your code has a function, which presumably is meant to write weight readings to this widget, called sendloadcell

void sendloadcell()
{
  Blynk.virtualWrite(V1, String(scale.get_units(1870), 1));
}

However, there are a number of problems with this function:

  1. Your code has no mechanism for calling this function. You need something like timer.setInterval(5000, sendloadcell); in your void setup to call it every 5 seconds
  2. This function is sending data to pin V1, not pin V6. You have no widgets connected to pin V1
  3. The command (scale.get_units(1870), 1) tells the scale to take 1870 readings and average them, whereas the command in your void loop (scale.get_units(), 1) is asking for just one reading.

I’m not even going to discuss the issues with the uptime counter, as it’s not relevant to you getting your weight reading working, and I’d suggest that you rip it out of your code to reduce the clutter.

You might want to have a read of this topic:

@christophebl has done a lot of similar work, but his weight readings aren’t aimed at detecting swarms but at being able to know how much the hive weighs to estimate the health of the colony and the amount of honey in the supers.
In a recent message he was telling me that he’s having reliability issues with the LORA network that he moved to (post #20), and that he’s now exploring the possibility of using a TTGO T-Call board instead.

Pete.