Big ESP32 + SX127x topic part 3

For the avoidance of doubt, that question was posted as a question.

Which I would like to know the answer to …

Yes, it works. I used to use the “ESP32 Dev Kit” but sometimes (depending on which LMIC library I was using I needed to set the SPI pins manually on hal.cpp).
Later I found out that “Heltec Wifi Lora 32” is working fine.

Yes, this has shown to be a pitfall in the MCCI LoRaWAN LMIC library and should be fixed.
A problem is that the user is not (made) aware of the issue.

See my remarks (and tip for PlatformIO) in this linked post.

1 Like

Have you checked there is an issue logged for this on github and if not logged one? Or even better submitted a pull request for the project?






For TTGO LoRa32 V2 you can also use (recently added) board definition “TTGO LoRa32-OLED V1” which is similar (not identical) to “Heltec Wifi Lora 32” but better matches the board type/name.

With board definition “TTGO LoRa32-OLED V1”, similar to board definition “Heltec Wifi Lora 32”, the definition of LED_BUILTIN is incorrect for TTGO LoRa32 V2.
(The builtin LED for the V2 board is practically useless anyway because it uses GPIO22 which is already used for OLED SCL.)

1 Like

Hi. So I have a Heltec V2. Says it on the back of the board, along with the other signs mentioned earlier. I am trying to get it to work with a RasPi3 with a Dragino Shield. Both match for frequencies (according to what I’ve ordered. I’m in the UK so both are on 868.). For now they’re extremely close together. The Dragino would pick up raw LoRa connectivity from the Heltec, as I can see a change every time I run that code, which appears on the ‘single_chan_pkt_fwd’ program running on the Pi. The issue is when I actually try to get anything using ANY of the LoRaWAN sketches everyone on here has provided for the HeltecV2. Not only that, but I’ve tested the sketches and not only does the Pi not see anything, my little SDR dongle doesnt see anything in that frequency range. At all. I have 3 of these Heltecs and tried all 3 of them. None seem to work with the provided sketches. Please don’t redirect me to the dragino shield topic because I’ve read through the whole thing and not only have I not found a single thing useful for my case, I don’t believe that there is an issue with the dragino shield. I can also mention I followed the famous Andreas Spiess, regarding that shield.

The pinout of my HeltecV2 is:
.nss = 18,
.rst = 14,
.dio = {26, 35, 34}

I’ve tried 2 different LMIC libraries I’ve found and neither of them have made a difference. I have seen something about ‘connecting pins physically’ on this board, but found absolutely zero information on which pins to connect, why and how etc. I’m trying to get the ttn-abp going, by the way. Oh and the dragino is showing as connected on TTN, but has never seen a single packet come in according to the site. I’ve made sure that my firewall has the port 1700 open.

I am very close to giving up as I seem to have covered every place that’s relevant to my predicament in any way and still I’ve absolutely nothing. All I want to do is just receive data from the heltec, via the dragino+pi to be posted to TTN. That is it for now.

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.


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,
.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.

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] = ""; /
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 “” // The Things Network:
//#define SERVER2 “” // 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.

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:

configsip: 188777542, SPIWP:0xee
mode:DIO, clock div:2
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
[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…
[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