CongducPham / LowCostLoRaGw

Low-cost LoRa IoT & gateway with SX12XX (SX1261/62/68; SX1272/76/77/78/79; SX1280/81), RaspberryPI and Arduino boards
698 stars 352 forks source link

How to connect gateway to the TTN, I tried, but, the status was not connected #266

Open irwan-syh opened 4 years ago

irwan-syh commented 4 years ago

How to connect gateway to the TTN, I tried, but, the status was not connected, i am use LoRa SX1278, please explain, if u have idea

image

bkrajendra commented 4 years ago

no success for me too. Any idea how you configured gateway on ttn.

CongducPham commented 4 years ago

Hi, did you check that you have the following setting?

CongducPham commented 4 years ago

Also make sure that you have the correct gw id. I see on your screenshot that the gw id you are using for TTN is b827ebffffefc4a6, it means that the MAC address of your RPI must be b827ebefc4a6, is that correct?

ivanspirit commented 4 years ago

Happy New Year to All !! First I'll want to express my greetings to the great work you've done.

Sorry for the stupid question but I've tried a lot and read carefully everything and still no success to connect the GW to the TTN. Proper configuration for the json files and modes and AES ext. but where to put the long key from TTN-server provided the "Gateway Key"? May be I'm missing something very important here?!

bkrajendra commented 4 years ago

me too. I was trying it to work with 433Mhz but nothing worked. tried lot other gateway implementation but nothing worked with RPI. Only ESP8266 gateway worked.

I ordered 868Mhz Modules now (RF95 finally) and will try with it as most supports are with 915 and 868Mhz frequencies.

Will update my findings here.

CongducPham commented 4 years ago

To connect the GW to TTN, at the gateway side the lora mode should be set to 11, raw format should be set to true, aes_lorawan set to false and CloudTTN.py enabled in the "lorawan_encrypted_clouds" section of clouds.json. See here https://github.com/CongducPham/LowCostLoRaGw/blob/master/gw_full_latest/README-TTN.md#ttn-and-lorawan

At the device, take the Arduino_LoRa_temp.ino example and uncomment the following define statements:

define WITH_AES

define LORAWAN

define MY_FREQUENCY 868.1

then fill in the NetSKey, AppSKey and DevAddr with those from the TTN console.

/////////////////////////////////////////////////////////////////// //For TTN, use specify ABP mode on the TTN device setting

/////////////////////////////////////////////////////////////////// //ENTER HERE your App Session Key from the TTN device info (same order, i.e. msb) unsigned char AppSkey[16] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; ///////////////////////////////////////////////////////////////////

//this is the default as LoRaWAN example //unsigned char AppSkey[16] = { 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C };

/////////////////////////////////////////////////////////////////// //ENTER HERE your Network Session Key from the TTN device info (same order, i.e. msb) unsigned char NwkSkey[16] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; ///////////////////////////////////////////////////////////////////

//this is the default as LoRaWAN example //unsigned char NwkSkey[16] = { 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C };

/////////////////////////////////////////////////////////////////// // LORAWAN OR EXTENDED DEVICE ADDRESS FOR LORAWAN CLOUD

if defined LORAWAN || defined EXTDEVADDR

/////////////////////////////////////////////////////////////////// //ENTER HERE your Device Address from the TTN device info (same order, i.e. msb). Example for 0x12345678 unsigned char DevAddr[4] = { 0x12, 0x34, 0x56, 0x78 }; ///////////////////////////////////////////////////////////////////

ivanspirit commented 4 years ago

Hi Congduc and thanks for the guide!

Now I'm able to connect the GW to TTN and the status is "Connected" (My mistake was that I was trying to put different MAC as a GW ID but didn't noticed that after reset the GW ID in json file was changed by the software)

New problem arises then, after sending a packet from lorawan node the lora_gateway starting to give endless "Receive Error 1" code? Any ideas ?

Update: "Receive Error 1" came from a bad RPi SPI port, I've changed the RPi units and reinstall GW and now everything is working! My be I was managed somehow to damage the RPi board. Many thanks for the support!

CongducPham commented 4 years ago

Good to hear! An update of the web admin interface has been realized to better handle lorawan and also allow locally installed ChirpStack network server. best regards,