Feather 32u4 with TinyLoRa for weeks-long balloon contest

I followed the tutorial, I implemented the example code from the How to send multiple numbers? part. My code looks like this:

byte payloadA = { 0xF0 };
byte payloadB = { 0x0F };
int sizeofPayloadA = sizeof(payloadA);
int sizeofPayloadB = sizeof(payloadB);
byte payload[sizeofPayloadA + sizeofPayloadB];
memcpy(payload, payloadA, sizeofPayloadA);
memcpy(payload + sizeofPayloadA, payloadB, sizeofPayloadB);
LMIC_setTxData2(1, payload, sizeof(payload)-1, 0);

It sends only the first byte. Why is that?

The -1 in the last line is for sending null-terminated string values. (Which is very much discouraged.) For that, the terminating null-character does not need to be sent. In your case, remove the -1, so:

LMIC_setTxData2(1, payload, sizeof(payload), 0);
1 Like

Thanks, it worked.

Also, I have a problem. The code needs to be very energy-effecient. I need to replace “delay(x);” with “Watchdog.enable(x)” so the processor will be dissabled. But when I look at the lmic code, there is no delay there. Just: “const unsigned TX_INTERVAL = 30”. I know that the delay function is located somewhere deep in the library. I couldn’t find it. I just need help locating it so I can replace it with the Watchdog function. That should work, right?

Unlikely you will find a single delay corresponding to TX_INTERVAL. LMIC schedules processes at specific times, and your transmission is only one of them (disclaimer: I have a vague knowledge of its internals).

One way to introduce sleep/delays is to escape from the main execution model. There is some example where delays and sleep are put just after the TX_COMPLETE event, but during sleep also internal time is not updated so some workaround is needed to avoid that transmission is further delayed to satisfy duty cycle limitations (though if you send every hour it might not be problematic).
You may also use an external RTC to switch on/off the board when needed…

Hi @Maker_Bois,
I got the Adafruit feathers to work with both LMIC and TinyLora. Let me know if you still need help.
This tutorial covers it well, with the only exception that it doesn’t mention that you have to change region (default is US, I am EU).
Best

No thanks.

Thanks to your support we managed to get it working in time. We were second in the picoballoon contest. We published a YouTube video and an Instructable regarding this, and we won the runner up prize with it. Thank you!

1 Like

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