/ttgo-tmotion-ttn-tracker

TTGO T-Motion Tracker for TTN Mapper using EU (868 MHz) and US (915 MHz) frequencies

Primary LanguageCGNU General Public License v3.0GPL-3.0

Adapted by Linar Yusupov

Libraries:

Patches:

Notice: Use of ABP TTN connection method is recommended.

Build instructions

You should have STM32CubeProg been pre-installed in order to program your T-Motion.
Press BOOT button on your T-Motion board, plug it into a PC/laptop USB slot, then release.

  1. Follow these official instructions to install Arduino IDE and latest stable Arduino STM32 Core (1.8.0)
  2. start Arduino application
  3. open main sketch from File -> Open menu
  4. Select Tools -> Board -> Nucleo_64
  5. Select Tools -> Optimize -> Fast (-O1)
  6. Select Tools -> Board part number -> Nucleo L073RZ
  7. Select Tools -> C Runtime library -> Newlib Nano + Float Printf
  8. Select Tools -> USB speed (if available) -> Low/Full Speed
  9. Select Tools -> USB support (if available) -> CDC (generic 'Serial' supersede U(S)ART)
  10. Select Tools -> U(S)ART support -> Enabled (no generic 'Serial')
  11. Select Tools -> Upload method -> STM32CubeProgrammer (DFU)
  12. Select Tools -> Port -> <your Dongle's DFU device name>
  13. Build and upload the sketch using Sketch -> Upload



Below are genuine instructions for TTGO T-Beam. Use them as an additional source of information:


TTGO T-Beam Tracker for The Things Network

Uploads GPS data from the TTGO T-Beam to The Things Network (TTN) and TTN Mapper for tracking and determining signal strength of LoRaWAN gateways and nodes.

Based on the code from xoseperez/ttgo-beam-tracker, with excerpts from dermatthias/Lora-TTNMapper-T-Beam to fix an issue with incorrect GPS data being transmitted to The Things Network. I also added support for the 915 MHz frequency (North and South America). lewisxhe/TTGO-T-Beam was referenced for enabling use on the newer T-Beam board (Rev1).

This is a LoRaWAN node based on the TTGO T-Beam development platform using the SSD1306 I2C OLED display. It uses a RFM95 by HopeRF and the MCCI LoRaWAN LMIC stack. This sample code is configured to connect to The Things Network using the US 915 MHz frequency by default, but can be changed to EU 868 MHz.

NOTE: There are now 2 versions of the TTGO T-BEAM, the first version (Rev0) and a newer version (Rev1). The GPS module on Rev1 is connected to different pins than Rev0. This code has been successfully tested on REV0, and is in the process of being tested on REV1. See the end of this README for photos of eah board.

Setup

  1. Follow the directions at espressif/arduino-esp32 to install the board to the Arduino IDE and use board 'T-Beam'.

  2. Install the Arduino IDE libraries:

  3. Copy the contents of the project file main/lmic_project_config.h to the library file arduino-lmic/project_config/lmic_project_config.h and uncomment the proper frequency for your region.

  4. Edit this project file main/configuration.h and select your correct board revision, either T_BEAM_V07 or T_BEAM_V10 (see T-BEAM Board Versions to determine which board revision you have).

  5. Edit this project file main/credentials.h to use either USE_ABP or USE_OTAA and add the Keys/EUIs for your Application's Device from The Things Network.

  6. Add the TTN Mapper integration to your Application (and optionally the Data Storage integration if you want to access the GPS location information yourself or use TTN Tracker, then add the Decoder code:

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;
    decoded.sats = bytes[9];

    return decoded;
}
  1. Open this project file main/main.ino with the Arduino IDE and upload it to your TTGO T-Beam.

  2. Turn on the device and once a GPS lock is acquired, the device will start sending data to TTN and TTN Mapper.

TTN Tracker

I also developed The Things Network Tracker (TTN-Tracker), a web app that pulls GPS data from TTN and displays it on a map in real-time (TTN Mapper is not real-time) that can be displayed on your phone, tablet, or computer. This is handy for testing signal range while driving, as you can see location points appearing under your moving location dot on the map (if you grant location sharing permissions to the web app) when a successful transmission has been achieved.