Big ESP32 / SX127x topic part 1

Low power and WiFi are not best friends.
Anyway without schematic it’s difficult to know what was consumming. May be his BME280 has 3V3/5V poor regulator conversion (has many) and adding quiescent current :wink:
Would be interesting having current consumption in deep sleep mode

I think he could have tweaked things a little bit.

Even without disabling it, reducing WiFi transmit power would help, the default ( 20 dBm IIRC) causes that sort draw - if you try to do LoRa @ 20 dBm on the SX127x it’s similar.

Also you can lower core clock speed etc. There are many tweaks, and that’s not even involving the ULP which he probably could use for his I2C sensor.

1 Like

Pycom’s LoPy uses the SX1272 chip rather than the SX1276 used in this device. A few months ago, I was able to implement a single channel gateway on the ESP32 and with the RFM95W LoRa Module by porting Pycom’s code for their Lopy, inserting libraries for the SX1276 and modifying the code to achieve this. If interested, the source code is available from github here

The pinouts are hard coded in the pycom firmware code but you can make changes. On the Lopy RADIO_DIO is connected to GPIO23. You will need to change this to GPIO26 to match this device. All other connections are same. The LoPy firmware does not use a reset for ESP32 chip revision > 0. My port was for chip revision > 0. Pin connections for chipset = 0 is different.

I implemented a single channel gateway using the pycom script for that as available here

ABP works but OTAA didnt seem to work. I haven’t been able to sort that out. Hope someone will be able to.

Do give it a try.


HELTEC HTIT-WB32LA 868-915 MHz board

I just received the board.
After examining the PCB I found that the following DIO ports are wired:
(pin numbers are chip pin numbers)

SX1276 (pin) – ESP32 (pin)
DIO0 (8)GPIO26 (15)
DIO1 (9)GPIO33 (13)
DIO2 (10)GPIO32 (12)

Hope this helps.


If you want to use those USB power banks, be aware that they can reate a fair bit of EMI, take a read of this;


Thanks for this reminder - I will compare with a LiPo

I admire your patience and visual acuity

1 Like

So I received that SX1278 / 433Mhz one I ordered by error :

Anyone in an appropriate region to use it who wants it, I’ll send it for the cost of shipping - from France.

Edit : no longer available, it went to someone in Germany.

1 Like

@nicbkw and Heltec 868 MHz users,

Anyone made a ready to use package or published a github with the Arduino code and libraries for testing the Heltec 868 MHz device with LoRaWAN?


OK, I got my Heltec LoRa boards today. No secret, I am not a programmer but I have tried to duplicate what you have done to make the libraries work… I can’t get it to work!
First issue I have is the declaration in oslmic.h , it is done per your hint but I get a compile error.

C:\Users\Garry\Documents\Arduino\libraries\arduino-lmic-master\src\hal\hal.cpp: In function ‘void hal_io_check()’:

C:\Users\Garry\Documents\Arduino\libraries\arduino-lmic-master\src\hal\hal.cpp:66:32: error: ‘radio_has_irq’ was not declared in this scope

         if ( radio_has_irq() ) 


Would you have a suggestion what I have done wrong? I have declared it below…

// Dependencies required for the LoRa MAC in C to run.
// These settings can be adapted to the underlying system.
// You should not, however, change the lmic.[hc]

…at line 83, is this glaringly wrong?

Thanks, Garry

Hi - just use and set Pin mapping like this (thanks to @bluejedi)

// Pin mapping
const lmic_pinmap lmic_pins = {
    .nss = 18,
    .rxtx = LMIC_UNUSED_PIN,
    .rst = 14,
    .dio = {26, 33, 32},

Mapping all 3 DIO pins means there is no need to change the LMiC library as I described.


@nicbkw Much obliged for your help, first attempt at OTAA and with the new ESP32 board. Now to wade out of my depth with some sensors and possibly even the OLED! Thanks again…



1 Like

My Heltec board has a helical wire antenna for 2.4GHz on top, not the PCB antenna.
It also has a PCB antenna on the bottom side but that antenna is not connected.
The helical antenna sticks out above the display, not handy if to be mounted in a case.
WiFi reception with the helical antenna is poor. I was only able to detect 9 WiFi networks (max), while at the same location an ESP8266 ESP-12F module with PCB antenna detects 28 networks (max).
I wanted to improve the antenna so I hacked the PCB. I removed the helical wire antenna and mounted an U.FL connector so I can connect different types of antennas. This was possible because the antenna pad is surrounded with ground traces. While the modification is still not as good as the ESP-12F, I was able to detect 14 WiFi networks (max), which is an improvement of more than 50% (in detected networks).
I tried several 2.4GHz antennas, including 2 PCB types and a regular foldable type with SMA connector but the model shown on the picture below performed best.

4GHz antenna

4GHz 600x360
With U.FL connector mounted

4GHz with antennas 600x520
With antennas

1 Like

To use the OLED is quite simple. Add this in the header of your Arduino script:

#include <U8x8lib.h>

// the OLED used
U8X8_SSD1306_128X64_NONAME_SW_I2C u8x8(/* clock=*/ 15, /* data=*/ 4, /* reset=*/ 16);

Add this in your setup()


Then to display data on the OLED, use something like this:

      u8x8.setCursor(0, 7);
      u8x8.printf("RSSI %d SNR %.1d", LMIC.rssi, LMIC.snr);

I would like to run a run a single channel gateway on this board (preferably with multi-SF and OTAA support).
Has any single channel gateway implementation been ported to ESP32 already?


See ‘List of single channel gateway implementations’ here: Single Channel Gateway part 2


Hmm, I was quite sure their GitHub repo was already mentioned here, but no… So:

And some asides:

  • The EU868 units I got all seem to be running the File > Examples > LoRa Function Basic Test > OLED_LoRa_Sender sketch, but then using #define BAND 868E6. So, to use OLED_LoRa_Receiver, change the value for band in the example sketch.

  • To make the receiver examples see the TTN LoRaWAN 868.1, use #define BAND 868.1E6.

  • Using LoRa.onReceive(callback) does not work for me; calling LoRa.parsePacket() within loop() works fine though.

  • The orange battery LED is flashing like crazy; maybe attaching a battery makes it stop? @DeuxVisdocument claims: “The orange LED lights will go out when the battery is full”:


  • The same document also says: “To use the on-board IO port with touch function as the touch signal input (WIFI Kit32 and LoRa 32 with this function), add a 100 nF pulldown capacitor to this pin.”


A battery connector/cable was not included. Any idea what connector type the battery connector is? It is smaller than JST-PH connectors.

DeuxVis’ document does not give much details, but:



Onboard lithium battery charge and discharge circuit, The orange LED lights will go out when the battery is full , only provide the basic lithium battery charging and discharge function, can not monitor the battery temperature and power, if your battery is not purchased in our shop, Please pay attention to the battery positive and negative, wrong operation may explode.

And the HelTec website shows:

They sell the cable but that doesn’t provide much further detail either.

Looking at your picture, it looks like they use a MCP73831 (or compatible) charging IC (the 5-pin SOT23 below the helical coil). The default behaviour of the STAT pin is to blink while charging (or no battery connected) and to turn off when battery is full.

This is from one of my designs, which also uses a green led to indicate battery full.


Some more interesting ‘nuts and bolts’ hacking at the Espressif chips by Andreas Spiess, this time getting both processor cores of the ESP32 working using the Arduino IDE only. Seems like this can only help with more complex tasks?

1 Like