/Lora-TTNMapper-T-Beam

TTNMapper on the TTGO T-Beam

Primary LanguageC++GNU General Public License v3.0GPL-3.0

Intro

This Fork from Bjoerns-TB, forked from DeuxVis, supports OLED display on the I²C interface on GPIO22 and GPI21. This repo contains a patched SSD1306 library from smartnick, enabling individual I²C pins and to set I²C Clock to 800kHz.

This is a simple sketch demonstrating the capability of the TTGO T-Beam as a TTN Mapper Node on The Things Network LoraWAN.

Derived from sbiermann/Lora-TTNMapper-ESP32 and with some information/inspiration from cyberman54/ESP32-Paxcounter and Edzelf/LoRa.

New features

  • GPS scan relaxed and done more "nonblocking"
  • more informations shown on status screen
  • animated GPS-fix-screen with satelite gfx
  • selectable datarate and power (button short press)
  • selectable transmit interval (button longer press)
  • selectable ADR-Mode (button even longer press)
  • selectable send-port to enable "on device" switch to experimental mapping (button even loooonger press)
  • support for newer HW-revisions (V08 / V0.8, V09 / V0.9, V10 / V1.0, with soft-power-button and powermanagement chip) (short press = power-on / dimm-mode; long press = power-off)

Start screenGPS fix screenStatus screen

Software dependencies

Arduino IDE ESP32 extension

TinyGPS++

LMIC-Arduino : Make sure to get the last version - 1.5.0+arduino-2 currently - because the arduino IDE library updater is getting confused by the versioning scheme of that library.

Instructions

You can program the T-Beam using the Arduino ESP32 board 't-beam'.

It is suitable for t-beam HW-Version up to V07 (use folder "uptoV07") and higher versions with Soft-Power-Button (use folder "fromV08"). For version V08 and higher you also need this library from Lewis He.

On The Things Network side, the settings needed are available here.

Configure the Payload decoder with:

function Decoder(bytes, port) {
    var decoded = {};

    decoded.latitude = ((bytes[0]<<16)>>>0) + ((bytes[1]<<8)>>>0) + bytes[2];
    decoded.latitude = (decoded.latitude / 16777215.0 * 180) - 90;
  
    decoded.longitude = ((bytes[3]<<16)>>>0) + ((bytes[4]<<8)>>>0) + bytes[5];
    decoded.longitude = (decoded.longitude / 16777215.0 * 360) - 180;
  
    var altValue = ((bytes[6]<<8)>>>0) + bytes[7];
    var sign = bytes[6] & (1 << 7);
    if(sign)
    {
        decoded.altitude = 0xFFFF0000 | altValue;
    }
    else
    {
        decoded.altitude = altValue;
    }
  
    decoded.hdop = bytes[8] / 10.0;

    return decoded;
}