TTN 1ch gateway, modif to 433Mhz

I have made a 1ch TTN gateway with the my heltec lora oled modules on hand.
1st, I found an working example with my boards from TTN forum:
info are here: http://ldsrc.blogspot.tw/2018/01/lorawan-working-example-from-network.html

The major work of 1ch gateway is from here: but in the forum has better steps.
http://things4u.github.io/
https://github.com/things4u/ESP-1ch-Gateway-v5.0

For gateway:
1. So, what I did to make it to 433Mhz, is to modify the frequency table in loraModem.h to like this:

/*
int freqs [] = { 
868100000, // Channel 0, 868.1 MHz primary
868300000, // Channel 1, 868.3 MHz mandatory
868500000, // Channel 2, 868.5 MHz mandatory
867100000, // Channel 3, 867.1 MHz
867300000, 
867500000, 
867700000, 
867900000, 
868800000, 
869525000 // Channel, for responses gateway (10%)
// TTN defines an additional channel at 869.525Mhz using SF9 for class B. Not used
};
*/
int freqs [] = {             // make a table for 433Mhz
  433175000,                  
  433375000,                
  433575000,                  
  433775000,                 
  433200000, 
  433250000,
  433975000,
  434175000,
  434375000,
  434575000,
  434775000  
};
the 433 table I used, comes from drgino. But the better solution is to follow the TTN frequency plan, and they are building up some more.

2. follow the instruction, ESP-sc-gway.h has to be modified.
- the default is :
#define ESP32BUILD  1
remove it if using 8266
-// Gateway Ident definitions
-NTP
-WPAS
3. dependency of lib:
SPIFFS and U8G2 libraries

For the device the code comes from : LMIC https://github.com/matthijskooijman/arduino-lmic
I also modified the frequency:
 LMIC_setupChannel(0, 433175000, DR_RANGE_MAP(DR_SF12, DR_SF7),  BAND_CENTI);      // g-band
    LMIC_setupChannel(1, 433375000, DR_RANGE_MAP(DR_SF12, DR_SF7B), BAND_CENTI);      // g-band
    LMIC_setupChannel(2, 433575000, DR_RANGE_MAP(DR_SF12, DR_SF7),  BAND_CENTI);      // g-band
    LMIC_setupChannel(3, 433775000, DR_RANGE_MAP(DR_SF12, DR_SF7),  BAND_CENTI);      // g-band
    LMIC_setupChannel(4, 433200000, DR_RANGE_MAP(DR_SF12, DR_SF7),  BAND_CENTI);      // g-band
    LMIC_setupChannel(5, 433250000, DR_RANGE_MAP(DR_SF12, DR_SF7),  BAND_CENTI);      // g-band
    LMIC_setupChannel(6, 433975000, DR_RANGE_MAP(DR_SF12, DR_SF7),  BAND_CENTI);      // g-band
    LMIC_setupChannel(7, 434175000, DR_RANGE_MAP(DR_SF12, DR_SF7),  BAND_CENTI);      // g-band
    LMIC_setupChannel(8, 434375000, DR_RANGE_MAP(DR_FSK,  DR_FSK),  BAND_MILLI);      // g2-band

and you also need to register your device,  and use the info provided for :
NWSKEY, APPKEY, DEVADDR

it works on uplink, but since my regiestration is using CH frequency plan and the real frequency defined is not the same, so there is no chance to get it work on down link.
Also the device seems to send every time on different frequency, so I got my traffic on gateway no on every cnt, but every 4(but this changes some times)

There is an other issue to look into,  not every package you see in the gateway's traffic will goes into application data, especially when you restart your gateway or device.


留言

這個網誌中的熱門文章

Heltec ESP32+OLED+Lora, hardware testing

micro SD card for ESP32, on lolin32 with OLED and heltec 32 lora oled

Install Network Time Protocol(NTP) on BeagleBone with Angstrom linux and set local time zone