Skip to content

This is a Helium coverage mapping device based on the TTGO T-Beam development platform

Notifications You must be signed in to change notification settings

petrkr/helium-mapper-esp32-btgps

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Helium coverage mapper with TTGO T-Beam ESP32 device

This is a Helium device based on the TTGO T-Beam development platform using the SSD1306 I2C OLED display.

Setup

  1. Use plateformio and setup up a new project based on TTGO T-BEAM board .

  2. Install the Arduino IDE libraries:

  • mikalhart/TinyGPSPlus@^1.0.2
  • thingpulse/ESP8266 and ESP32 OLED driver for SSD1306 displays@^4.2.0
  • matthijskooijman/IBM LMIC framework@^1.5.1
  1. Edit include/config.h with your device information.
  • Device EUI from the console in LSB mode.
  • Application EUI from console in LSB mode
  • Application Key. This key should be in big endian format (or, since it is not really a number but a block of memory, endianness does not really apply). In practice, a key taken from ttnctl can be copied as-is. Anyway its in MSB mode.
  1. Add Helium Mapper integration to your Application

For Helium mapper https://mappers.helium.com

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

    decodedPayload.latitude = ((bytes[0]<<16)>>>0) + ((bytes[1]<<8)>>>0) + bytes[2];
    decodedPayload.latitude = (decodedPayload.latitude / 16777215.0 * 180) - 90;

    decodedPayload.longitude = ((bytes[3]<<16)>>>0) + ((bytes[4]<<8)>>>0) + bytes[5];
    decodedPayload.longitude = (decodedPayload.longitude / 16777215.0 * 360) - 180;

    var altValue = ((bytes[6]<<8)>>>0) + bytes[7];
    var sign = bytes[6] & (1 << 7);
    if(sign){
        decodedPayload.altitude = 0xFFFF0000 | altValue;
    } else {
        decodedPayload.altitude = altValue;
    }

    decodedPayload.ALARM_status = false;
    decodedPayload.BatV = 0;
    decodedPayload.MD = 0;
    decodedPayload.LON = "OFF";
    decodedPayload.FW = 0;
    decodedPayload.Roll = 0;
    decodedPayload.Pitch = 0;
    decodedPayload.accuracy= 3;
    decodedPayload.sats= bytes[9];
    decodedPayload.hdop = bytes[8] / 10.0;

    return decodedPayload;
}

For Cargo integration https://cargo.helium.com

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;
}
  1. Build and upload on device

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

Data transfered

The device transmit 10 bytes every minute :

Latitude on 3 bytes

Longitude on 3 bytes

Altitude on 2 bytes

hdop on 1 byte

Satellites on 1 byte

Latitude value transmitted is ((lat() + 90) / 180.0) * 16777215 You must decode it with reverse operation :

    val= ((bytes[0]<<16)>>>0) + ((bytes[1]<<8)>>>0) + bytes[2];  
    val = (val / 16777215.0 * 180) - 90

Longitude value transmitted is ((lng() + 180) / 360.0) * 16777215 You must decode it with reverse operation :

    val = ((bytes[3]<<16)>>>0) + ((bytes[4]<<8)>>>0) + bytes[5];
    val = (val / 16777215.0 * 360) - 180;

Have a fun

:)

About

This is a Helium coverage mapping device based on the TTGO T-Beam development platform

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 76.9%
  • C++ 23.1%