Big ESP32 + SX127x topic part 3

Oh, and I’ve checked if the boards transmit with the simple lora sketch using the example provided by heltech. It’s VERY visible on my SDR, so the boards aren’t broken.

Hi,

I am triying to get a very basic setup to work but i have not had any success.

The node i am using is a heltec v2 the one with the v2 printed on the board next to the antenna. the configuration i am using is this:

const lmic_pinmap lmic_pins = {
.nss = 18,
.rxtx = LMIC_UNUSED_PIN,
.rst = 14,
.dio = { 26, 35, 34 },
// .rxtx_rx_active = 0,
// .rssi_cal = 0,
// .spi_freq = 0
};


on the config.h i made a change

//#define CFG_eu868 1

#define CFG_us915 1

changed the Eu frequency for the US one since my gateway is 915.

the commented lines are used but when i try to compile with them it said that they were not defined. the sketch compiles but i have some questions.

the question i have is what frequency do i need to set in the sketch since it says this:

#elif defined(CFG_us915)
// NA-US channels 0-71 are configured automatically
// but only one group of 8 should (a subband) should be active
// TTN recommends the second sub band, 1 in a zero based count.
// https://github.com/TheThingsNetwork/gateway-conf/blob/master/US-global_conf.json
LMIC_selectSubBand(1);

so from what i can see the frecuency it is going to use is 904.1 MHZ but i am not sure.

the configuracion on my single channel dragino hat 1.4 is:

/*******************************************************************************
*

  • Configure these values!

*******************************************************************************/

// SX1272 - Raspberry connections
int ssPin = 6;
int dio0 = 7;
int RST = 3;

// Set spreading factor (SF7 - SF12)
sf_t sf = SF7;

// Set center frequency
uint32_t freq = 904100000; // in Mhz! (904.1)

// Set location
float lat=6.2;
float lon=71.6;
int alt=1600;

/* Informal status fields /
static char platform[24] = “Single Channel Gateway”; /
platform definition /
static char email[40] = "lucas.restrepogil@gmail.com"; /
used for contact email /
static char description[64] = “este es my gateway”; /
used for free form description */

// define servers
// TODO: use host names and dns
#define SERVER1 “52.169.76.203” // The Things Network: croft.thethings.girovito.nl
//#define SERVER2 “52.169.76.255” // local
#define PORT 1700 // The port on which to send data

// #############################################
// #############################################

i can see that the gateway registers with the ttn network but i dont see any messages going from the node to the console of the application.

Please help me because i dont know what else to do.

thank you very much.

I tried to connect a BME280 to a TTGO lora32 v2.0 but it seems that it doesn’t work (others I2C sensors seem to work fine). Could someone tell me how to do it? Any help is extremely welcome. Thanks in advance.

If ‘other’ I2C sensors are working with your TTGO, then it seems TTGO has a working I2C.

Run an I2C scan to see if the BME280 is detected.

Hi, thanks for your reply! I’ve already use an I2C scanner sketch, some of my BME280 don’t show any address but the ones I’m using now show the right I2C address. I have used the BME280s in many projects but with the TTGO LoRa32 v2.0 they seem not to work in any way.

This turned up in a forum search for TTGO BME280;

1 Like

Hey everyone!

Last night I was working on my TTGO LoRa32 (V2.1_1.6) and I’m used to using the tinyLoRa library instead of LMIC as it’s a much smaller library and tends to result in a simple sketch. I’ve managed to successfully port the library over for use with the ESP32.

There are three example sketches, a “Hello World!” for broadcasting on all channels, the same example but you can specify a channel and the third implements a DHT sensor reading.

Unfortunately tinyLoRa only supports ABP authentication with no support for OTAA. The repo default region is currently set to AU915, however this can easily be changed by editing the TinyLoRa.h file

If you want to contribute pin mappings for different board versions I’m open to pull requests! More basic examples would be great to see too.

https://github.com/GreensladeNZ/TinyLoRa

Thank you, but seems to be a little different for the TTGO T-Beam . I’ve already used a BME280 with the T-Beam without any effort. But how to make the BME280 work with the TTGO LoRa32 v2.0 for me is still a mistery. I have always used the BME280s via I2C in many other projects. The TTGO seems to recognize all the other I2C sensors except for the BME280s (I2C scanner show the correct addresses of the sensors but 0 or -1 values are shown for temperature, pressure and humidity) .

Check pullup resistors on the i2c bus.

Did you use the OLED I2C bus or etablished a second I2C?
I couldn’t get the last scenario to run without problems. Therefore I switched to the native OLED I2C bus without further pullup resistors.
It is a Heltec V2 with BME280 icombined layout for SPI and I2C and it runs as test environment for TTN and dragino Pi Hat two channel.
It works stable with LMIC and SSD1306 (not adafruit) libraries.

Trying to get TTGO lora32 v2.1 1.6 to transit some data with pax counter to TTN network, but no luck for some week now. Read all the fourm topics with great interest, been trying like 25 different configurations now. Best i have gotten is OTAA to show up in TTN console with yellow lightning icon - gues that means that my node is transmitting but can not receive downlink to finish OTAA.
Anywayz, here is my terminal output now:

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 188777542, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:1100
load:0x40078000,len:9232
load:0x40080400,len:6412
entry 0x400806a8
[I][main.cpp:134] setup(): Starting JKLoRa v1.7.841
[I][main.cpp:147] setup(): This is ESP32 chip with 2 CPU cores, WiFi/BT/BLE, silicon revision 1, 4MB embedded Flash
[I][main.cpp:149] setup(): Internal Total heap 276016, internal Free Heap 250136
[I][main.cpp:155] setup(): ChipRevision 1, Cpu Freq 240, SDK Version v3.2-18-g977854975
[I][main.cpp:157] setup(): Flash Size 4194304, Flash Speed 40000000
[I][main.cpp:158] setup(): Wifi/BT software coexist version 1.1.5
[I][main.cpp:162] setup(): IBM LMIC version 1.6.1468577746
[I][main.cpp:167] setup(): Arduino LMIC version 2.3.2.51
[I][macsniff.cpp:36] printKey(): DevEUI: 0095C14C57C8F4B3
[I][macsniff.cpp:36] printKey(): AppEUI: 70B3D57ED001FFC5
[I][macsniff.cpp:36] printKey(): AppKey: A860779DDA222AF889DF17967C94FA4C
[I][configmanager.cpp:185] loadConfig(): Reading settings from NVS
[I][configmanager.cpp:50] open_storage(): Opening NVS
[I][configmanager.cpp:55] open_storage(): Done
[I][configmanager.cpp:199] loadConfig(): NVRAM settings version = 1.7.841
[I][configmanager.cpp:217] loadConfig(): bsecstate = 0
[I][configmanager.cpp:222] loadConfig(): lorasf = 9
[I][configmanager.cpp:230] loadConfig(): txpower = 15
[I][configmanager.cpp:238] loadConfig(): adrmode = 1
[I][configmanager.cpp:246] loadConfig(): screensaver = 0
[I][configmanager.cpp:254] loadConfig(): screenon = 1
[I][configmanager.cpp:262] loadConfig(): countermode = 0
[I][configmanager.cpp:270] loadConfig(): sendcycle = 30
[I][configmanager.cpp:278] loadConfig(): wifichancycle = 50
[I][configmanager.cpp:286] loadConfig(): wifiantenna = 0
[I][configmanager.cpp:294] loadConfig(): vendorfilter = 1
[I][configmanager.cpp:302] loadConfig(): rgbluminosity = 30
[I][configmanager.cpp:310] loadConfig(): blescantime = 8
[I][configmanager.cpp:318] loadConfig(): BLEscanmode = 0
[I][configmanager.cpp:326] loadConfig(): rssilimit = 0
[I][configmanager.cpp:334] loadConfig(): payloadmask = 255
[I][configmanager.cpp:342] loadConfig(): Monitor mode = 0
[I][configmanager.cpp:350] loadConfig(): Run mode = 0
[I][configmanager.cpp:357] loadConfig(): Done
[I][main.cpp:215] setup(): Starting LED Controller…
[I][battery.cpp:30] calibrate_voltage(): ADC characterization based on reference voltage stored in eFuse
[I][lorawan.cpp:424] lora_stack_init(): LORA send queue created, size 530 Bytes
[I][lorawan.cpp:426] lora_stack_init(): Starting LMIC…
RXMODE_RSSI
[I][main.cpp:345] setup(): Starting Wifi…
I (4939) wifi: wifi driver task: 3ffc1eac, prio:23, stack:3584, core=0
I (9963) wifi: wifi firmware version: 6d404d4
I (9965) wifi: config NVS flash: disabled
I (9969) wifi: config nano formating: disabled
I (9974) wifi: Init dynamic tx buffer num: 32
I (9977) wifi: Init data frame dynamic rx buffer num: 10
I (9982) wifi: Init management frame dynamic rx buffer num: 10
I (9988) wifi: Init static rx buffer size: 1600
I (9992) wifi: Init static rx buffer num: 8
I (9996) wifi: Init dynamic rx buffer num: 10
I (10000) wifi: set country: cc=EU␀ schan=1 nchan=13 policy=1

W (10006) wifi: ap start fail

I (10068) wifi: ic_enable_sniffer
[I][main.cpp:359] setup(): Starting Interrupt Handler…
[I][main.cpp:389] setup(): Starting Timers…
[I][main.cpp:455] setup(): Starting Timekeeper…
[I][timekeeper.cpp:105] timepulse_init(): Timepulse: internal (ESP32 hardware timer)
[I][main.cpp:462] setup(): Features: LED BATT LORA OLED PLAIN WIFI
[I][lorawan.cpp:339] onEvent(): JOINING
316860: engineUpdate, opmode=0x4
317147: TXMODE, freq=868100000, len=23, SF=7, BW=125, CR=4/5, IH=0
625489: setupRx1 txrxFlags 00 --> 01
start single rx: now-rxtime: 34
625653: RXMODE_SINGLE, freq=868100000, SF=7, BW=125, CR=4/5, IH=0
rxtimeout: entry: 641981 rxtime: 625608 entry-rxtime: 16373 now-entry: 13 rxtime-txend: 304596
642048: setupRx2 txrxFlags 0x1 --> 02
start single rx: now-rxtime: 17848
642216: RXMODE_SINGLE, freq=869525000, SF=12, BW=125, CR=4/5, IH=0
rxtimeout: entry: 801945 rxtime: 624332 entry-rxtime: 177613 now-entry: 12 rxtime-txend: 303320
802009: processRx2Jacc txrxFlags 0x2 --> 00
[I][lorawan.cpp:339] onEvent(): JOIN WAIT
802269: engineUpdate, opmode=0x4
[D][cyclic.cpp:36] doHousekeeping(): IRQhandler 2200 bytes left | Taskstate = 0
[D][cyclic.cpp:53] doHousekeeping(): LEDloop 572 bytes left | Taskstate = 2
[I][cyclic.cpp:59] doHousekeeping(): Voltage: 4266mV
[D][cyclic.cpp:36] doHousekeeping(): IRQhandler 2200 bytes left | Taskstate = 0
[D][cyclic.cpp:53] doHousekeeping(): LEDloop 556 bytes left | Taskstate = 2
[I][cyclic.cpp:59] doHousekeeping(): Voltage: 4170mV
4450374: engineUpdate, opmode=0x4
4450593: TXMODE, freq=868300000, len=23, SF=7, BW=125, CR=4/5, IH=0
4758931: setupRx1 txrxFlags 00 --> 01
start single rx: now-rxtime: 28
4759087: RXMODE_SINGLE, freq=868300000, SF=7, BW=125, CR=4/5, IH=0
rxtimeout: entry: 4775425 rxtime: 4759054 entry-rxtime: 16371 now-entry: 13 rxtime-txend: 304596
4775490: setupRx2 txrxFlags 0x1 --> 02
start single rx: now-rxtime: 17830
4775692: RXMODE_SINGLE, freq=869525000, SF=12, BW=125, CR=4/5, IH=0
rxtimeout: entry: 4935371 rxtime: 4757778 entry-rxtime: 177593 now-entry: 13 rxtime-txend: 303320
4935437: processRx2Jacc txrxFlags 0x2 --> 00
[I][lorawan.cpp:339] onEvent(): JOIN WAIT
4935719: engineUpdate, opmode=0x4
[D][cyclic.cpp:36] doHousekeeping(): IRQhandler 2200 bytes left | Taskstate = 0
[D][cyclic.cpp:53] doHousekeeping(): LEDloop 556 bytes left | Taskstate = 2
[I][cyclic.cpp:59] doHousekeeping(): Voltage: 4090mV
[D][cyclic.cpp:36] doHousekeeping(): IRQhandler 2200 bytes left | Taskstate = 0
[D][cyclic.cpp:53] doHousekeeping(): LEDloop 556 bytes left | Taskstate = 2
[I][cyclic.cpp:59] doHousekeeping(): Voltage: 4246mV
8598502: engineUpdate, opmode=0x4
8598710: TXMODE, freq=868500000, len=23, SF=7, BW=125, CR=4/5, IH=0
8907046: setupRx1 txrxFlags 00 --> 01
start single rx: now-rxtime: 23
8907208: RXMODE_SINGLE, freq=868500000, SF=7, BW=125, CR=4/5, IH=0
rxtimeout: entry: 8923538 rxtime: 8907171 entry-rxtime: 16367 now-entry: 12 rxtime-txend: 304596
8923603: setupRx2 txrxFlags 0x1 --> 02
start single rx: now-rxtime: 17827
8923797: RXMODE_SINGLE, freq=869525000, SF=12, BW=125, CR=4/5, IH=0
rxtimeout: entry: 9083493 rxtime: 8905895 entry-rxtime: 177598 now-entry: 12 rxtime-txend: 303320
9083557: processRx2Jacc txrxFlags 0x2 --> 00
[I][lorawan.cpp:339] onEvent(): JOIN WAIT
9083848: engineUpdate, opmode=0x4
[D][cyclic.cpp:36] doHousekeeping(): IRQhandler 2200 bytes left | Taskstate = 0
[D][cyclic.cpp:53] doHousekeeping(): LEDloop 556 bytes left | Taskstate = 2
[I][cyclic.cpp:59] doHousekeeping(): Voltage: 4092mV

Any advice appreciated.

In which country do you try to connect to TTN, did you adapt frequency / channel settings?

Did you check that DIO1 of LoRa chip is wired to GPIO set in hal file?

Are you sure you have coverage by LoRaWAN compliant gateway (i.e. 8ch, not single ch)?

@Italque we had to use this line in the setup code to get it working.

Smiilar to you, have used BME280s in lots of other things but didnt work intially with a TTGo V2

Try this

Wire.begin(21,22);

regards
Paul

I am trying to get this to work in Riga, Latvia. This is capital city, I checked global gataway map and there are like 5 gateways showing up, moustly universities puting them up, but I do not know how to check if I have good coverage and how many channels are available. Was thinking of changing SF7 to SF9, as I understand that would increase air time but would allow to contact gateways at greater distance, but when I change to SF9 in code and compile/upload it to TTGO node it still shows SF7 on oled screen and in terminal log.
I did check if DIO1 ( labeled Lora1 on ttgo 2.1 1.6 board ) is connected - I checked ttgo pin is connected to lora module pin whth multimeter, but I could not perform continuity check from ttgo lora1 pin to esp32 chip pin as the esp32 pins are too small for my multimeter. BUT i did try to wire ttgo lora1 pin to other pin on ttgo board and use that in configuration, but that did not make any difference, it seemed it made module to not even get to joining OTAA.

Joining always starts with SF7, and over time LMiC increases SF if it cannot join. So just leave the module some hours outside and wait. Maybe you just have a coverage problem. Could therefore be useful to get closer to a gateway for testing.

Using TTGOs with OLED display you need to keep in mind that their display is connected to the i2c bus, too. This is of course not a hardware problem, since i2c has bus device addressing, but can cause a software issue if you try to access OLED and BME from parallel running tasks on a RTOS platform, like ESP32-IDF / arduino-esp32. Concurrent access to i2c bus results in bus errors and may cause the i2c driver stop working. To prevent this you need a mutex mechanism in the software, or you keep i2c bus access in a single task (e.g. loop-task in arduino).

Trying now with default configuration for my module. Waiting patiently for it to manage SF itself. And got some signal in TTN console, the yellow lightning icon one. Here are metadata from it:
Looks like signal is week, if I read this correctly.
{
“time”: “2019-08-08T12:08:38.492242962Z”,
“frequency”: 868.3,
“modulation”: “LORA”,
“data_rate”: “SF10BW125”,
“coding_rate”: “4/5”,
“gateways”: [
{
“gtw_id”: “eui-b827ebfffef8045f”,
“timestamp”: 605165132,
“time”: “”,
“channel”: 1,
“rssi”: -120,
“snr”: -10.8,
“rf_chain”: 1
}
]
}

At -10.8dB SNR, you have around 4dB of link margin to the failure point, so about 60% more distance, all other things being equal.

Console shows the reception level at the gateway’s site. With RSSI -120 your node probably can’t hear the gateway, so cannot process the OTA join answer.

You need to get closer to a gateway.

The gateway’s MAC looks like a raspberry. Many RasPis are operated indoor. Try to find an outdoor gateway.

Hi,

I acquired a board TTGO ESP32. I get connected to my network. But when I configured in TTN. I get error not connected. What is the problem?

SPIFFS loaded success
Assert=Do Asserts
debug=1
readConfig:: Starting
SSID=ONOF6A5
CH=0
SF =7
FCNT=0
DEBUG=0
CAD=0
HOP=0
NODE=0
BOOTS=19
RESETS=0
WIFIS=19
VIEWS=0
REFR=0
REENTS=0
NTPETIM=0
NTPERR=0
NTPS=18
MAC: 00:a0:00:61:00:7c, len=17
0:1. WiFi connect to: ONOF6A5
WLAN reconnected