TPL5110 + LoRa communication

Hello!

Begginer here, I'm trying to sense temperature and humidity with an Adafruit SHTC3 connected to an Arduino MKR WAN 1300, and then send that data to The Things Network. No problem with that, the network is configured correctly and the data is sent from my Arduino using LoRa every 10 min (it senses, goes into sleep mode, and wakes up when it needs to sense again) and received correctly from TTN.

But power consumption was too large in sleep mode, so I bought a TPL5110 to try and replicate this: GitHub - AmedeeBulle/TTNMkrWanNode: Ultra Low Power with Arduino MKR WAN

My problem is, when I try to do this, communication starts, but the message won't reach TTN. The live data stream will look like this:

Only if I add a delay of ~10s after the package is sent and before I activate the TPL to "power off" the Arduino, the message reaches its destination. Any idea why this happens or how could I get it to work without that delay so I can minimize power consumption? This is my code with the delay:

// Importacion de librerias
#include <MKRWAN.h>
#include "Adafruit_SHTC3.h"

// Instancia de objetos 
Adafruit_SHTC3 shtc3 = Adafruit_SHTC3(); // Permite interaccion con el sensor SHTC3
LoRaModem LoRa; // Permite configuracion y control de la comunicacion LoRa

// Configuracion de los parametros de LoRa en TTN
String appEui = "";  // EUI de la aplicacion en TTN
String appKey = "";  // Key de la aplicacion en TTN

// Declaracion de variables para el temporizador del programa
//const unsigned long interval = 600000; // Constante que representa el intervalo de tiempo antes de realizar nuevo envio de datos (en milisegundos; 10000ms = 10s)

sensors_event_t humidity, temp; // Se capturan los datos de temperatura y humedad

const byte pinDone = 7; // Pin conectado al TPL5110

// Configuracion inicial
void setup() {
  pinMode(pinDone, OUTPUT);

  // Configuracion e inicializacion del modulo en la region EU868 (UE)
  if (!LoRa.begin(EU868)) { // Se verifica la iniciacion del modulo
    while (1);
  }

  if (!LoRa.joinOTAA(appEui, appKey)) { // Se verifica la iniciacion del modulo
    while (1);
  }
  
  LoRa.setPort(3); // Se configura el puerto LoRa  3

  // Inicializacion del sensor SHTC3
  if (!shtc3.begin()) { // Verificacion de la inicializacion del sensor
    while (1); // Bucle infinito para detener la ejecucion del programa si se produjo un error en la inicializacion del sensor
  }
}

void loop() {
  SenseAndSend();
  delay(12000);
  GoToSleep();
}

void SenseAndSend() {
  shtc3.getEvent(&humidity, &temp); // El resultado de la medida se almacena en la variable result
  String message = "Temperatura: " + String(temp.temperature) + ", Humedad relativa: " + String(humidity.relative_humidity);
  // Se envia la cadena a traves de LoRa
  LoRa.beginPacket(); // Inicializacion de un paquete LoRa
  LoRa.print(message); // Se envia la cadena a traves de LoRa
  LoRa.endPacket();
  LoRa.sleep();
}

void GoToSleep(){
  //LowPower.idle(interval);
  digitalWrite(pinDone, LOW);
  delay(1);
  digitalWrite(pinDone, HIGH);
  delay(1);
}

appEui and Key are left blank on purpose to upload it here

Your code looks completely different to that used in the link you posted.

How are you saving the session data after the first TTN join ?

The example code used in the link given uses a FRAM for that purpose.

I'm fully aware, I'm just using that repository for the schematics and the control of the PLT.

Also I'm not saving anything in the FRAM yet, since the problem is that the message is not sent in the first cycle to begin with, UNLESS, as I've said, I delay the activation of the PLT.

Thanks for the "help"

So every time you restart the node, it does another join ?

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