Need help with my first TTN node

Its helpful to the forum if you tell us what the actual problem you had was.

However I could not modify the sketch to be able to send sensor data (for example DHT11) to TTN.

Did you get compile errors, or did it appear to work, but no data recieved in TTN or what ?

Lmic library has an example for ttn-otaa-dht22 for feather; tried to adapt it to Arduino, but even then no luck.

So what was the problem here ?

Imst ic880a + Pi 3 (868mhz)

In all cases (Robert lie code, adaptation of otaa-dht-feather code), the code gets compiled and gets uploaded successfully. Upon opening serial monitor, it says ‘Starting’, and then nothing happens after that.

pinmapping could be wrong… this part of the sketch, check that first

// Pin mapping
const lmic_pinmap lmic_pins = {
.nss = 10,
.rxtx = LMIC_UNUSED_PIN,
.rst = 5,
.dio = {2, 3, LMIC_UNUSED_PIN},
};

Could well be a pin mapping issue, as @BoRRoZ suggested.

One test, is to deliberatly change say the .nss pin to a ‘wrong’ pin and see if the error is the same.

I’ve double checked the pin mapping (w.r.t schematic) and its correct. As I said before, I used the corrected form of the circuit mentioned in post#1. In addition I’ve interfaced DHT11 sensor to the circuit. The pin mapping in my case is as follows:

// Pin mapping
const lmic_pinmap lmic_pins = {
.nss = 4,
.rxtx = LMIC_UNUSED_PIN,
.rst = 2,
.dio = {3, 5, LMIC_UNUSED_PIN},
};

I ran both the sketches again, and I see the same ‘Starting’ in case of robertlie’s sketch, and ‘Start?p’ in case of ttn-otaa-feather sketch. And nothing happens after that.

I’ve tried @LoRaTracker’s suggestion as well. The following is the output on serial monitor in that case:
Starting
FAILURE
C:\Users\Sam\Documents\Arduino\libraries\MCCI_LoRaWAN_LMIC_library\src\lmic\oslmic.c:53

I realized something, my node is connected to TTN as I could see the status ‘x’ minutes ago, which is altogether a new development. I could also see devadd, appeui and deveui (just once) in the Data tab. However I’m not sure which of the two codes partially worked (in the sense connected to TTN)

Don’t know what’s happening.

Adafruits tutorial code for their board includes checks to see if the board is responding correctly (i.e. that its connected correctly) did you try that code ?

Can you please send the link?

By any chance, is it because I’m not using logic converter (I’m using G1 pin of rfm95 breakout)? But there were no issues when I was sending Hello World message to TTN.

Sorry if my questions/comments seem to be too dumb, I’m completely a novice in IOT and LoRaWAN.

I found it via a Google search.

That breakout board does not have logic level converters on the RFM95 DIO pins, and it should really as even if the respective voltage regulators are exatly 3.3V and 5V, its marginally out of specification, although in most cases its going to work.

If the 3.3V regulastor is slighty low and the 5V regulator is slightly high then a logic level converter may be required.

However if the hello world example worked, you migh conclude that its not a logic level conversion issue.

Its also worth mentioning that the Adafruit board does not have input protection on DIO2, this pin can be used on the RFM95 as an input, so feeding 5V into it may not do the RFM95 a lot of good.

Thanks for your inputs. Do you mean to say that I’ll have to use logic converter to make the board work?

I did say;

"although in most cases its going to work"

1 Like

If logic converter is the reason, I suppose using a board which works on the same logic as that of lora module is better. How about Adafruit feather M0 with RFM95 lora?

If somebody can share their experience of using feather M0 with RFM95 for sending sensor data to TTN, it would be great. I’m sure the example code in Lmic library (ttn-otaa-feather-dht22) can directly be used for the purpose.

No, don’t change this topic ! you’re allready trying too hard and too long

Its years since I have bothered with 5V Arduinos, for 99.9% of modern devices you end up having to use logic level converters.

And at the SPI speeds used with LoRa devices a lot of logic level convertors are highly marginal.

Not really, even at 5.5v VIH of an ATmega is still below 3v.

That said a LoRaWAN node likely does nothing where running an ATmega at 8 MHz and 3.3v would not work.

The feather M0 probably is one of the more thoroughly supported platforms for LMiC, especially the MCCI LMiC repo (they have their own STM32 boards as well).

In contrast ESP32 is pretty much completely broken in terms of receive timing. I think ESP8266 may work, but never really tried that.

If one looks that up, it’s the following line:

static void startrx (u1_t rxmode) {
ASSERT( (readReg(RegOpMode) & OPMODE_MASK) == OPMODE_SLEEP );

Typically this indicates an SPI communication failure, but it can also be a result of unexpected program flow (ie, getting here when the radio has not actually been put to sleep). You can try temporarily commenting out the ASSERT and seeing if you get any further.

FAILURE
C:\Users\Sam\Documents\Arduino\libraries\MCCI_LoRaWAN_LMIC_library\src\lmic\oslmic.c:53

This appears to most likely result from a failure of radio_init() - probably again a communication issue, such as a wiring mixup etc.

If you are using jump wires, make sure they all have continuity, twice recently I’ve found bad ones.

Make sure MOSI and MISO aren’t swapped. Ideally look at the SPI signals with a scope or logic analyzer.

Make sure the RFM95 breakout’s regulator is giving an output.

Input%20High%20Voltage

(2. “Min.” means the lowest value where the pin is guaranteed to be read as high)

At VCC = 5.5V then Vih = 5.5V x 0.6 = 3.3V ?

At VCC = 5V then Vih = 5V x 0.6 = 3.0V ?