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

Mi Flora / Flower Care + Blynk + ESP32

Ok! I’ll trying.

Your last Code works great with my Lolin32 , thank for sharing!
Only the ESP.restart(); at the end i removed, because my device loops endless.
Are the bridge commands neccesary? I dont understand the meaning of it.
What is the best way to request more than one Flora device? I tried with a simple counter at the end and another getSensorData() call with another adress, but that didnt work.

Hi @radla thank you for using it !
Bridge commands are not necessary, I use them because I have another device (ESP8266) connected to Blynk that activate relays. In order to trigger the relays with Eventor widget based on temperature from the ESP32, you need to use bridge.

What you can try if you have another Flora device :

Define another Flora Address
#define FLORA_ADDR1 "c5:8c:9d:10:f6:99"

Declare another floraAddress
static BLEAddress floraAddress1(FLORA_ADDR1);

Then you can run another function where you want
getSensorData(floraAddress1);

Tell me if it works well !

Hi!

I’m trying to adapt the script to 6 sensors, but i’m getting problems to understand how handle it.
Do you have any lead to help me with this customization?

Thanks for the help!

Well, your program compiles, it connect to blynk, run the first time, than disconnect and do not connect again, executing to 1 mi flora.

When im trying to do for more than 1 (6 in my case), it not even connect to blynk…:cry:

Can you help me?

Hi @igro123
Do you use the code from post #5 ?
If yes, you should get data every ~2min.
First, you need to get this working well with one device.
Please post the serial print (with timeline option activated). I will help you to troubleshoot the issue.

Hey @kaosss !

For 1 sensor the code works, but when i modify it to get the information of 6 sensors, it compiles but never connect to blynk. Below the code:

#define BLYNK_PRINT Serial // Defines the object that is used for printing
#define BLYNK_DEBUG        // Optional, this enables more detailed prints
#include "BLEDevice.h"
#define xxxxx1 "c4:7c:8d:6a:98:2c"
#define xxxxx2 "c4:7c:8d:6a:96:fd"
#define xxxxx3 "c4:7c:8d:6a:95:24"
#define xxxxx4 "c4:7c:8d:6a:93:7e"
#define xxxxx5 "c4:7c:8d:6a:94:a3"
#define xxxxx6 "c4:7c:8d:6a:93:cd"
#define BLYNK_NO_BUILTIN   // Disable built-in analog & digital pin operations
#include <Time.h>
#include <TimeLib.h>
#include "WiFi.h"
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
#define uS_TO_S_FACTOR 1000000  /* Conversion factor for micro seconds to seconds */
#define TIME_TO_SLEEP  120        /* Time ESP32 will go to sleep (in seconds) */

BlynkTimer timer;
BLEClient* pClient;
WidgetBridge bridge1(V10); //Initiating Bridge Widget on V1 of Device LolinD32

//**********TOKEN (OK)**********//
char auth[] = "xxxxxxxxxxxxxxxxxxxxx";

//**********WIFI (OK)**********//
char ssid[] = "xxxxxxxxxxxxxxxx";
char pass[] = "xxxxxxxxxxxxxxxx";

// The remote service we wish to connect to.
static BLEUUID serviceUUID("00001204-0000-1000-8000-00805f9b34fb");

// The characteristic of the remote service we are interested in.
static BLEUUID uuid_sensor_data("00001a01-0000-1000-8000-00805f9b34fb");
static BLEUUID uuid_write_mode("00001a00-0000-1000-8000-00805f9b34fb");
static BLEAddress floraAddress1(xxxxx1);
static BLEAddress floraAddress2(xxxxx2);
static BLEAddress floraAddress3(xxxxx3);
static BLEAddress floraAddress4(xxxxx4);
static BLEAddress floraAddress5(xxxxx5);
static BLEAddress floraAddress6(xxxxx6);
static BLERemoteCharacteristic* pRemoteCharacteristic;
float temp;
float moisture;
float light;
int conductivity;
int freeHeapstart;
int freeHeapstop;
int c;
 
void getSensorData(BLEAddress pAddress, uint8_t pin1, uint8_t pin2){ 
  btStart();
  timer.setTimeout(30000L, deepsleep);
  Serial.print("=================== Forming a connection to Flora device ====================");
  Serial.println(pAddress.toString().c_str());
  Serial.println(" - Connection to Flora");
  if (!pClient->connect(pAddress)){
      pClient->disconnect();
      delay(500);
      Serial.println(" - Cannot connect to Flora");
      ESP.restart();
  } else {
    Serial.println(" - Connected to Flora");
  }
  
  // Obtain a reference to the service we are after in the remote BLE server.
  BLERemoteService* pRemoteService = pClient->getService(serviceUUID);
  if (pRemoteService == nullptr) {
    Serial.print("Failed to find our service UUID: ");
    Serial.println(serviceUUID.toString().c_str());
  } else {
    Serial.println(" - Found our service");
  }
 
  pRemoteCharacteristic = pRemoteService->getCharacteristic(uuid_write_mode);
  uint8_t buf[2] = {0xA0, 0x1F};
  pRemoteCharacteristic->writeValue(buf, 2, true);
  
  // Obtain a reference to the characteristic in the service of the remote BLE server.
  pRemoteCharacteristic = pRemoteService->getCharacteristic(uuid_sensor_data);
  Serial.println(pRemoteService->toString().c_str());
  if (pRemoteCharacteristic == nullptr) {
    Serial.print("Failed to find our characteristic UUID: ");
    Serial.println(uuid_sensor_data.toString().c_str());
  } else {
      Serial.println(" - Found our characteristic");
    }
    
  // Read the value of the characteristic.
  std::string value = pRemoteCharacteristic->readValue();
  Serial.print("The characteristic value was: ");
  const char *val = value.c_str();

  Serial.print("Hex: ");
  for (int i = 0; i < 16; i++) {
    Serial.print((int)val[i], HEX);
    Serial.print(" ");
  }
  Serial.println(" ");

  temp = (val[0] + val[1] * 256) / ((float)10.0);
  moisture = val[7];
  light = val[3] + val[4] * 256;
  conductivity = val[8] + val[9] * 256;
  
  char buffer[64];

  temp = float(temp);
  moisture = float(moisture);
  light = float(light);
  conductivity = float(conductivity);
  
  Serial.print("Temperature: ");
  Serial.println(temp);

  Serial.print("Moisture: ");
  Serial.println(moisture);
  
  Serial.print("Light: ");
  Serial.println(light);
  
  Serial.print("Conductivity: ");
  Serial.println(conductivity);
  pClient->disconnect();
  delay(500);
  btStop();
  delay(500);
  sendSensorData(pin1, pin2);
}

void sendSensorData(uint8_t pin1, uint8_t pin2) {
  Blynk.begin(auth, ssid, pass);
  do
{
  Blynk.connect();
} while (!Blynk.connected());
    bridge1.setAuthToken("****************************");
    Blynk.virtualWrite(pin1, temp);
    Blynk.virtualWrite(pin2, moisture);
    bridge1.virtualWrite(V20, temp);
    bridge1.virtualWrite(V21, moisture);
    delay(1000);
    Blynk.disconnect();
    WiFi.mode(WIFI_OFF);
    freeHeapstop = ESP.getFreeHeap();
    Serial.print("FREEHEAP END : ");
    Serial.println(freeHeapstop);
    ESP.restart();
}

void getSensorData1(){
  getSensorData(floraAddress1, V6, V7);
  getSensorData(floraAddress2, V8, V9);
  getSensorData(floraAddress3, V10, V11);
  getSensorData(floraAddress4, V12, V13);
  getSensorData(floraAddress5, V14, V15);
  getSensorData(floraAddress6, V16, V17);
}
void deepsleep(){
  esp_sleep_enable_timer_wakeup(TIME_TO_SLEEP * uS_TO_S_FACTOR);
  delay(200);
  esp_deep_sleep_start();
}

void setup() {
  Serial.begin(115200);
  Serial.println("Starting Flora client...");
  delay(500);
  BLEDevice::init("");
  pClient  = BLEDevice::createClient();
  delay(500);
  WiFi.mode(WIFI_OFF);
  timer.setTimeout(102000L, getSensorData1);
}

void loop() {
  timer.run();
} 

Below the return of the code:

O sketch usa 1492098 bytes (71%) de espaço de armazenamento para programas. O máximo são 2097152 bytes.
Variáveis globais usam 61968 bytes (18%) de memória dinâmica, deixando 265712 bytes para variáveis locais. O máximo são 327680 bytes.
esptool.py v2.6
Serial port COM5
Connecting.....
Chip is ESP32D0WDQ6 (revision 1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
MAC: b4:e6:2d:99:54:d5
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 4MB
Compressed 8192 bytes to 47...

Writing at 0x0000e000... (100 %)
Wrote 8192 bytes (47 compressed) at 0x0000e000 in 0.0 seconds (effective 4096.0 kbit/s)...
Hash of data verified.
Compressed 15328 bytes to 9994...

Writing at 0x00001000... (100 %)
Wrote 15328 bytes (9994 compressed) at 0x00001000 in 0.9 seconds (effective 136.6 kbit/s)...
Hash of data verified.
Compressed 1492336 bytes to 862030...

Writing at 0x00010000... (1 %)
Writing at 0x00014000... (3 %)
Writing at 0x00018000... (5 %)
Writing at 0x0001c000... (7 %)
Writing at 0x00020000... (9 %)
Writing at 0x00024000... (11 %)
Writing at 0x00028000... (13 %)
Writing at 0x0002c000... (15 %)
Writing at 0x00030000... (16 %)
Writing at 0x00034000... (18 %)
Writing at 0x00038000... (20 %)
Writing at 0x0003c000... (22 %)
Writing at 0x00040000... (24 %)
Writing at 0x00044000... (26 %)
Writing at 0x00048000... (28 %)
Writing at 0x0004c000... (30 %)
Writing at 0x00050000... (32 %)
Writing at 0x00054000... (33 %)
Writing at 0x00058000... (35 %)
Writing at 0x0005c000... (37 %)
Writing at 0x00060000... (39 %)
Writing at 0x00064000... (41 %)
Writing at 0x00068000... (43 %)
Writing at 0x0006c000... (45 %)
Writing at 0x00070000... (47 %)
Writing at 0x00074000... (49 %)
Writing at 0x00078000... (50 %)
Writing at 0x0007c000... (52 %)
Writing at 0x00080000... (54 %)
Writing at 0x00084000... (56 %)
Writing at 0x00088000... (58 %)
Writing at 0x0008c000... (60 %)
Writing at 0x00090000... (62 %)
Writing at 0x00094000... (64 %)
Writing at 0x00098000... (66 %)
Writing at 0x0009c000... (67 %)
Writing at 0x000a0000... (69 %)
Writing at 0x000a4000... (71 %)
Writing at 0x000a8000... (73 %)
Writing at 0x000ac000... (75 %)
Writing at 0x000b0000... (77 %)
Writing at 0x000b4000... (79 %)
Writing at 0x000b8000... (81 %)
Writing at 0x000bc000... (83 %)
Writing at 0x000c0000... (84 %)
Writing at 0x000c4000... (86 %)
Writing at 0x000c8000... (88 %)
Writing at 0x000cc000... (90 %)
Writing at 0x000d0000... (92 %)
Writing at 0x000d4000... (94 %)
Writing at 0x000d8000... (96 %)
Writing at 0x000dc000... (98 %)
Writing at 0x000e0000... (100 %)
Wrote 1492336 bytes (862030 compressed) at 0x00010000 in 76.7 seconds (effective 155.6 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 132...

Writing at 0x00008000... (100 %)
Wrote 3072 bytes (132 compressed) at 0x00008000 in 0.0 seconds (effective 983.0 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...

Can you help me?

Please edit your post to add triple backticks at the beginning and end of your code, and of your compiler output message.
Triple backticks look like this:
```

Pete.

1 Like

Maybe auto reset failed, so push EN button,
and make sure your serial port is open when you upload.

Hi @igro123,

Firstly, in the second part of your post, this is not the the Serial Monitor return but the compiling/uploading log (which is not helpfull in our case). To answer @Blynk_Coeur post, the “Hard resetting via RTS pin” line at the end of upload is normal. Use the Serial Monitor, this is the first step to troubleshoot your code.

From your code, it should work for the 1st Flora Address but not the following Address’ : there is an ESP.restart(); at the end of void sendSensorData() function.

Basically, this is what you code does :

  • Run setup()
  • After 102 seconds, run getSensorData1()
  • Directly run getSensorData(floraAddress1, V6, V7);
  • Connect, get data and run sendSensorData(pin1, pin2);
  • Restart ESP with ESP.restart(); from the beginning

What if you put the ESP.restart(); at the end of getSensorData1() instead of sendSensorData() ?

It stays like this and nothing happens

19:05:35.274 -> =================== Forming a connection to Flora device ====================c4:7c:8d:6a:98:2c
19:05:35.305 ->  - Connection to Flora

Can you help me?

This is the code I’m using now:

#define BLYNK_PRINT Serial // Defines the object that is used for printing
#define BLYNK_DEBUG        // Optional, this enables more detailed prints
#include "BLEDevice.h"
#define alecrim "c4:7c:8d:6a:98:2c"
#define hortela "c4:7c:8d:6a:96:fd"
#define alface_manjericao "c4:7c:8d:6a:95:24"
#define cerejeira "c4:7c:8d:6a:93:7e"
#define serissa "c4:7c:8d:6a:94:a3"
#define jacare "c4:7c:8d:6a:93:cd"
#define BLYNK_NO_BUILTIN   // Disable built-in analog & digital pin operations
#include <Time.h>
#include <TimeLib.h>
#include "WiFi.h"
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
#define uS_TO_S_FACTOR 1000000  /* Conversion factor for micro seconds to seconds */
#define TIME_TO_SLEEP  120        /* Time ESP32 will go to sleep (in seconds) */

BlynkTimer timer;
BLEClient* pClient;
//WidgetBridge bridge1(V10); //Initiating Bridge Widget on V1 of Device LolinD32

//**********TOKEN (OK)**********//
char auth[] = "xxxxxxf";

//**********WIFI (OK)**********//
char ssid[] = "xxxxx";
char pass[] = "xxxxxx";

// The remote service we wish to connect to.
static BLEUUID serviceUUID("00001204-0000-1000-8000-00805f9b34fb");

// The characteristic of the remote service we are interested in.
static BLEUUID uuid_sensor_data("00001a01-0000-1000-8000-00805f9b34fb");
static BLEUUID uuid_write_mode("00001a00-0000-1000-8000-00805f9b34fb");
static BLEAddress floraAddress1(alecrim);
static BLEAddress floraAddress2(hortela);
static BLEAddress floraAddress3(alface_manjericao);
static BLEAddress floraAddress4(cerejeira);
static BLEAddress floraAddress5(serissa);
static BLEAddress floraAddress6(jacare);
static BLERemoteCharacteristic* pRemoteCharacteristic;
float temp;
float moisture;
float light;
int conductivity;
int freeHeapstart;
int freeHeapstop;
int c;
 
void getSensorData(BLEAddress pAddress, uint8_t pin1, uint8_t pin2, uint8_t pin3, uint8_t pin4){ 
  btStart();
  timer.setTimeout(30000L, deepsleep);
  Serial.print("=================== Forming a connection to Flora device ====================");
  Serial.println(pAddress.toString().c_str());
  Serial.println(" - Connection to Flora");
  if (!pClient->connect(pAddress)){
      pClient->disconnect();
      delay(500);
      Serial.println(" - Cannot connect to Flora");
      ESP.restart();
  } else {
    Serial.println(" - Connected to Flora");
  }
  
  // Obtain a reference to the service we are after in the remote BLE server.
  BLERemoteService* pRemoteService = pClient->getService(serviceUUID);
  if (pRemoteService == nullptr) {
    Serial.print("Failed to find our service UUID: ");
    Serial.println(serviceUUID.toString().c_str());
  } else {
    Serial.println(" - Found our service");
  }
 
  pRemoteCharacteristic = pRemoteService->getCharacteristic(uuid_write_mode);
  uint8_t buf[2] = {0xA0, 0x1F};
  pRemoteCharacteristic->writeValue(buf, 2, true);
  
  // Obtain a reference to the characteristic in the service of the remote BLE server.
  pRemoteCharacteristic = pRemoteService->getCharacteristic(uuid_sensor_data);
  Serial.println(pRemoteService->toString().c_str());
  if (pRemoteCharacteristic == nullptr) {
    Serial.print("Failed to find our characteristic UUID: ");
    Serial.println(uuid_sensor_data.toString().c_str());
  } else {
      Serial.println(" - Found our characteristic");
    }
    
  // Read the value of the characteristic.
  std::string value = pRemoteCharacteristic->readValue();
  Serial.print("The characteristic value was: ");
  const char *val = value.c_str();

  Serial.print("Hex: ");
  for (int i = 0; i < 16; i++) {
    Serial.print((int)val[i], HEX);
    Serial.print(" ");
  }
  Serial.println(" ");

  temp = (val[0] + val[1] * 256) / ((float)10.0);
  moisture = val[7];
  light = val[3] + val[4] * 256;
  conductivity = val[8] + val[9] * 256;
  
  char buffer[64];

  temp = float(temp);
  moisture = float(moisture);
  light = float(light);
  conductivity = float(conductivity);
  
  Serial.print("Temperature: ");
  Serial.println(temp);

  Serial.print("Moisture: ");
  Serial.println(moisture);
  
  Serial.print("Light: ");
  Serial.println(light);
  
  Serial.print("Conductivity: ");
  Serial.println(conductivity);
  pClient->disconnect();
  delay(500);
  btStop();
  delay(500);
  sendSensorData(pin1, pin2, pin3, pin4);
}

void sendSensorData(uint8_t pin1, uint8_t pin2, uint8_t pin3, uint8_t pin4) {
  Blynk.begin(auth, ssid, pass);
  do
{
  Blynk.connect();
} while (!Blynk.connected());
    //bridge1.setAuthToken("****************************");
    Blynk.virtualWrite(pin1, temp);
    Blynk.virtualWrite(pin2, moisture);
    Blynk.virtualWrite(pin3, light);
    Blynk.virtualWrite(pin4, conductivity);
    //bridge1.virtualWrite(V20, temp);
    //bridge1.virtualWrite(V21, moisture);
    delay(1000);
    Blynk.disconnect();
    WiFi.mode(WIFI_OFF);
    freeHeapstop = ESP.getFreeHeap();
    Serial.print("FREEHEAP END : ");
    Serial.println(freeHeapstop);
}

void getSensorData1(){
  getSensorData(floraAddress1, V6, V7, V8, V9);
  getSensorData(floraAddress2, V10, V11, V12, V13);
  getSensorData(floraAddress3, V14, V15, V16, V17);
  getSensorData(floraAddress4, V18, V19, V20, V21);
  getSensorData(floraAddress5, V22, V23, V24, V25);
  getSensorData(floraAddress6, V26, V27, V28, V29);
  ESP.restart();
}
void deepsleep(){
  esp_sleep_enable_timer_wakeup(TIME_TO_SLEEP * uS_TO_S_FACTOR);
  delay(200);
  esp_deep_sleep_start();
}

void setup() {
  Serial.begin(115200);
  Serial.println("Starting Flora client...");
  delay(500);
  BLEDevice::init("");
  pClient  = BLEDevice::createClient();
  delay(500);
  WiFi.mode(WIFI_OFF);
  timer.setTimeout(102000L, getSensorData1);
}

void loop() {
  timer.run();
}

Hi @igro123, tried your code, works well for me :

12:48:21.164 -> Starting Flora client...
12:49:02.840 -> =================== Forming a connection to Flora device ====================c4:7c:8d:66:e9:11
12:49:02.840 ->  - Connection to Flora
12:49:03.309 ->  - Connected to Flora
12:49:04.632 ->  - Found our service
12:49:04.666 -> Service: uuid: 00001204-0000-1000-8000-00805f9b34fb, start_handle: 49 0x31, end_handle: 57 0x39
12:49:04.666 -> Characteristic: uuid: 00001a00-0000-1000-8000-00805f9b34fb, handle: 51 0x33, props: broadcast: 0, read: 1, write_nr: 0, write: 1, notify: 0, indicate: 0, auth: 0
12:49:04.700 -> Characteristic: uuid: 00001a01-0000-1000-8000-00805f9b34fb, handle: 53 0x35, props: broadcast: 0, read: 1, write_nr: 0, write: 1, notify: 1, indicate: 0, auth: 0
12:49:04.700 -> Characteristic: uuid: 00001a02-0000-1000-8000-00805f9b34fb, handle: 56 0x38, props: broadcast: 0, read: 1, write_nr: 0, write: 0, notify: 0, indicate: 0, auth: 0
12:49:04.700 ->  - Found our characteristic
12:49:04.734 -> The characteristic value was: Hex: E8 0 0 C3 0 0 0 0 0 0 2 3C 0 FB 34 9B  
12:49:04.734 -> Temperature: 23.20
12:49:04.734 -> Moisture: 0.00
12:49:04.734 -> Light: 195.00
12:49:04.734 -> Conductivity: 0
12:49:05.726 -> [44621] Connecting to ***************
12:49:07.778 -> [46666] Connected to WiFi
12:49:07.778 -> [46666] IP: ******************
12:49:07.778 -> [46666] 
12:49:07.778 ->     ___  __          __
12:49:07.778 ->    / _ )/ /_ _____  / /__
12:49:07.778 ->   / _  / / // / _ \/  '_/
12:49:07.778 ->  /____/_/\_, /_//_/_/\_\
12:49:07.813 ->         /___/ v0.6.1 on ESP32
12:49:07.813 -> 
12:49:07.813 -> [46672] Connecting to blynk-cloud.com:80
12:49:07.813 -> [46713] <[1D|00|01|00] ************************
12:49:07.847 -> [46735] >[00|00|01|00|C8]
12:49:07.847 -> [46735] Ready (ping: 21ms).
12:49:07.915 -> [46802] <[11|00|02|00]Fver[00]0.6.1[00]h-beat[00]10[00]buff-in[00]1024[00]dev[00]ESP32[00]build[00]Jun 16 2019 12:45:36[00]
12:49:12.854 -> [51736] Connecting to blynk-cloud.com:80
12:49:12.889 -> [51755] <[1D|00|01|00] *******************
12:49:12.889 -> [51774] >[00|00|01|00|C8]
12:49:12.889 -> [51774] Ready (ping: 17ms).
12:49:12.957 -> [51841] <[11|00|02|00]Fver[00]0.6.1[00]h-beat[00]10[00]buff-in[00]1024[00]dev[00]ESP32[00]build[00]Jun 16 2019 12:45:36[00]
12:49:12.990 -> [51861] >[00|00|02|00|C8]
12:49:13.024 -> [51911] <[14|00|03|00|0B]vw[00]6[00]23.200
12:49:13.091 -> [51980] <[14|00|04|00|0A]vw[00]7[00]0.000
12:49:13.157 -> [52048] <[14|00|05|00|0C]vw[00]8[00]195.000
12:49:13.225 -> [52115] <[14|00|06|00|06]vw[00]9[00]0
12:49:14.233 -> [53118] Disconnected
12:49:14.233 -> FREEHEAP END : 96704

So, I don’t know why it got stuck when connecting to your first Flora for you, but that is not a code issue. What I would do :

  • Check Flora address’
  • Try to switch first and second Flora (maybe the first one is defective)

Thank you to kaosss for sharing this sketch and the hard work that went into it. Just for anyone else that is wanting to use it:
1st issue I had, arduino complained it was missing timelib.h
Fixed this by downloading the full blynk library (see RTC Example not compiling)
2nd issue - Arduino said the sketch was too big for memory. (Sketch uses 1488370 bytes (113%) of program storage space. Maximum is 1310720 bytes). I have got around this for now by selecting Tools->Partition scheme -> HUGE APP (3MB No OTA/1MB SPIFFS). Hopefully that doesnt cause any issues for the sketch. There are some other partition schemes that I might be able to try if that does have issues. It has given me an initial reading from the flower care though, so thats a good start!

Further follow up. I tried to sleep for 4 hours. So I set TIME_TO_SLEEP to 14400 seconds. Unfortunately the ESP32 wakes up every 2 minutes, reports the value and goes back to sleep. It does this for about 30 minutes. Then it goes to sleep and never wakes back up. Not sure if there is a limit to the amount of time we can sleep or if there is another issue…Going to try 2 hours and see if that makes any difference.

Hi @B1ynk, firstly, post your complete code.
The last code I posted (#5 post) has still a TIME_TO_SLEEP line but doesn’t use deepsleep. Yes, I was lazy to delete it :slight_smile:

1 Like

Ah OK. Thank you for that. Is that simply because you didnt want deepsleep or were there issues with it? Ill add a line of code in to try and send it to sleep to try it…

From what I remember, it was because I had issues with deepsleep (no wakeup issue for example)

1 Like

Just following up - I used the deep sleep code and added a few modifications -
Try to connect to bluetooth, if that didnt work, go to sleep for an hour, to stop it polling if the flower care was out of range or has a flat battery.
Read sensor data and send the four measurements to blynk.
Take the reading every 4 hours and go to deep sleep in between. This should mean very low power usage from the ESP32, not connecting to the flower care too often, which would increase its power usage but still getting good data.
After looking online a bit more though, I found that the raspberry pi versions that connect to the flower cares are also pulling the battery status and historical results too. I didnt want to use the raspberry pi, just because the ESP32 can use almost no power in deep sleep. So ideally now I want to get ESP32 to pull the historical data. I could then possibly pull that historical data once a day, at night for example, and wouldnt need to read the live data at regular intervals.

Latest update - I can now read the 4 sensor values as well as the firmware and battery and send that data to blynk. I also have the details on pulling the historical data. Historical data would be better as I could just read the data at the end of each day and send the daily data to blynk. The problem I have though is that blynk wont accept the timestamp data for the supergraph. So I cant graph the data. I could put the data in a table but that doesnt sound like a better option then my current approach of reading the live values 6 times a day. So Im abandoning at this stage unless I can find a way to graph the data. My deepsleep is using about 120uA @ 3.3V. Ill try and post my code soon in case anyone wants to use it.

1 Like

Superchart accepts data in real time and adds its own timestamp.
You can’t save up data and load it in a batch, so you would need to upload your reading when it’s taken.

Pete.