# Big ESP32 + SX127x topic part 2

**URL:** <https://www.thethingsnetwork.org/forum/t/big-esp32-sx127x-topic-part-2/11973>\
**Category:** End Devices (Nodes)\
**Created:** [January 23, 2018, 2:11pm UTC](https://www.thethingsnetwork.org/forum/t/big-esp32-sx127x-topic-part-2/11973 "2018-01-23T14:11:55Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![bluejedi](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/bluejedi/32/44639_2.png) [@bluejedi](https://www.thethingsnetwork.org/forum/u/bluejedi)\
**Post date:** [January 23, 2018, 2:11pm UTC](https://www.thethingsnetwork.org/forum/t/big-esp32-sx127x-topic-part-2/11973/1 "2018-01-23T14:11:55Z")

</div>

![Heltec Wifi LoRa 32 birdseye 500x366](https://www.thethingsnetwork.org/forum/uploads/default/original/2X/f/f418becd6011c4da35457764b459fc03b5165734.jpg)

For the first part of this topic see: **[BIG ESP32 / SX127x topic part 1](https://www.thethingsnetwork.org/forum/t/big-esp32-sx127x-topic-part-1/10247)**  
For updates to below start topic see: **[Big ESP32 + SX127x topic part 3](https://www.thethingsnetwork.org/forum/t/big-esp32-sx127x-topic-part-3/18436)**

### The ESP32 microcontroller and SX127x / RFM9x LoRa transceivers

The ESP32 has built-in support for Wifi and Bluetooth communication but not for LoRa. A SX127x or RFM9x LoRa transceiver adds support for LoRa and the LoRaWAN protocol that are needed for The Things Network.

Semtech SX127x LoRa transceivers and HopeRF RFM9x LoRa transceivers are identical. They come in different variants, depending on the targeted frequency band (433, 868 and 915 MHz). Which frequencies are used depends on the geographic region and local ISM band regulations. _(HopeRF module numbers usually end with W which stands for ‘international version’.)_

The ESP32 and the LoRa transceivers come in several forms:

- On **modules**.  
Modules contain additional components required for making the chips work. The modules use 1.27mm or 2mm pin spacing. For use with breadboards and prototyping PCB with 2.54mm spacing adapters are required. _Examples: ESP-WROOM-32 ESP32 module, SX1276 and RFM95 LoRa modules._
- On **development boards**.  
Development boards (often) convert to 2.54mm spacing and add additional functionality like power converter, buttons and LEDs. Development boards use either standard modules or separate components. _Examples: ESP32 Dev board, Lolin32 and NodeMCU-32S. A pure adapter is the HopeRF RFM95 adapter._
- On **custom boards** which combine ESP32 with a LoRa transceiver.  
Custom boards can use standard modules, separate components or a combination of both.  
_Examples: Heltec Wifi LoRa 32 and TTGO LoRa32._

### Software

In addition to the hardware, software is needed for implementing the LoRaWAN protocol. The SX127x LoRa tranceiver provides LoRa radio modulation but it does not implement the LoRaWAN protocol. The protocol has to be implemented in software that needs to run on the ESP32.

The following library implements a LoRaWAN protocol stack that can be used with ESP32: **LMIC-Arduino**.  
The LMIC-Arduino library can be found here: [https://github.com/matthijskooijman/arduino-lmic](https://github.com/matthijskooijman/arduino-lmic)  
The library contains examples for implementing a Things Network node for both ABP and OTAA activation.

Try to get the **ttn-abp.ino** example working first. If that works continue with the **ttn-otaa.ino** example. When both these examples work then the LoRaWAN part of your setup works. From there you can start adding additional features (e.g. temperature sensor) but **get the basics working first**.  
_ABP and OTAA require different settings. See TTN Console and remarks in the sketches for more information._

A nice library for (on-board) (OLED) monochrome displays is: **U8g2**  
The U8g2 library can be found here: [https://github.com/olikraus/u8g2](https://github.com/olikraus/u8g2)  
_(U8g2 includes U8x8 which is lower on resources.)_

ESP32 + SX127x/RFM9x can also be used for implementing a Single Channel Gateway. Information about the Single Channel Gateway software can be found in the following topic: [Single Channel Gateway part 3](https://www.thethingsnetwork.org/forum/t/single-channel-gateway-part-3/11546)  
_(See ‘List of single channel gateway implementations / For ESP32’.)_

The ESP32 Arduino core (arduino-esp32) now supports the **Arduino Boards Manager** and is the preferred way to install support for the ESP32 in the Arduino IDE.  
See [Installing ESP32 support for Arduino IDE using the Arduino Boards Manager](https://github.com/espressif/arduino-esp32/blob/master/docs/arduino-ide/boards_manager.md).  
_If you previously manually installed arduino-esp32 from the GitHub repository then don’t forget to remove it._

### Popular ESP32 LoRa boards

The following boards are popular for prototyping because they combine an ESP32, a LoRa tranceiver, an OLED 128x64 display and LiPo/Li-Ion battery support with charging in one small package that can be used on a breadboard:

- Heltec Wifi LoRa 32
- TTGO LoRa32

These boards come in different versions and there are separate versions for 433/470MHz and 868/915MHz.

LoRa antenna: external, connected via cable with I-PEX connector; 868MHz have 5cm external whip antenna with SMA connector; 433MHz have a helical wire antenna.  
WiFi/Bluetooth antenna: single on-board antenna _(performance is sub-optimal)_.  
Battery connector: 2-pin [Molex PicoBlade](http://www.molex.com/molex/products/family?key=picoblade) (1.25mm spacing). Compatible connectors: ‘JST 1.25mm’ sold on [AliExpress](https://www.aliexpress.com/item/M89C20Pair-Micro-JST-PH-1-25-2-PIN-Male-Female-Plug-Connector-With-Wire-Cables-100mm/32808002559.html) and eBay _(sold as JST-PH 1.25mm but it is not PH because PH uses 2.0mm spacing)_.  
_ **Be careful** with cables that were not included with the board: check first if the colors match the polarity of the board, reversing battery polarity may destroy the board._

There is a dedicated LED _(non-programmable)_ for the battery. It is on when the battery is charged. When no battery is connected: it is off when powered via 3.3V pin but flashes when powered via USB or 5V pin.  
A second LED (white on Heltec, blue on TTGO) _(programmable)_ is connected to pin 25, on TTGO V2 the LED is connected to pin 22 but it is useless (see below).

_There have been issues with some pigtail cables and some TTGO boards where components were not properly soldered. For more information about these issues check [part 1 of this topic](https://www.thethingsnetwork.org/forum/t/big-esp32-sx127x-topic-part-1/10247)_.

**Note:** Sometimes new revisions of boards are released. It is often not be possible to determine the specific revision from the outside of the board. It is possible that a new revision may use different GPIO port(s) for an existing feature. In which case, at first, the board may look defective.  
In that case check this article for possible updates and please share your findings when you detect any new changes.

#### LoRa Performance

The LoRa performance of the Heltec and TTGO boards has shown to be sub-optimal. Important factors are the quality of the RF circuitry (design) and the antennas. The TTGO LoRa32 V2 uses a separate (and shielded) LoRa module which is better than the other models. For a review where the LoRa performance is measured with a spectral analyzer see this [ESP32 + LoRa video](https://www.youtube.com/watch?v=CJNq2I_PDHQ) from Andreas Spiess.

#### Heltec Wifi LoRa 32

Have a white PCB and come in two different versions _(the version numbers are not used by Heltec)_:

- **V1** : with on-board PCB WiFi/Bluetooth antenna. Appears to be available for 433MHz only.
- **V2** : with small on-board helical antenna _(has a PCB antenna on the bottom but that is not connected)_.  
[Heltec Wifi LoRa 32 pinout diagram](http://www.heltec.cn/download/WIFI_LoRa_32_Diagram.pdf).

#### TTGO LoRa and TTGO LoRa32

Have a black PCB and come in several different versions:

- **LoRa** with on-board PCB Wifi/Bluetooth antenna on top. Appears to be available for 433MHz only(?). Also available without the display.

- **LoRa32 V1** : with on-board metal Wifi/Bluetooth antenna on bottom. I-Pex connector located on top.

- **LoRa32 V2** : with on-board metal Wifi/Bluetooth antenna on bottom (in a different location).  
Uses ESP32-Pico-D4 (with integrated flash memory) instead of ESP32, uses a (shielded) LoRa module, I-Pex connector located on the bottom, micro-USB connector is rotated 90 degrees, in addition has a microSD card slot on the bottom and an on/off switch for the battery next to the micro-USB connector. Switches the battery only so not possible to switch the board off when connected to USB for charging the battery.  
‘Programmable’ LED on pin 22 instead of pin 25 but useless because wired to SCL and all three LEDs are on the bottom side where you cannot see them. DIO1 and DIO2 each have a separate board pin but neither of them is connected to a GPIO port so must be explicitly wired. This also means that the TTGO V2 has two GPIO ports less that could otherwise have been used for other purposes.  
The microSD card slot can be used as a regular SD card reader/writer. The LoRa modules are HPD13A and HPD14A from HPDTek.  
New **updated pinout diagram v3.0** is available here: [TTGO LoRa32 V2.0 Pinout v3.0.pdf](https://www.thethingsnetwork.org/forum/uploads/default/original/2X/4/4eb4d5846cf0a7fbaeabbad3c0b0cdde2faecb23.pdf) (2.3 MB)

- **LoRa32 V2.1** : Like V2.0 with several changes and improvements (e.g. SMA LoRa antenna connector, different battery charging chip, different switch). Some changes in use of pins / GPIO’s. Different versions of this board exist (some differences in GPIO/pin mappings between versions).  
[TTGO LoRa32 V2.1 pinout diagram](https://github.com/LilyGO/TTGO-LoRa32-V2.1) possibly not up to date. **Do not use this pinout for LoRa32 V2.1 with PCB marked V1.6** because it is incompatible.

### PIN Mappings

#### Heltec Wifi LoRa 32, TTGO LoRa and TTGO LoRa32 V1:

```
ESP32 LoRa (SPI) Display (I2C) LED
----------- ---------- ------------- ------------------
GPIO5 SCK SCK
GPIO27 MOSI MOSI
GPIO19 MISO MISO
GPIO18 SS NSS
GPIO14 RST
GPIO26 DIO0
GPIO33 DIO1
GPIO32 DIO2
GPIO15 SCL
GPIO4 SDA
GPIO16 RST
GPIO25 Heltec, TTGO LoRa32
GPIO2 TTGO LoRa

```

#### TTGO LoRa32 V2:

```
ESP32 LoRa (SPI) Display (I2C) LED
----------- ---------- ------------- ------------------
GPIO5 SCK SCK
GPIO27 MOSI MOSI
GPIO19 MISO MISO
GPIO18 SS NSS
EN RST RST
GPIO26 DIO0
GPIO33 DIO1 (see #1)
GPIO32 DIO2 (see #2)
GPIO22 SCL SCL
GPIO21 SDA SDA
GPIO22 useless (see #3)

```

1. Required _(used by LMIC for LoRa)_.  
Not on-board wired to any GPIO. **Must be manually wired**.
2. Optional _(used by LMIC for FSK but not for LoRa)_.  
Not on-board wired to any GPIO. When needed: must be manually wired.
3. GPIO22 is already used for SCL therefore LED cannot be used without conflicting with I2C and display.

#### Board definitions

Currently the only board type defined (in ESP32 Arduino Core) is ‘Heltec Wifi LoRa 32’. Select this board type for both Heltec and TTGO boards. _Check Pin Mappings above for differences / inconsistencies with a specific board_.

```
Default definitions for board type 'Heltec Wifi LoRa 32':
(Numbers represent GPIO ports)

SCK = 5
MOSI = 27
MISO = 19
SS = 18
SCL = 22
SDA = 21
LED_BUILTIN = 25

```

### How to setup the software

#### How to configure LMIC with the ESP32 pins used for the LoRa module:

```cpp
//LMIC LoRa module pin configuration

//For Heltec Wifi LoRa 32, TTGO LoRa and TTGO LoRa32 V1 use:
const lmic_pinmap lmic_pins = {
    .nss = 18, 
    .rxtx = LMIC_UNUSED_PIN,
    .rst = 14,
    .dio = {/*dio0*/ 26, /*dio1*/ 33, /*dio2*/ 32}
};

```

```cpp
//For TTGO LoRa32 V2 use:
//Note: LoRa32 V2 DIO1 and DIO2 are not on-board wired to any GPIO.
//These need to be wired manually.

const lmic_pinmap lmic_pins = {
    .nss = 18, 
    .rxtx = LMIC_UNUSED_PIN,
    .rst = LMIC_UNUSED_PIN,
    //If DIO2 is not connected use:
    .dio = {/*dio0*/ 26, /*dio1*/ 33, /*dio2*/ LMIC_UNUSED_PIN} 
    //If DIO2 is connected use:
    //.dio = {/*dio0*/ 26, /*dio1*/ 33, /*dio2*/ 32} 
}

```

```cpp
//For TTGO LoRa32 V2.1:
//The first revision(s) does not have LoRa RST connected to GPIO, use as V2 above.
//Revision V1.5 (V1.5 marked on PCB) uses GPIO12 for LoRa RST.
//Revision(s) newer than V1.5 use GPIO19 for LoRa RST.
//Note: On first revision(s) DIO1 and DIO2 are not on-board wired to any GPIO and have to be wired manually.
//Later revisions may have these wired on-board already.

const lmic_pinmap lmic_pins = {
    .nss = 18, 
    .rxtx = LMIC_UNUSED_PIN,

    //For board revision V1.5 use GPIO12 for LoRa RST
    .rst = 12,
    //For board revision(s) newer than V1.5 use GPIO19 for LoRa RST
    //.rst = 19,

    //If DIO2 is not connected use:
    .dio = {/*dio0*/ 26, /*dio1*/ 33, /*dio2*/ LMIC_UNUSED_PIN} 
    //If DIO2 is connected use:
    //.dio = {/*dio0*/ 26, /*dio1*/ 33, /*dio2*/ 32} 
}

```

#### How to setup U8g2/U8x8 with the ESP32 pins used for the OLED display:

```cpp
//U8x8 display library configuration
//See U8g2/U8x8 documentation for available display write functions

#include <U8x8lib.h>

//For Heltec Wifi LoRa 32, TTGO LoRa and TTGO LoRa32 V1 use:
U8X8_SSD1306_128X64_NONAME_HW_I2C display(/*rst*/ 16, /*scl*/ 15, /*sda*/ 4);

//For TTGO LoRa32 V2 use:
U8X8_SSD1306_128X64_NONAME_HW_I2C display(/*rst*/ U8X8_PIN_NONE);

//Add to setup():
display.begin();
display.setFont(u8x8_font_victoriamedium8_r); //Optional, more fonts are available.

```

### Example hardware

_Below pictures show an overview of available hardware and their appearance. All pictures have the same size ratio for a realistic comparison._

#### ESP32 modules / boards

![ESP32 modules and boards](https://www.thethingsnetwork.org/forum/uploads/default/original/2X/6/6c5e76fb90456cc524d134de0ffbd2e9e3dbcdd7.png)

#### LoRa Tranceiver modules

![LoRa transceiver modules 690x126](https://www.thethingsnetwork.org/forum/uploads/default/original/2X/8/8da6fa53c7b9a7c69c2a3dfa444e60dece5ddc51.png)

#### Heltec boards

![Heltec boards 1 test 690x368](https://www.thethingsnetwork.org/forum/uploads/default/original/2X/4/41ba8c2fd04e38fe42f1e77447a55684072e8080.png)  
 ![Heltec boards 2 690x183](https://www.thethingsnetwork.org/forum/uploads/default/original/2X/2/27d52a4c3e5781b48ea32a1bac43065304e16cc2.png)

#### TTGO boards

![TTGO boards 1 690x236](https://www.thethingsnetwork.org/forum/uploads/default/original/2X/a/a4615332c25dd5b92857eaaa9ec65d229c0449d0.png)  
 ![TTGO boards 1 test 690x384](https://www.thethingsnetwork.org/forum/uploads/default/original/2X/0/0c8a7af1926fd8535c60d528d7ed51b5decd4292.png)

---

<div class="post-metadata">

**Author:** ![BoRRoZ](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/borroz/32/44234_2.png) [@BoRRoZ](https://www.thethingsnetwork.org/forum/u/BoRRoZ)\
**Post date:** [January 23, 2018, 2:22pm UTC](https://www.thethingsnetwork.org/forum/t/big-esp32-sx127x-topic-part-2/11973/2 "2018-01-23T14:22:29Z")

</div>

great topic start !

---

<div class="post-metadata">

**Author:** ![stormforce133](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/stormforce133/32/7319_2.png) [@stormforce133](https://www.thethingsnetwork.org/forum/u/stormforce133)\
**Post date:** [January 23, 2018, 2:39pm UTC](https://www.thethingsnetwork.org/forum/t/big-esp32-sx127x-topic-part-2/11973/3 "2018-01-23T14:39:40Z")

</div>

Hi!  
Great topic indeed!

I’ve made a question in the previous topic, so I will ask again:  
I can’t make my ESP32 to join my TTN gateway, but in ABP mode, the Arduino sketch says EV\_TXCOMPLETE… does this means that my module is correctly wired? (I’m using a ESP32 dev kit wired with a HopeRF RFM95W

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![TKroenert](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/tkroenert/32/10010_2.png) [@TKroenert](https://www.thethingsnetwork.org/forum/u/TKroenert)\
**Post date:** [January 23, 2018, 11:08pm UTC](https://www.thethingsnetwork.org/forum/t/big-esp32-sx127x-topic-part-2/11973/7 "2018-01-23T23:08:25Z")

</div>

For the TTGO LoRa32 v2.0:

OLED:

> U8X8\_SSD1306\_128X32\_UNIVISION\_HW\_I2C u8x8(/\* clock=_/ 22, /_ data=\*/ 21, U8X8\_PIN\_NONE);  
> U8X8\_SSD1306\_128X64\_NONAME\_HW\_I2C u8x8(/rst/ 16) ;

LoRa-Module:

> #define SS 18 // ESP32 GPIO18 (Pin18) – SX1276 NSS (Pin19) SPI Chip Select Input  
> #define MOSI 27 // ESP32 GPIO27 (Pin27) – SX1276 MOSI (Pin18) SPI Data Input  
> #define MISO 19 // ESP32 GPIO19 (Pin19) – SX1276 MISO (Pin17) SPI Data Output  
> #define SCK 5 // ESP32 GPIO5 (Pin5) – SX1276 SCK (Pin16) SPI Clock Input  
> #define RST 14 // ESP32 GPIO14 (Pin14) – SX1276 NRESET (Pin7) Reset Trigger Input  
> #define DIO0 26 // ESP32 GPIO26 (Pin15) – SX1276 DIO0 (Pin8) used by LMIC for IRQ RX\_Done & TX\_Done  
> DIO1 and DIO2 are connected to the pins labeled 11/12 (see pinmapping).

LiPo Charger:

> Chargecurrent: 0,35A (measured with USB-“CHARGER-DOCTOR”)  
> LED (blue): randomly flickers, if no battery is connected. Lights blue during charging.  
> Charger-IC marked with LTH7 (could be this one: [http://www.mojay.com.cn/enindex.php/proview-32-3.html](http://www.mojay.com.cn/enindex.php/proview-32-3.html) )

On/Off Switch:

> disconnects the battery. the board is always powered over usb.  
> but there is at least a diode in the path: Battery(+) —|\>|—switch—LDO

LED (red):

> on if powered by usb or battery.

LED (green) programmable:

> #define BUILTIN\_LED 22  
> pinMode(BUILTIN\_LED,OUTPUT);  
> digitalWrite(BUILTIN\_LED, LOW); // ON

open issues:

- which pin is DIO1, DIO2 ? 
- Datasheet / Pinout of the LoRa-module is still unclear (shielded module without text or logo)
- pinmapping (I have my doubts with the image from Alibaba e.g. SCL/SDA swapped, GPIO35/34, LoRa\_RST, …)

Democode and pinmapping (pay attention to the updated versions in the pullrequests !)

> **[GitHub - LilyGO/TTGO-LORA32: ESP32-TTGO-T3](https://github.com/LilyGO/TTGO-LORA32)**
>
> ESP32-TTGO-T3. Contribute to LilyGO/TTGO-LORA32 development by creating an account on GitHub.

_edit: outdated informations removed, updates, gitHub link_

---

<div class="post-metadata">

**Author:** ![Verkehrsrot](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/verkehrsrot/32/46588_2.png) [@Verkehrsrot](https://www.thethingsnetwork.org/forum/u/Verkehrsrot)\
**Post date:** [January 23, 2018, 11:30pm UTC](https://www.thethingsnetwork.org/forum/t/big-esp32-sx127x-topic-part-2/11973/8 "2018-01-23T23:30:39Z")

</div>

Great wrap-up, thank you!

It should be mentioned, at this time, that both boards seem to show up with several quality issues like broken or bad RF path and broken cabling.

For the Heltec boards i can state that they show up with different ESP32 chips in Revision 0 and Revision 1.

I got 4 Heltec boards total so far, from 2 different sellers. 2 boards work fine, 2 have unknown defects causing issues when LoRa packets are sent, and 1 board has broken battery LED (very dim).

---

<div class="post-metadata">

**Author:** ![BoRRoZ](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/borroz/32/44234_2.png) [@BoRRoZ](https://www.thethingsnetwork.org/forum/u/BoRRoZ)\
**Post date:** [January 23, 2018, 11:34pm UTC](https://www.thethingsnetwork.org/forum/t/big-esp32-sx127x-topic-part-2/11973/9 "2018-01-23T23:34:49Z")

</div>

indeed… what are the recommended boards @ this moment ?

---

<div class="post-metadata">

**Author:** ![bluejedi](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/bluejedi/32/44639_2.png) [@bluejedi](https://www.thethingsnetwork.org/forum/u/bluejedi)\
**Post date:** [January 24, 2018, 11:26am UTC](https://www.thethingsnetwork.org/forum/t/big-esp32-sx127x-topic-part-2/11973/10 "2018-01-24T11:26:42Z")

</div>

The LoRa module on the TTGO V2 is very likely from HPDTek:  
HPD13A-868S (SX1276) and HPD14A-433S (SX1278).

The layout and pins are compatible with SX127x and HopeRF9x modules. Uses a 4-layer PCB instead of the 2-layer PCB from the HopeRF modules, so the layout will be different (thanks @rocketscream).

The HPD13 (without A, no shield) is discussed in this Rocket Scream article: [The SX1276 Modules Shootout](http://www.rocketscream.com/blog/2017/08/21/the-sx1276-modules-shootout-hoperfs-rfm95w-vs-nicerfs-lora1276-c1-vs-hpdteks-hpd13/)

@rocketscream Have you also tested any HPDTek HPD13A modules with the shield?

![HPDTek HPD13A-868S module front and back 500x238](https://www.thethingsnetwork.org/forum/uploads/default/original/2X/8/82408431daced0aa7508d6001c73da68e8492d70.png)  
HPDTek HPD13A

---

<div class="post-metadata">

**Author:** ![rocketscream](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/rocketscream/32/45934_2.png) [@rocketscream](https://www.thethingsnetwork.org/forum/u/rocketscream)\
**Post date:** [January 24, 2018, 11:45am UTC](https://www.thethingsnetwork.org/forum/t/big-esp32-sx127x-topic-part-2/11973/11 "2018-01-24T11:45:38Z")

</div>

@bluejedi yes tested. If you look at the range mapping on the map, I added the HPD13A plot too. 4-layer board compared to 2-layer boards of RFM95W and NiceRF SX1276-C1. Surprisingly more or less same range achieved but not sure about other aspect like EMI performance and how much easier to obtain FCC/CE with the shield.

---

<div class="post-metadata">

**Author:** ![bluejedi](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/bluejedi/32/44639_2.png) [@bluejedi](https://www.thethingsnetwork.org/forum/u/bluejedi)\
**Post date:** [January 24, 2018, 12:02pm UTC](https://www.thethingsnetwork.org/forum/t/big-esp32-sx127x-topic-part-2/11973/12 "2018-01-24T12:02:23Z")

</div>

> [@TKroenert](#):
>
> For the TTGO LoRa32 v2.0:
> 
> OLED:
> 
> > U8X8\_SSD1306\_128X32\_UNIVISION\_HW\_I2C u8x8(/\* clock=_/ 22, /_ data=\*/ 21, U8X8\_PIN\_NONE);
> 
> LoRa-Module:
> 
> > #define …

So they are using the standard I2C pins now for the TTGO LoRa32 V2 OLED display.  
The SPI pins that you list are the same as for the other boards.

If you use the _‘Heltec Wifi LoRa 32’_ board definition the I2C _(SCL, SDA)_, SPI _(SCK, MOSI, MISO, SS)_ and LED _(LED\_BUILTIN)_ pins are already correctly defined, no need to redefine them.

I see you that you specified no reset pin for the OLED. While many I2C OLED modules don’t use a reset pin the Heltec boards _are_ using a reset pin for the display (not sure about the other TTGO boards).  
I would be surprised if they would have dropped the display reset pin on the TTGO LoRa32 V2.

The display on the TTGO LoRa32 V2 is definitely a SSD1306 **128x64** not 128x32.  
You should be able to use the following instead:

```
//U8X8_SSD1306_128X64_NONAME_HW_I2C display([reset [, clock, data]])

//When using Heltec Wifi LoRa 32 board definition and reset on pin 16:
U8X8_SSD1306_128X64_NONAME_HW_I2C display(/*rst*/ 16) ;

//When using Heltec Wifi LoRa 32 board definition without reset:
U8X8_SSD1306_128X64_NONAME_HW_I2C display() ;

```

@TKroenert Could you verify this so I can add it to the topic start?

---

<div class="post-metadata">

**Author:** ![bluejedi](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/bluejedi/32/44639_2.png) [@bluejedi](https://www.thethingsnetwork.org/forum/u/bluejedi)\
**Post date:** [January 24, 2018, 12:32pm UTC](https://www.thethingsnetwork.org/forum/t/big-esp32-sx127x-topic-part-2/11973/13 "2018-01-24T12:32:43Z")

</div>

> [@BoRRoZ](#):
>
> what are the recommended boards @ this moment ?

From a purely specs based perspective the TTGO LoRa32 V2 because:

**Pro’s**

- Uses a known LoRa module instead of a custom configuration.  
_Less that can go wrong. The antenna trace looks clean with only a few components._
- Uses ESP32-Pico-D4 instead of ESP32.  
“ESP32-PICO-D4 integrates all peripheral components seamlessly, including a crystal oscillator, flash, filter capacitors and RF matching links in one single package.” _So less that can go wrong._
- Has an on/off switch.
- Has a micro-SD card slot _(its practical use has yet to be determined)_.

**Cons**

- Slightly larger than the the other boards. Not a big issue, but it seems to leave less room on the sides for wires on a breadboard.

**Unclear**

- Quality of the HPDTek LoRa module.
- Overall quality of the board.
- How does performance of the WiFi antenna (and its location) compare to Heltec V2?

---

<div class="post-metadata">

**Author:** ![BoRRoZ](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/borroz/32/44234_2.png) [@BoRRoZ](https://www.thethingsnetwork.org/forum/u/BoRRoZ)\
**Post date:** [January 24, 2018, 12:42pm UTC](https://www.thethingsnetwork.org/forum/t/big-esp32-sx127x-topic-part-2/11973/14 "2018-01-24T12:42:22Z")

</div>

tnx… there are so many ‘lookalikes’ out there 🕶

---

<div class="post-metadata">

**Author:** ![bluejedi](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/bluejedi/32/44639_2.png) [@bluejedi](https://www.thethingsnetwork.org/forum/u/bluejedi)\
**Post date:** [January 24, 2018, 1:02pm UTC](https://www.thethingsnetwork.org/forum/t/big-esp32-sx127x-topic-part-2/11973/15 "2018-01-24T13:02:56Z")

</div>

A problem on AliExpress and possibly eBay is that sellers show pictures from different boards for one product.  
It took me a while before I saw the forest for the trees.  
The TTGO LoRa32 V2 is sold by only a few sellers on AliExpress (e.g. Lily GO).

---

<div class="post-metadata">

**Author:** ![bluejedi](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/bluejedi/32/44639_2.png) [@bluejedi](https://www.thethingsnetwork.org/forum/u/bluejedi)\
**Post date:** [January 24, 2018, 1:26pm UTC](https://www.thethingsnetwork.org/forum/t/big-esp32-sx127x-topic-part-2/11973/16 "2018-01-24T13:26:12Z")

</div>

Nice map!

> [@rocketscream](#):
>
> Surprisingly more or less same range achieved

Can you explain that? I only see a much smaller range on the map for the HPD13A (yellow) than for the RFM95W (green) and HPD13 (orange, _must enable in menu first_). The furthest point that I see for the HPD13A is only 700m from base station.

[https://www.google.com/maps/d/viewer?mid=1bAQcAE5o24LUWCvQuUVphVgwFdY&hl=en&ll=3.0979107925365987%2C101.46318823828119&z=13](https://www.google.com/maps/d/viewer?mid=1bAQcAE5o24LUWCvQuUVphVgwFdY&hl=en&ll=3.0979107925365987%2C101.46318823828119&z=13)

---

<div class="post-metadata">

**Author:** ![bluejedi](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/bluejedi/32/44639_2.png) [@bluejedi](https://www.thethingsnetwork.org/forum/u/bluejedi)\
**Post date:** [January 24, 2018, 2:37pm UTC](https://www.thethingsnetwork.org/forum/t/big-esp32-sx127x-topic-part-2/11973/17 "2018-01-24T14:37:51Z")

</div>

You may check if your wiring is correct, sometimes tweaking the wires a bit can help (especially on a breadboard). Could be one of the DIO pins, misconfiguration of pins in the software or possibly not having correctly entered the OTAA ID’s/keys (DEVEUI and APPEUI should be in lsb first order, APPKEY in msb first).

---

<div class="post-metadata">

**Author:** ![rocketscream](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/rocketscream/32/45934_2.png) [@rocketscream](https://www.thethingsnetwork.org/forum/u/rocketscream)\
**Post date:** [January 24, 2018, 3:34pm UTC](https://www.thethingsnetwork.org/forum/t/big-esp32-sx127x-topic-part-2/11973/18 "2018-01-24T15:34:45Z")

</div>

I think I didn’t manage to complete it on that day because it started to rain heavily. But, from the plots, they are more consistent within that shorter distance.

---

<div class="post-metadata">

**Author:** ![TKroenert](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/tkroenert/32/10010_2.png) [@TKroenert](https://www.thethingsnetwork.org/forum/u/TKroenert)\
**Post date:** [January 24, 2018, 5:52pm UTC](https://www.thethingsnetwork.org/forum/t/big-esp32-sx127x-topic-part-2/11973/19 "2018-01-24T17:52:01Z")

</div>

> [@bluejedi](#):
>
> @TKroenert Could you verify this so I can add it to the topic start?

I had to slightly modify your code snippet ( _U8X8\_PIN\_NONE_ ) but it works with and without the reset pin and in FullHD^W 128x64 😊 :

> //When using Heltec Wifi LoRa 32 board definition and reset on pin 16:  
> U8X8\_SSD1306\_128X64\_NONAME\_HW\_I2C u8x8(/_rst_/ 16) ;
> 
> //When using Heltec Wifi LoRa 32 board definition and reset on pin 16:  
> U8X8\_SSD1306\_128X64\_NONAME\_HW\_I2C u8x8(/_rst_/ U8X8\_PIN\_NONE);

I also found the green onboard LED connected to pin 22 and LOW == ON (!):

> #define BUILTIN\_LED 22  
> pinMode(BUILTIN\_LED,OUTPUT);
> 
> digitalWrite(BUILTIN\_LED, LOW); // ON  
> delay(5000);  
> digitalWrite(BUILTIN\_LED, HIGH); // OFF

---

<div class="post-metadata">

**Author:** ![bluejedi](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/bluejedi/32/44639_2.png) [@bluejedi](https://www.thethingsnetwork.org/forum/u/bluejedi)\
**Post date:** [January 24, 2018, 9:59pm UTC](https://www.thethingsnetwork.org/forum/t/big-esp32-sx127x-topic-part-2/11973/20 "2018-01-24T21:59:56Z")

</div>

Thanks.

You are correct. One has to specify at least one parameter to U8X8\_SSD1306\_128X64\_NONAME\_HW\_I2C’s constructor (and the first is the reset pin). This appears to be a bug because all constructor parameters have a default value. _(I bumped into it before but had forgotten to mention it.)_

FYI: BUILTIN\_LED is old school. LED\_BUILTIN is the new way to go. BUILTIN\_LED is (still) supported for backwards compatibility.

FYI: English version of the [LTC4054-4.2 Datasheet](https://www.digchip.com/datasheets/download_datasheet.php?id=538521&part-number=LTC4054-4.2)

---

<div class="post-metadata">

**Author:** ![rocketscream](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/rocketscream/32/45934_2.png) [@rocketscream](https://www.thethingsnetwork.org/forum/u/rocketscream)\
**Post date:** [January 25, 2018, 8:13am UTC](https://www.thethingsnetwork.org/forum/t/big-esp32-sx127x-topic-part-2/11973/21 "2018-01-25T08:13:23Z")

</div>

As pointed out by @LoRaTracker [here](https://www.thethingsnetwork.org/forum/t/a-point-to-note-lora-low-data-rate-optimisation-flag/12007/2), I will redo the test when time permits. We should see a significant increase of range on all 4 modules.

---

<div class="post-metadata">

**Author:** ![bluejedi](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/bluejedi/32/44639_2.png) [@bluejedi](https://www.thethingsnetwork.org/forum/u/bluejedi)\
**Post date:** [January 25, 2018, 12:13pm UTC](https://www.thethingsnetwork.org/forum/t/big-esp32-sx127x-topic-part-2/11973/22 "2018-01-25T12:13:51Z")

</div>

> [@TKroenert](#):
>
> For the TTGO LoRa32 v2.0:
> 
> > DIO1 and DIO2 are connected to the pins labeled 11/12 (see pinmapping).

(Somehow) contradicts with / is unclear: [“LoRa\_DIO1 and LoRa\_DIO2 (NOT CONNECTED TO GPIO11/GPIO12)”](https://github.com/TKroenert/TTGO-LORA32-V2.0/blob/ed13fe92a30f4552d466a07b99b181aff0cc7a3b/images/image5.jpg) because pin numbers refer to/are GPIO ports.

Do you mean that GPIO11 and GPIO12 are not available as pins, but DIO1 and DIO2 are available as pins instead and DIO1/DIO2 are not connected to GPIO11/GPIO12?

What made you think that DIO1/DIO2 should be connected to GPIO11/GPIO12 (the other boards use GPIO33/GPIO32)?

---

<div class="post-metadata">

**Author:** ![Don-Hege](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/don-hege/32/25844_2.png) [@Don-Hege](https://www.thethingsnetwork.org/forum/u/Don-Hege)\
**Post date:** [January 25, 2018, 12:34pm UTC](https://www.thethingsnetwork.org/forum/t/big-esp32-sx127x-topic-part-2/11973/23 "2018-01-25T12:34:02Z")

</div>

Looks like I got the TTGO LoRa32 v1 yesterday. By now I can only say that it has a pretty strong connection if it’s within the same room with the gateway. 😂 Maybe I have some time for a walk through the neighborhood this evening.

[Next page](https://www.thethingsnetwork.org/forum/t/big-esp32-sx127x-topic-part-2/11973.md?page=2)
