TTN single channel gateway with esp8266 for us frequency plan at 903.9Mhz
My region is fit for TTN 923 frequency plan, before making a 923 1ch gateway, it's good exercise to 1st make a 915 gateway.
Hardware: RFM95, ESP8266
I did not find the hardware guide for V5, but there is one for V4
http://things4u.github.io/HardwareGuide/Single-Channel-Gway/ESP-gateway-v4.html
short notice on hardware:
The version is done with 2 kinds PCB(3 in V5, additional heltec board) which related to pin connection.There are'
Comresult connections:
* The reset pin does not have to be connected so it seems. It is only used at setup to read the chip identification
** This connection is not necessary for the current version of the gateway, but is more versatile for next versions or other use
As you can see, both reset and GPIO0 of the ESP8266 are not used. Not connecting the last one makes the ESP8266 gateway more stable and the behavior between flash and normal mode is the same.
pin define are in ESP-sc-gway.h in V5 these pin defined are made with a board selection.
I did not find the hardware guide for V5, but there is one for V4
http://things4u.github.io/HardwareGuide/Single-Channel-Gway/ESP-gateway-v4.html
short notice on hardware:
The version is done with 2 kinds PCB(3 in V5, additional heltec board) which related to pin connection.There are'
Comresult connections:
For the bare board solutions the connections that need to be made are as follows:
RFM95 pin | ESP8266 pin | |
---|---|---|
3.3V | VCC | 3.3V |
GND | GND | |
MISO | D6 GPIO12/MISO | |
MOSI | D7 GPIO13/MOSI | |
SCK | D5 GPIO14/CLK (*) | |
NSS | D8 GPIO15/CS | |
RESET | *nc | |
DIO0 | D1, GPIO5 | |
DIO1 | D2, GPIO4 | |
DIO2 | D3, GPIO0 (**) |
** This connection is not necessary for the current version of the gateway, but is more versatile for next versions or other use
As you can see, both reset and GPIO0 of the ESP8266 are not used. Not connecting the last one makes the ESP8266 gateway more stable and the behavior between flash and normal mode is the same.
pin define are in ESP-sc-gway.h in V5 these pin defined are made with a board selection.
Charles Hallard
* The reset pin does not have to be connected so it seems. It is only used at setup to read the chip identification
** Soldering small diodes at the position shown above is quite difficult! And moreover, once you have soldered the ESP8266 to this board you cannot reach the diode position ever again. So (!) make sure you solder all 3 diodes (but at least 2) before continuing with this board.
As you can see, both reset and GPIO0 of the ESP8266 are not used. Not connecting the last one makes the ESP8266 gateway more stable and the behavior between flash and normal mode is the same.
RFM95 pin | ESP8266 pin | |
---|---|---|
3.3V | VCC | 3.3V |
GND | GND | |
MISO | D6 GPIO12/MISO | |
MOSI | D7 GPIO13/MOSI | |
SCK | D5 GPIO14/CLK (*) | |
NSS | D0 GPIO16/CS | |
RESET | *nc | |
DIO0 | D8, GPIO15 (**) | |
DIO1 | D8, GPIO15 (**) | |
DIO2 | D8, GPIO15 (**) |
** Soldering small diodes at the position shown above is quite difficult! And moreover, once you have soldered the ESP8266 to this board you cannot reach the diode position ever again. So (!) make sure you solder all 3 diodes (but at least 2) before continuing with this board.
As you can see, both reset and GPIO0 of the ESP8266 are not used. Not connecting the last one makes the ESP8266 gateway more stable and the behavior between flash and normal mode is the same.
SW: https://github.com/things4u/ESP-1ch-Gateway-v5.0
there are files to be configured:
_loraModem.h for pin define
ESP-sc-gway.h for SSID, PSWD
Start:
1. get fresh start
in version 5.06, there are 2 folders, 1, is libraries, 2 is named ESP-sc-gway
To get a fresh start, I copy these 2 into a new folder, the assigned the path in the arduino IDE preferences -> sketchbook location.
Then get a fresh start of arduino IDE. Version of gateway can be seen in the files.
2. modification in ESP-sc-gway.h
the defines are explainned in the github.
line 48: SF change to SF7, it said to be SF7, but not sure where can find it.
#define _SPREADING SF7
line 57: channel active detection
#define _CAD 0
line 82:
#define _PIN_OUT 1
the options are 1~4
// 1: HALLARD
// 2: COMRESULT pin out
// 3: ESP32 pin out
// 4: Other, define your own in loraModem.h
line 112:
#define AP_NAME "ESP8266-Gway-Things4U"
#define AP_PASSWD "ttnAutoPw"
change this to where you 1ch gway is connecting to:
line 135
#define OLED 1
1 is for 0.9", 2 is for 1.3"
line167 change to us one
#define _TTNSERVER "router.us.thethings.network"
line 178:
// Gateway Ident definitions
#define _DESCRIPTION "ESP Gateway"
#define _EMAIL "ldsrc2008@hotmail.com"
#define _PLATFORM "ESP8266"
#define _LAT 25.0
#define _LON 121.5
#define _ALT 1
I change email and lat/lon
line 186
// ntp
#define NTP_TIMESERVER "us.pool.ntp.org" // Country and region specific
#define NTP_TIMEZONES 8 // How far is our Timezone from UTC (excl daylight saving/summer time)
#define SECS_IN_HOUR 3600
#define NTP_INTR 0 // Do NTP processing with interrupts or in loop();
changed timezone to 8, will change NTP server later.
line222:
for the wpa[],
wpas wpa[] = {
{ "" , "" }, // Reserved for WiFi Manager
{ "ssid", "pswd" },
{ "", "" }
};
Now goes for lora_modem.h
line 58:
int freqs [] = {
903900000, // Channel 0, us fre plan
904100000, // Channel 0~7, 8 frequency
904300000, // Channel 2,
904500000, // Channel 3,
904700000,
904900000,
905100000,
905300000
};
and the FRF
#define FRF_MSB 0xE1 //
#define FRF_MID 0xF9 // 903.9 MHz /61.035 = 14809535 = 0xE1F9BF
#define FRF_LSB 0xBF
there are files to be configured:
_loraModem.h for pin define
ESP-sc-gway.h for SSID, PSWD
Start:
1. get fresh start
in version 5.06, there are 2 folders, 1, is libraries, 2 is named ESP-sc-gway
To get a fresh start, I copy these 2 into a new folder, the assigned the path in the arduino IDE preferences -> sketchbook location.
Then get a fresh start of arduino IDE. Version of gateway can be seen in the files.
2. modification in ESP-sc-gway.h
the defines are explainned in the github.
line 48: SF change to SF7, it said to be SF7, but not sure where can find it.
#define _SPREADING SF7
line 57: channel active detection
#define _CAD 0
line 82:
#define _PIN_OUT 1
the options are 1~4
// 1: HALLARD
// 2: COMRESULT pin out
// 3: ESP32 pin out
// 4: Other, define your own in loraModem.h
line 112:
#define AP_NAME "ESP8266-Gway-Things4U"
#define AP_PASSWD "ttnAutoPw"
change this to where you 1ch gway is connecting to:
line 135
#define OLED 1
1 is for 0.9", 2 is for 1.3"
line167 change to us one
#define _TTNSERVER "router.us.thethings.network"
line 178:
// Gateway Ident definitions
#define _DESCRIPTION "ESP Gateway"
#define _EMAIL "ldsrc2008@hotmail.com"
#define _PLATFORM "ESP8266"
#define _LAT 25.0
#define _LON 121.5
#define _ALT 1
I change email and lat/lon
line 186
// ntp
#define NTP_TIMESERVER "us.pool.ntp.org" // Country and region specific
#define NTP_TIMEZONES 8 // How far is our Timezone from UTC (excl daylight saving/summer time)
#define SECS_IN_HOUR 3600
#define NTP_INTR 0 // Do NTP processing with interrupts or in loop();
changed timezone to 8, will change NTP server later.
line222:
for the wpa[],
wpas wpa[] = {
{ "" , "" }, // Reserved for WiFi Manager
{ "ssid", "pswd" },
{ "", "" }
};
Now goes for lora_modem.h
line 58:
int freqs [] = {
903900000, // Channel 0, us fre plan
904100000, // Channel 0~7, 8 frequency
904300000, // Channel 2,
904500000, // Channel 3,
904700000,
904900000,
905100000,
905300000
};
and the FRF
#define FRF_MSB 0xE1 //
#define FRF_MID 0xF9 // 903.9 MHz /61.035 = 14809535 = 0xE1F9BF
#define FRF_LSB 0xBF
202/09/22
I compiled the same code which is this version:
// 1-channel LoRa Gateway for ESP8266
// Copyright (c) 2016, 2017 Maarten Westenberg version for ESP8266
// Version 5.0.6
// Date: 2018-02-12
with newer arduino version 1.8.13, and a new board manager definition file 8266 2.5.2,
I got an error:
ambiguous overload for 'operator+=' (operand types are 'String' and 'IPAddress')
After searching, some one recommend to use Boards Manager - ESP8266 - version 2.4.2
and compile is fine now...
But I keep on getting watch dog reset
留言
張貼留言