TTGO Lora ESP32 V2.1 R1.6


Library and Pins for LoRa V2.1_1.6

Site from seller (copied below) shows:

Lora, operating on SPI:

26 = DI0/IO0


18 = NSS/SEL (Slave select?)

5 = SCK (clock?)

27 = MOSI

19 = MISO

SD Card, also on SPI:

13 = CS “SD3-CS-IO13” (Slave select SS?)

15 = MOS1 “CMD-MOS1” (MOSI?)

14 = CLK (clock?)


12 = Data2 SD2-IO12 DAT2

4 = Data2

“Flash light”

25 = Blink LED (checked)

Setup for Arduino

Using Ardino-Esp32 boars, there is only TTGO LoRa V1 (not V2.1 R1.6). Some pins are wrong it seem (eg. Blink LED is actually 25)


According to Arduino ESP32 SPI Example: “The ESP32 has four SPi buses, however as of right now only two of them are available to use, HSPI and VSPI. Simply using the SPI API as illustrated in Arduino examples will use HSPI,  leaving VSPI unused.”.

The example says:

//set up slave select pins as outputs as the Arduino API
//doesn’t handle automatically pulling SS low
pinMode(5, OUTPUT); //VSPI SS
pinMode(15, OUTPUT); //HSPI SS

vspi->beginTransaction(SPISettings(spiClk, MSBFIRST, SPI_MODE0));
digitalWrite(5, LOW); //pull SS slow to prep other end for transfer
digitalWrite(5, HIGH); //pull ss high to signify end of data transfer

Library and Pins for LoRa V2.1_1.6

This library: was used.

The Sender / Receiver test worked with the following pin change based on the AliExpress supplier (copied below):

LoRa.setPins(18, 23, 26); // SEL/NSS, IRQ, DIIO
if (!LoRa.begin(915E6)) {

Library for OLED

Library was and is available via Arduino Library manager.

Change the pins to suit the TTGO LoRaV2.1_1.6 (marked T3_1.6)

//OLED pins to ESP32 GPIOs
//SSD1306 display(Address, SDA, SCL);/
//SSD1306 display(0x3c, 4, 15); REPLACED
SSD1306 display(0x3c, 21, 22); // TTGO-LoRa32-V2-1-1-6

Library and Pins for SD Card

The in-built Arduino Library “SD.h”, together with “SPI.h” and “FS.h” work with pin modification. SD_Test, for example, runs with:

void setup(){
SPI.begin(14, 2, 15); // TTGO V2
Serial.println("Card Mount Failed");

However, LoRa and SD Card can’t run together. Despite being seemingly on different SPIs buses, I can’t get them to both work in the same program.

Library and Pins for BME280

I used this library  for the BME280 interface. It had a good github and worked. The Adafruit library it’s find the BME280 sensor.

I2C worked to conect the sensor:

Wire.begin(); // Uses SDA, SCL pins by default. There are 21 and 22 on my ESP32 board.
Wire.begin(21,22); // Equivalent
assert(bme.begin()); // Searches for the sensor

It’s easy to get readings. A nice phychrometric library can convert the temperature and humidity and pressure to anything else (e.g. dewpoint). There’s a plain “C” version with a header and .c file. Just include them in the Arduino sketch folder and tell the compiler it’s a C (not C++) header:

extern "C" {
#include "psychrolib.h"
// Set the unit system, for example to SI (can be either 'SI' or 'IP') - this needs to be done only once
// Calculate the dew point temperature for a dry bulb temperature of 25 C and a relative humidity of 80%
double TDewPoint = GetTDewPointFromRelHum(25.0, 0.80);

Library for CCS811

This senses CO2, VOCs and temperature. The Adafruit library works without modifcation via I2C. The CCS811 and BME280 work fine together on one I2C bus. However, I’m unable to get the CCS811 to work reliably in a class. Confusing. To do.



According to the Guy with a Swiss Accent:

  • Start up no WiFi 40-45mA
  • Flash Mode 20-25mA
  • WiFi Example 120-125mA (300mA -400mA spikes)
  • Deep Sleep Timer 5.xµA
  • Deep Sleep GPIO 6.xµA

I connected a multimeter (shit one) in line with a 3.7v battery, powering via the special battery connector and measured:

  • Bare Minimum Example: 73mA : does not sleep
  • Bare Minimum Example with huge delay/sleep: 50mA
  • WiFiBasicClient: 50mA at idle, with 100mA on WiFi
  • LoRA transmit with default, continuous: 186mA
  • TimerWakeUp example: deep sleep: 9mA in deep sleep
    • No change: Add sp_deep_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_OFF);
    • No change: Add btStop(); && WiFi.mode(WIFI_OFF);
    • No change: Don’t start Serial
    • Physical remove RED led: 8mA

So the lowest I can get is 8mA. This is 1000x the 5µA of the ESP32 in bare mode. Assumedly, the TTGO is powering something while in deep sleep, but I can’t find what it is.

At 10mA and a 2500mAh battery standby would be 2500 (mAh) / 10 = 250h or just 10 days. That’s way too short.

Researching (yes, that’s Google) shows here that most dev boards don’t achieve µA current draw like a bare ESP32. Maybe LoRa is on, but can’t fix that as pin 18 is not RTC latchable. This appears to be a show stopper for battery powering the device.

Some options:

  • Use a bare ESP32 and WiFi. That should be able to sleep properly. My WRoom32-DevC board has the same consumption. Mabe DFRobot WROOM32 board is better?
  • Use a bare ESP32 and a RFM95-style module, which might be able to forcefully sleep.
  • Use a solar panel.


Details from seller of the board


LORA_1.6 version
SD card: SD3-CS-IO13

lora32 ttgo v2 lora32 ttgo v2

3 thoughts on “TTGO Lora ESP32 V2.1 R1.6

  1. Hi.
    Do you have a way to get these modules into Flash mode?
    Have 2 pieces of these modules here, i wants to use them for Lora Aprs.
    But don’t get the modules set to Flash mode.

    Greetings from Germany

  2. LoRa V2.1_1.6 can perfectly run simultaneously both the LoRa antenna and the SD card in the same program.
    The trick is “” and “SPI.end()”. Example:

    void loop(){
    // SD Card section
    SPI.begin(14, 2, 15); // SCK, MISO, MOSI
    if (SD.begin(13)) { // CS
    /* Your SD card code*/
    // LoRa section
    SPI.begin(5, 19, 27, 18); //SCK, MISO, MOSI, SS
    LoRa.setPins(18, 23, 26); //SS, RST, DI0
    /* Your LoRa stuff */

    As simple as that.

    Greetings from México.

Leave a Reply

Your email address will not be published. Required fields are marked *