BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Particle Electron Deep Sleep To Blynk Not Showing Values

Hi,
I have been running the below code on three different Particle Electrons for over a year now. I just flashed the same code on a new Electron and dont get the Values shown. Project comes online then sleeps as normal. Has something changed or have i Been lucky it worked?


#include <blynk.h>
#include <HX711ADC.h>
#define BLYNK_IP        IPAddress(45,55,96,146)
#define zero_factor 70427 //This large value is obtained using the SparkFun_HX711_Calibration sketch
#define battsoc V6
BlynkTimer timer;
FuelGauge fuel;
HX711ADC scale(D3, D4);
char auth[] = "********************"; //

void setup()
{
   Serial.begin(9600);
   Blynk.begin(auth, BLYNK_IP);
   Serial.print("read: \t\t");
   Serial.println(scale.read());      // print a raw reading from the ADC
   Serial.print("read average: \t\t");
   Serial.println(scale.read_average(40));   // print the average of 20 readings from the ADC
   scale.set_scale(42690.f); 
   scale.set_offset(zero_factor); //Zero out the scale using a previously known zero_factor                                                                
   Serial.print("read: \t\t");
   Serial.println(scale.read());                 // print a raw reading from the ADC   
   Serial.println("Readings:");
   delay(10);
   Serial.print("one reading:\t");
   Serial.print(scale.get_units(), 2);
   Serial.print("\t| average:\t");
   Serial.println(scale.get_units(), 2);
   Blynk.virtualWrite(V5, scale.get_units());
   BLYNK_READ(battsoc);
   Blynk.virtualWrite(battsoc, fuel.getSoC());
   Blynk.run();
   delay(5000);
   System.sleep(SLEEP_MODE_DEEP, 60 * 60);
   
} 

void loop()
{
   
 
}

What values do you get/ what you expect to get?

Do the readings get updated every minute?

Also can you post your serial monitor output?

I get the SOC every wake cycle to V6. On V5 which is the scale weight I am getting -1.6.
Particle serial shows the SOC correct and shows -1.6 NULL
Usually 1 hour sleep but have been using 2 min sleep cycle for testing.

Sorry, I am not getting a value to the V5 widget.
I have tried 3 HX711 chips and confirmed with UNO serial that load cell and HX711 working.

You could try putting scale.get_units() into a variable first and then try sending the variable instead?

Hi, Thank you for your advice.
I worked out how to use the Particle serial from part of your suggestion. From there I could see the values coming through.
As it turned out the load cell was faulty.
Once replaced and a new one calibrated I got a value to Blynk on wake from deep sleep. Next wake using 2 min deep sleep for testing the old value remained. After numerous cycles of two minutes it would change and remain the same and change showing correct values.
Solution was to extend sleep cycle to 10 min and works fine.
My long running project always uses 1 hour deep sleep and that is working as normal now.
I guess the cycling of the particle/code/blynk couldn’t meet up at two minute intervals using my code.
I am only self taught with no electronic background except for this project.
I am sure a timer of some sorts would help but that is something else I am exploring now.
Thanks to you (for your time/help) and others active in this forum.

1 Like