TTN_esp32 library for Arduino

I’ve made a library very similar with TheThingsNetwork/arduino-device-lib.
but for ESP32 plateform. The link : https://github.com/rgot-org/TheThingsNetwork_esp32.
This made lmic very easy to use.
The library recognizes automatically the heltec boards (Wifi lora 32 V1 & V2 and Wireless stick)
Tell me what you think…

2 Likes

Thanks, very useful! It nicely hides all the complicated lmic stuff. Your library makes a simple sketch much more readable.

So, you can now use your phone to provision the device. I developed a small application for Android which communicates in bluetooth low energy (BLE) with the device. You can download it at the following address: https://play.google.com/store/apps/details?id=org.rgot.BLE_TEST
and use the example ttn-otaa-BLE-provisioning

1 Like

Hi! I successfully tested the ttn-otaa example for sending messages to TTN with Heltec Wifi lora 32 V2. But I am having some problems with downlink messages: it seems that it’s not donwloading anything. Where can I find more infos on the onMessage method?
Thank you!

Hello, Have you found a solution for this, Im having the same issues with the downlink onMessage function as well.

i can’t reproduce your issue
here is a my code for the void message function

void message(const uint8_t* payload, size_t size, int rssi)
{
	Serial.println("-- MESSAGE");
	Serial.print("Received " + String(size) + " bytes RSSI=" + String(rssi) + "db");
	for (int i = 0; i < size; i++)
	{
		Serial.print(" " + String(payload[i],HEX));
	}
	Serial.println();
}

here is a snapshot for downlink message
image

and here is the result in Serial console after cick on Schedule downlink

-- MESSAGE
Received 3 bytes RSSI=-44db a2 12 34

Note referring back to issues 1-2 year gone gets tricky as the whole TTN infrastructure has changed with the Dec’21 move from V2 to V3. What was a problem may not be so now making replication/debug difficult, similarly what worked before may now be broken or misbehaves as the back end is now more demanding of LoRaWAN compliance and esp good MAC and download handling behaviour. Perhaps not an issue here just warning…

I just tried to do the same and received this in my serial monitor.

-- MESSAGE
Received 3 bytes RSSI=-42db 3 33 0
void message (const uint8_t* payload, size_t size, int rssi)
{
  Serial.println("-- MESSAGE");
  Serial.print("Received " + String(size) + " bytes RSSI=" + String(rssi) + "db");
  for (int i = 0; i < size; i++)
  {
    Serial.print(" " + String(payload[i],HEX));
  }
  Serial.println();
}

down1

down2

May I see your full sketch? How did you get the same thing you sent down? I tried to replicate your code but I’m not getting a2 12 34

I released a new library that supports SX126X chips. It is based on the BASICMAC library.
Pin configuration is automatic for the cards I tested.
https://github.com/rgot-org/LoRaWan_esp32

Looking at an example (ttn-otaa-sleep) it looks like you join on every wake up from sleep. Is that correct? If so please fix this as does not work. After max 64K joins things will fail, not to mention the insane load it puts on the network as by requiring downlinks in evey wake-up.
Also it looks like you send evey 30 seconds which violates the fair use policy for TTN. Please fix this as well.

As it is based on Semtech’s abandoned BasicMac which was then abandoned by Lacuna, last update 4 years ago, have you patched in any of the changes from LMIC to bring it reasonably up to date particularly with expectations of MAC commands?

Porting to another platform is no mean feat, so kudos, but LW has gone hybrid with catalytic convertors now, the old gas guzzlers just ain’t good for the eco-system.