Is it Possible to use Electron w/Blynk to Monitor Temp/Humidity Using </= 1MB Data?

I’ve searched this forum and others (Blynk, Hackster, etc.) for the last couple of hours trying to determine if I can reasonably expect to use an Electron with Blynk to monitor just temperature & humidity (with a RHT03 or similar) without going well over the 1MB monthly data allowance. I would suspect the answer would be “yes” if I only want data once per month or week but I’d like to get the data every 5 to 15 minutes. I’ve got Photons all over the place monitoring temps around my house but I’d like to monitor my RV while traveling.

If the answer is that it’s not practical to get the data frequently then I’ll look at uploading to a cloud or only notifying me if the temperatures exceed some extremes (say, 32F and 110F.)

Thanks in advance.

I don’t think Blynk is the right thing for that (but I only use Blynk for permanently online controlling and not for data storage).

I’m doing a similar thing with an Electron using Ubidots to get 2 temps, 1 humidity, 1 dewpoint, and the battery SoC every 15 minutes and I always stay well below 1MB.

I’m also using Ubidots to log Battery voltage and SOC with an Electron every 2 mins and I go over the 1MB per month by a little. Update every 5 mins and you should be good to go.

I’m sending data to Ubidots directly and not pushing it through via Particle Publish which helps keep the data rate down and it’s quicker it seems.

Thanks, @ScruffR and @RWB. It looks like Ubidots is the direction I need to take. I might be back for a little coaching as I work through everything. I like the idea of the battery voltage, too. Ideally I would measure the battery, temps inside and outside (near a critical component) and maybe even the fridge. There are lots of possibilities if I can keep the data usage low enough. I’ll start simple. Thanks again.

1 Like

Possibly my project meets your requirements: MyWeatherstation

Thanks, @Postler. I’m good-to-go with the Photon and Blynk app but I’m concerned it’ll use too much data with an Electron. I appreciate the advice, though.

ATT IOT is offering 1GB of data which you can share over mutiple SIM’s for like $25 per month.

Or just go over by 1MB and raise your bill by $1.

@ScruffR - Any chance you’d be willing to share the code for the project you mentioned? I’ve been trying to work through everything and find some example codes that I can work from but I’m getting completely bogged down in the details (sleep, handshakes, UDP v TCP, webhooks, etc.) I was okay learning on the Photon by trial-and-error but I’ll blow through many MBs if I do that with the Electron. Thanks.


// Dashoard:

#include "DS18B20/Particle-OneWire.h"
#include "DS18B20/DS18B20.h"
#include "PietteTech_DHT/PietteTech_DHT.h"
#include "Ubidots/Ubidots.h"

// If using software SPI (the default case):
#include "Adafruit_SSD1306/Adafruit_GFX.h"
#include "Adafruit_SSD1306/Adafruit_SSD1306.h"

#define OLED_GND    D2
#define OLED_VCC    D3
#define OLED_CLK    D4
#define OLED_MOSI   D5
#define OLED_RESET  D6
#define OLED_DC     D7
#define OLED_CS     -1  // active LOW via GND


#define TOKEN "Put here your Ubidots TOKEN"
#define DATA_SOURCE_NAME "Particle" 
#define DATA_SOURCE_TAG  "Temps"  

#define DHTTYPE  DHT22       // Sensor type DHT11/21/22/AM2301/AM2302
#define DHTPIN   A1          // Digital pin for DHT22 communications
#define DS_PIN   A0          // Digital pin for DS18B20 communications

const uint32_t PUBLISH_MINUTES  = 15; 
const uint32_t SAMPLE_INTERVAL  = 10000;
const uint32_t PUBLISH_INTERVAL = PUBLISH_MINUTES + 60000;
const int led = D7;

void dht_wrapper(); // must be declared before the lib initialization

PietteTech_DHT DHT(DHTPIN, DHTTYPE, dht_wrapper);
DS18B20 ds18b20(DS_PIN); 
Ubidots ubidots(TOKEN);
FuelGauge fuel;

char szInfo[64];
retained double   tempWater    =  0;
retained double   tempAir      =  0;
retained double   relHumidity  =  0;
retained double   dewPoint     =  0;
retained double   dewPointSlow =  0;
retained double   SoC          =  0;
retained int      lastDay      =  0;

void setup() 
    pinMode(OLED_GND, OUTPUT);
    pinMode(OLED_VCC, OUTPUT);


    Particle.variable("tempWater"   , tempWater   );
    Particle.variable("tempAir"     , tempAir     );
    Particle.variable("relHumidity" , relHumidity );
    Particle.variable("dewPoint"    , dewPoint    );
    Particle.variable("dewPointSlow", dewPointSlow);


void loop() 
  static uint32_t msLastPublish;
  static uint32_t msLastSample;
  static uint32_t lastHour;

  if (millis() - msLastSample > SAMPLE_INTERVAL)
    msLastSample = millis();

  if (millis() - msLastPublish > PUBLISH_INTERVAL)
    msLastPublish = millis();
    if ( != lastDay)
    {   // a new day calls for a sync
        if(waitFor(Particle.connected, 5*60000))
          for(uint32_t ms=millis(); millis()-ms < 1000; Particle.process());
          lastDay =;


void publishData()
  //if (!ds18b20.crcCheck()) return;
  ubidots.add("WaterTemp"  , tempWater  );
  ubidots.add("AirTemp"    , tempAir    );
  ubidots.add("RelHumidity", relHumidity);
  ubidots.add("DewPoint"   , dewPoint   );
  ubidots.add("SoC"        , SoC        );

  sprintf(szInfo, "Water %.1f °C, Air %.1f °C, Humidity %.1f% %, DewPoint %.1f (%.1f) °C, SoC: %.1f% %", tempWater, tempAir, relHumidity, dewPoint, dewPointSlow, SoC);
//  Particle.publish("scruffyTempInfo", szInfo, PRIVATE);
//  for(uint32_t ms = millis(); millis() - ms < 5000; Particle.process());

  int dt = (PUBLISH_MINUTES - Time.minute() % PUBLISH_MINUTES) * 60 - Time.second();  // wake at next time boundary
  System.sleep(BTN, FALLING, dt, SLEEP_NETWORK_STANDBY);   // use SETUP BUTTON (20) to wake

void getTemp()
    int dsAttempts = 0;
    double _tempWater;
    _tempWater = ds18b20.getTemperature();
    while (!ds18b20.crcCheck() && dsAttempts < 4)
      Serial.printf("Bad value (%d)", dsAttempts++);
      if (dsAttempts == 3)
      _tempWater = ds18b20.getTemperature();

    if(dsAttempts < 4)
    { // we have a valid reading
      tempWater = (_tempWater + tempWater) / (tempWater ? 2.0 : 1.0);

  switch (DHT.acquireAndWait()) 
    case DHTLIB_OK:
      Serial.println("DHT OK");
      relHumidity  = (DHT.getHumidity()     + relHumidity ) / (relHumidity  ? 2.0 : 1.0);
      tempAir      = (DHT.getCelsius()      + tempAir     ) / (tempAir      ? 2.0 : 1.0);
      dewPoint     = (DHT.getDewPoint()     + dewPoint    ) / (dewPoint     ? 2.0 : 1.0);
      dewPointSlow = (DHT.getDewPointSlow() + dewPointSlow) / (dewPointSlow ? 2.0 : 1.0);
      Serial.println("Error\n\r\tChecksum error");
      Serial.println("Error\n\r\tISR time out error");
      Serial.println("Error\n\r\tResponse time out error");
      Serial.println("Error\n\r\tData time out error");
      Serial.println("Error\n\r\tDelta time to small");
      Serial.println("Error\n\r\tNot started");
      Serial.println("Unknown error");
  SoC = fuel.getSoC();

void dht_wrapper() 

You just need to import the required libraries manually and build your Ubidots dashboard

This is how mine looks

1 Like

You da man, @ScruffR. Much, much appreciated. Right after I posted this I had a decent breakthrough with ubidots but I’m still lost in many areas. This is bound to help. Take care.

Would it be possible to cause my Electron/dht22 rig to report temperature every 15 minutes but then every 5 seconds after the temperature reaches say 77f ?

So when temperature reaches a critical number I get near real time updates…

@Tedted, of course! However, data usage will go up when you start your “live” feed.

@peekay123 , might you know the code that would do this, or where it might be?

You’re going to need to write the code or at least try to.

Look at the “If” statements and see if they make sense to you. These can help you create the actions you’re’ wanting.

1 Like

Ok. I’m on it. Thanks!

I’m actually working on this issue right now but in reverse order. What I’m trying to do is only upload sensor data when it’s changed significantly so I’m not wasting data by uploading data that doesn’t tell me anything new. I’ve got everything else working in the program, or so it seems, but now I’m trying to economize on data and power demands. I’ll post what I have later if I can get it to work. Or I’ll post what I have to see if someone can help me over this stumbling block. I’m not ready to give in yet. I wasted over 4 hours yesterday and today trying to track down an issue that turned out to be a bad jumper wire. I’ve noticed you can’t be just pretty close in either the programming or wiring, haha.


Okay, I guess I need a little coaching. What follows is a snippet of my code. I’ll be glad to include the entire code but this is the part with which I’m currently having troubles. I’m testing this on a Photon right now and will migrate it to an Electron later.

My intention is to print (in the future I will upload to ubidots) a sensor value once, then check periodically to see if the sensor value has changed significantly (say, 2 degrees F.) If there is no significant change I won’t upload.

I’ve tried this thing a hundred (okay, maybe 30) different ways. The way it’s written below I only get returns. I keep changing what I’m printing and I can see the temperature each time or see the difference each time but I can’t get it to give me one temp, then stop printing the temp until it changes.

I could use a nudge. Thanks.

    int lasttempF = 0;
    int tempFdelta;
void setup() {


void loop() {

        tempFdelta = tempF-lasttempF;
        tempFdelta = abs (tempFdelta);
            Serial.print("vanTemp  ");
            lasttempF = tempF;}

Lets assume you declared tempF as an integer somewhere outside the snippet and initialised it. Serial.print wants to output a string but you have handed it an integer. You need to convert that integer into a string any one of many ways
or using printf, at this point I would recomend pulling up some online documentation on handling strings, printf and similar are powerful tools that let you format numbers, charachters etc exactly as you want them to print, this includes spacing, numbers after the decimal point, as HEX values …

Thanks for the guidance, @Viscacha. I will look into that. Much appreciated.

@Viscacha, @Silverminer This is not correct. You can pass a number (int, float, etc.) to Serial.print(). You can even specify the number of decimal places, you want to see using a second parameter

float temp = 72.67
Serial.println(temp,1); // prints 72.7