Big ESP32 + SX127x topic part 3

Thanks Verkehrsrot.
Indeed it has been a problem of coverage. I drove next to the next free gateway and there it started. I think this gateway is not set up proberly, as I worked only up to a distance of approx. 20m from this gateway.

1 Like

Hi bluejedi,

Sorry for the late reply, I found a solution, but before that, I will answer your questions:

  • The board that I select in the Arduino IDE is “Heltec Wifi LoRa32”

  • The first library I used was Adafruit, then I switched to Sparkfun and then
    returned to Adafruit.

  • I initialized the library with bme.begin ().

In any case I found out that the problem is due to a two different types of BME280 sensors smaller than usual, take a look here and here. While with this type no problem, everything works fine even with the Adafruit library. It remains to understand why all the sensors of the aforementioned type don’t work properly. I tried a dozen of them all working perfectly with other projects.
Thank you for the support you are giving me @Sandgroper @bluejedi @Paul_Stewart !

1 Like

The smaller ones are special 5.0V versions and have a 3.3V voltage regulator.
When using these with 3.3V it may be possible that supply voltage gets too low which could explain the problems. I suspect that the chip on the left is a level converter which may also cause issues when used with 3.3V.

capture%202019-08-27%2022%C2%B757%C2%B711 capture%202019-08-27%2022%C2%B756%C2%B749

My BME280’s are the larger ones with 6 pins (‘3.3V version’).
I noticed that Adafruit BME280 library uses 0x77 as default I2C address while my Chinese BME280’s have 0x76 as default address (the Adafruit sensor boards probably use 0x77 as default address).

So for my Chinese BME280 sensor boards I explicitly have to specify the proper I2C address when calling BME280.begin() i.e. bme280.begin(BME280_ADDRESS_ALTERNATE, &Wire) or just bme280.begin(0x76, &Wire).

Defined are:
BME280_ADDRESS (0x77)

I think you mean the six pin BME280 board but that image is a BMP280 board. :wink:
(Same PCB is used for both BMP280 and BME280 sensors.)

Your software could try both. Test is the sensor responds to 0x77 and if it does not respond then try the other address.

BOSCH datasheet warns to not leave the address selection pin floating, so it may be worth checking if the pcb designer did his/her RTFM homework and took care of this…

The 7-bit device address is 111011x. The 6 MSB bits are fixed. The last bit is changeable by SDO value and can be changed during operation. Connecting SDO to GND results in slave address 1110110 (0x76); connection it to VDDIO results in slave address 1110111 (0x77), which is the same as BMP280’s I²C address. The SDO pin cannot be left floating; if left floating, the I²C address will be undefined.

LoRaMac-node for ESP32 available

Can be used for Heltec ESP32 LoRa products only

Essential parts of the source code are obfuscated (compiled to assembly).

“An unique license relate to Chip ID is needed, you can check your license here:

Great initiative but mixed feelings because of its closed character and license requirement per node. Applications using this library are limited to Heltec hardware which limits wider application
(therefore less attractive for developers). :+1: :smiley: :thinking: :roll_eyes: :disappointed: :-1:

Also see: Overview of LoRaWAN libraries - LMiC, LoRaMAC-node and their variations

Has anyone used it already?

I don’t think the ecosystem of Heltec hardware is worth to accept a vendor lock-in.

Meanwhile good old LMiC stack is close to a LORAWAN 1.0.3 certification, thanks to the great work by Terry Moore:


Even with current developments on LMIC it would still be ‘nice’ to have LoRaMac-node implementations more widely available.

1 Like

I made a sketch for the TTGO-LoRa32-V2.1 (version T3_v1.6 20180606).

I am looking for people to test it. It has ABP and otaa activation. It also supports the OLED display. You can check it on:


Espressif recently introduced a new member of the ESP32 family: the ESP32-S2

ESP32-S2 datasheet is available here

Comparison with regular ESP32


What do we gain over ESP32?

  • Xtensa LX7
  • Support for larger external SPI RAM up to 128MB
  • Support for larger external SPI Flash up to 1GB
  • More GPIOs (39 gpio + 1 gpi, 22 rtcio)
  • 14/15 ch Waterproof touch sense? & Proximity sensing
  • Improved SPI (OSPI)
  • Improved ULP (RISC-V)
  • WiFi Indoor Positioning (802.11mc)?
  • V2I (802.11p?)
  • Lower cost
  • External ram access from instruction cache
  • Auto-zero ADC
  • PSRAM encryption

What do we lose?

  • Bluetooth
  • ### Dual core ###
  • RAM space (320KB vs 520KB)
  • ROM space (128KB vs 448KB)
  • UART (2 vs 3)
  • Ethernet
  • I2S (1 vs 2, no PDM)
  • RMT (4ch vs 8ch)
  • PCNT (4 vs 8)


ESP32-SOLO-1 is a new Espressif module that is based on the new ESP32-S2.

Available here:


Hi bluejedi,

yes I have used this source code and board from Heltec, but I found it a little bit complicate due to make for each board a new compilation because of the unique license. Also after some good joins during test also the OTAA fails. Why I can’t found out. ADB work with lmic fine.
Now I’m go to test deep sleep and OTAA as well.

I uses also the lmic from mcci-catena now.
I found two pin configuration for V2 of this board:

I uses:

//LMIC LoRa module pin configuration
//For Heltec Wifi LoRa 32 use:
const lmic_pinmap lmic_pins = {
    .nss = 18, 
    .rxtx = LMIC_UNUSED_PIN,
    .rst = 14,
    .dio = {/*dio0*/ 26, /*dio1*/ 35, /*dio2*/ 34}
and also I found:

//LMIC LoRa module pin configuration
//For Heltec Wifi LoRa 32 use:
const lmic_pinmap lmic_pins = {
    .nss = 18, 
    .rxtx = LMIC_UNUSED_PIN,
    .rst = 14,
    .dio = {/*dio0*/ 26, /*dio1*/ 34, /*dio2*/ 35}

only changed in dio 34 and 35. Why? For me it seems to be clear the first one. Have others other experience?

Also OTAA fails because the board misses the agreed downlink. Also in ADP downlink seems to be critical.

Perhaps I’ll make LMIC with interrupt:

Hope to help other to go further with his project and this board.

1 Like

A real pity that their LoRaMac-node port to ESP32 is not open / not available for general use. So there still appear to be issues with it. Because not open there will be much less people that are going to test it and less people to report any issues.

Yes for Heltec WiFi LoRa 32 V2 the first you listed is correct (the second is incorrect):

const lmic_pinmap lmic_pins = {
  .nss = 18,
  .rxtx = LMIC_UNUSED_PIN,
  .rst = 14,
  .dio = {/*dio0*/ 26, /*dio1*/ 35, /*dio2*/ 34 }

Also note that GPIO ports used for I2C OLED display are not the standard ones for I2C:
Display-SDA = 4 (not 21, SDA=21)
Display-SCL = 15 (not 22, SCL=22)
Display-RST = 16

1 Like

Check out latest paxcounter version 1.8.0, it runs LMiC controled by hardware Interrupts. I found the bug in MCCI LMiC which broke this feature last week and made a Pull Request, this was merged meanwhile.

1 Like

Can hardware interrupts be enabled for LMIC without requiring further changes to Arduino application code?
When would enabling hardware interrupts for LMIC be useful and when not?
Is this valid for both the original LMIC-Arduino library and for the MMCI LoRaWAN LMIC library?
Is that independent of type of MCU used?

Until recently I have only seen remarks like ‘enabling interrupts for LMIC is best avoided because it can cause issues’ while you seem to promote it (use it in Paxcounter).
I understand that interrupt based is usually better than polling but if so, why hasn’t that been the norm with LMIC previously?

Can you please elaborate on that?

It’s pretty easy with current MCCI LMIC code, you just have to enable the function in lmic_config.h:


The original LMIC arduino library does - as far as i see - not and did never include this function.

Using hardware interrupts instead of polling has in my opinion more advantages than disadvantages: Is frees up CPU from polling and thus allows a more “sharp” timing for the time critical opening of RX-windows. This saves power and thus is relevant for all real low power applications. While power savings maybe not significant with Class A devices, it will with Classes B / C.

Another advantage, also for Class A, might be that in busy multithreaded applications (like paxcounter) timing by hardware works better than by software, because by software will cause more jitter, and this could result to missed RX packets. That’s the reason why i decided to switch paxcounter code to use interrupts.

Only disadvantage in my opinion is, that the used GPIO pins for LORA_IRQ (= DIO0) , and LORA_DIO1 must be connected to interrupt capable pins of CPU. This might be an issue on hardware with small CPU footprint, but on a ESP32 system you have lots of suitable GPIOs, and as far as i see it works with all Heltec, TTGO, Pycom etc. development boards. So why not using it?

There was an issue, that broke the interrupt function working in MCCI LMiC on ESP32, but recently i spotted the bug in the HAL code, and made a PR for it. This was merged in MCCI LMIC master last week and since then i have some test clients up and running on interrupts, so far working smooth and i don’t see any RX packet loss any more.

1 Like

Next level would be to have ESP32 proprietary interrupt function, which captures the timestamp of the interrupt by hardware. This should be somehow possible with ESP32 hardware, i guess, but i did not yet find out the way how to. This would allow a further sharpening of timing, what opens up opportunity to have a high precision (< 1ms) “NTP” via LORAWAN.

TTGO Beam V1.0 now supported by paxcounter.
To get this running, i did register power management chip AXP202X Library by LilyGo to platformio (after asking them for permission) and added it to paxcounter.
This chip has a bunch of power management features; unfortunately we still miss a schematic for TTGO Beam V1.0 to use all functions.

1 Like

You need interrupts if want to sleep all the time between events (e.g. TX begin, TX complete, RX begin, RX complete, etc.). Pretty sure no-one uses LMIC this way.

Sleep aside, using interrupts might allow you to reduce your clock error compensation since there will be less jitter in determining RX begin compared to polling at both ends. Reducing compensation might mean the radio is waiting to receive for less time.

I got a TTGO T-Beam V1.0 and enhanced the paxcounter software to support some of the new board features:

  • GPS PPS interrupt line
  • PMU (power management unit)
  • Two Buttons

As PMU an AXP192 chip is used. Although this is an older model dated around 2011, is has a bunch of interesting features, look at the data sheet (unfortunately chinese only, does anyone has english version?)

In paxcounter code i added some examples for the various power interrupts - works! Now you can easyly trigger on power events, like battery connected/removed, USB plug connected/removed, battery overheated/charged etc.

The second user button is also controlled by the PMU.

You may try to (partially) translate it here: onlinedoctranslator