Solar powered weather station with blynk

Hello all,

I try to make a simple weather station totally powered by solar panel. The wemos D1 is the hart of this project together with a DHT22 for taken the measurements. The data retrieved from the data must be showed in the blynk app.

For so far all works. But the power consumption of the wemos is to big and slurps all energy out of the battery. Therefore i coded a deepsleep. But than all started to go wrong. No data is being transferred to the blynk system.

The D0 and RSTare connected with a switch, so I ca still upload my arduino ino. and close the switch so D0 and RST are connected.

I think the solution is in the arduino ino. But I don't know where or how. Any suggestions on this?

My code so far:

/*************************************************************

  This example shows how value can be pushed from Arduino to
  the Blynk App.

  WARNING :
  For this example you'll need Adafruit DHT sensor libraries:
    https://github.com/adafruit/Adafruit_Sensor
    https://github.com/adafruit/DHT-sensor-library

  App dashboard setup:
    Value Display widget attached to V5
    Value Display widget attached to V6
 *************************************************************/

/* Fill-in information from Blynk Device Info here */
#define BLYNK_TEMPLATE_ID "XXXXX"
#define BLYNK_TEMPLATE_NAME "XXXXX"
#define BLYNK_AUTH_TOKEN "XXXX"

/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial


#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <DHT.h>

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "XXXX";
char pass[] = "XXXXXXX!";

#define DHTPIN D5          // What digital pin we're connected to
#define DHTTYPE DHT22   // DHT 22, AM2302, AM2321

DHT dht(DHTPIN, DHTTYPE);
BlynkTimer timer;

// This function sends Arduino's up time every second to Virtual Pin (5).
// In the app, Widget's reading frequency should be set to PUSH. This means
// that you define how often to send data to Blynk App.
void sendSensor()
{
  float h = dht.readHumidity();
  float t = dht.readTemperature(); // or dht.readTemperature(true) for Fahrenheit

  if (isnan(h) || isnan(t)) {
    Serial.println("Failed to read from DHT sensor!");
    return;
  }
  // You can send any value at any time.
  // Please don't send more that 10 values per second.
  Blynk.virtualWrite(V5, h);
  Blynk.virtualWrite(V6, t);
}

void setup()
{
  // Debug console
  Serial.begin(115200);

  Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);
  // You can also specify server:
  //Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass, "blynk.cloud", 80);
  //Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass, IPAddress(192,168,1,100), 8080);

  dht.begin();

  // Setup a function to be called every second
  timer.setInterval(1000L, sendSensor);
}

void loop()
{
  Blynk.run();
  timer.run();
  ESP.deepSleep(600e6); // Sleep for 10 minutes (600 seconds)
}

Bigger battery.

Blynk requires that the Wemos remains awake, no deep sleep. So a much bigger battery and panel would be required.

Blynk may not be the best solution for this project.

What are you hoping for?

There are many cloud data services for this kind of project, including the Arduino cloud data service, Adafruit's equivalent, and many, many more. Have you considered any of those?

I think that the problem is this. Here you program the timer to execute the sendSensor function once per second:

 // Setup a function to be called every second
  timer.setInterval(1000L, sendSensor);
}

And here you start up everything and go to sleep inmediatly, so nothing is sent.

void loop()
{
  Blynk.run();
  timer.run();
  ESP.deepSleep(600e6); // Sleep for 10 minutes (600 seconds)
}

Timer.run() returns inmediatly and the MCU goes to sleep. There is no time to send anything.
When the MCU comes back from sleep it will do the same again.
Maybe this method is not the best method. You have to send the data directly and then go to sleep, instead of programming a timer to do it.

Hi Paul,

I'm open for any other solution than Blynk. But how does it change the power consumption of the battery?

I hope to get an anonymous powered weather station so I can hang him anywhere I like.

A bigger battery is only temporary . On one time I have to charge this one also.

Blynk is not great for projects there long battery life on small batteries is desired.

Blynk requires that the Arduino remains active and communicating with the Blynk servers at all times, in case the user wishes to connect and read the sensors. This drastically reduces battery life.

A better approach is to have the Arduino remain in deep sleep mode for most of the time, only waking regularly for a very short time so that it can read the sensors, transmit the readings to a server, then go back into deep sleep. When the user wants to check the readings, they connect to the server, not the Arduino.

To support this approach, there is a wide choice of cloud-based services, including Arduino's own service, a service from Adafruit, and many others.

Personally, I built my own service, for personal learning. It's not as fancy as the others, but it's been working well for many years now.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.