How to connect CubeCell to TTN (the things network)

Updated the instructions for using CubeCell, how to use CubeCell’s LoRaWAN example, via AT commands to configure DevEui, AppKey, and finally connect to TTN.:kissing_heart:

https://docs.heltec.cn/#/en/user_manual/how_to_connect_cubecell_to_ttn-the-things-network

1 Like

Hi,

It’s quite unclear how the TTN parameters should be injected in the code from the example.

My board displays:

Copyright @ 2019 Heltec Automation.All rights reserved.
LoRaWan ClassA test start! 

+LORAWAN=1

+OTAA=1
+Class=A
+ADR=1
+IsTxConfirmed=1
+AppPort=2
+DutyCycle=15000
+ConfirmedNbTrials=8
+DevEui=2232330000888802(For OTAA Mode)
+AppEui=0000000000000000(For OTAA Mode)
+AppKey=88888888888888888888888888886601(For OTAA Mode)
+NwkSKey=D72C78758CDCCABF55EE4A778D16EF67(For ABP Mode)
+AppSKey=15B1D0EFA463DFBE3D11181E1EC7DA85(For ABP Mode)
+DevAddr=007E6AE1(For ABP Mode)

joining...

Can you give us some more information ? Specifically where to enter the DevEui, AppEui and AppKey for OTAA.

Thanks.

Just type in any key in you Terminal and the cubecell will wake up.
After that type

AT+DevEui=2232330000******

AT+AppKey=888888888888888888888888********
AT+AppEui=70B3D57ED00*****

With your keys to set them.
The cubecell will Echo an ok.

After that reset the board with

At+reset=1

Thanks! It works.

This can be done from the Arduino serial console (no newline)

The right command at the end is AT+RESET=1 (all caps)

How do I set the sub band when using AU915?

The lmic-library contains a file “lmic_project_config.h”

// project-specific definitions
#define CFG_eu868 1
//#define CFG_us915 1
//#define CFG_au921 1
//#define CFG_as923 1
// #define LMIC_COUNTRY_CODE LMIC_COUNTRY_CODE_JP /* for as923-JP */
//#define CFG_in866 1
#define CFG_sx1276_radio 1
//#define LMIC_USE_INTERRUPTS

thanks @ernst.schulz , I am aware of that when using LMIC.

But was specifically asking about when using the Cubecell library

Sorry, you do that in the Arduino-IDE.

When you choose the Board “CubeCell” you find a selection menu LORAWAN_REGION!

Yes thanks I have got that far as well.

I have it set on AU915 but this frequency plan has 64 channels.

Gateways setup on TTN using AU915 use the sub-band 2 - or channels 8-15, so at the moment my cubecell is only getting around every 8th message through as it gets lucky and transmits on that sub-band, also takes ages to join.

cheers
Paul

Hello,

This is my first post here. I’m having trouble connecting a CubeCell DevBoard to an HT M01 gateway. I’m using the cubecell example for OTAA but when I use AT commands in the Arduino serial port to query or change DevEui or the other keys I get an error saying the command requires exactly 16 bits/32 bits

I’m pretty stumped as to what to do. I’m hoping to use the cube cell dev boards to monitor a greenhouse with a BME280. Any help is much appreciated

You can check if you have entered a terminator, a newline or extra spaces.
image

Thank you Quency-D for your timely response.

That is how I entered the command for DevEui and I still get this message stating “exactly 16 bytes are expected.” I also get a similar message for AT+DevEui=?

Ahhh, you were right Quency-D. I had line editing turned on that I wasn’t aware of. Thank you very much :slight_smile:

I can now see the node sending a join request and in the application I can see that the node status is green.

However in the serial monitor of the node I’m getting a message “join failed, join again at 30s later”

Here’s a screenshot of the serial monitor and the gateway traffic console. In the gateway traffic console there’s a difference in frequency, BW of data rate, and airtime. Could these settings be why I’m unable to connect to ttn with this node?

what region do have you compiled your sketch for?

if you are using AU915 you have to call the following function in the main loop just before the command LoRaWAN.join() for using SubBand 2:

void setSubBand2()
{
Serial.println(“setSubBand2”);
// Enabling only 2nd block of 8 channels (8-15) + channel 65
MibRequestConfirm_t mibReq;
uint16_t channelMask[] = { 0xFF00, 0x0000, 0x0000, 0x0000, 0x0002, 0x0000};
mibReq.Type = MIB_CHANNELS_MASK;
mibReq.Param.ChannelsMask = channelMask;
LoRaMacMibSetRequestConfirm( &mibReq );
}

This status means TTN had already received the join request and accepted. But the downlink message is not been received.

@wasn provided the best solution:+1:

https://heltec-automation-docs.readthedocs.io/en/latest/general/sub_band_usage.html

Thanks wasn and Supporter!

I’ve been away the computer these last few days. I’ll try your suggestion when I can be back at the computer and I’ll let you know how it goes :slight_smile:

Hi Supporter and Wasn,

After taking some time away from the CubeCell from being frustrated, I jumped back on the computer today to give it another shot.

After taking another look at your advice, I’m not sure that’s what I need to do as I am in the US and everything is using US parameters. Although, I did see in the Lora sdk that around 18 days ago it was updated with a file that included US sub band usage. Should I be using that file in the global_conf file?

I also found that the CubeCell is rejecting the downlink acknowledgment of the join request from the HTM01 because the RF power of the Tx message isn’t supported:

ERROR: Packet REJECTED, unsupported RF power for TX -17

Please help me :slight_smile:

-Sal