Lalitya SahukaraJacob Gardanier
Published

Pollution's Interposer

This interposer is a machine that collects trash in the ocean while obtaining data about sea levels, ocean temperature, pH levels and more.

IntermediateProtip58
Pollution's Interposer

Things used in this project

Hardware components

SenseCAP K1100 - The Sensor Prototype Kit with LoRa® and AI
Seeed Studio SenseCAP K1100 - The Sensor Prototype Kit with LoRa® and AI
×1
DC Motor, Brush
DC Motor, Brush
×1
7.4V Battery
×1
Grove - Temperature, Humidity, Pressure and Gas Sensor (BME680)
Seeed Studio Grove - Temperature, Humidity, Pressure and Gas Sensor (BME680)
×1
Pro Boat 2.4GHz Transmitter
×1

Software apps and online services

SenseCAP Mate
Fusion
Autodesk Fusion
Autodesk EAGLE
Autodesk EAGLE
Arduino IDE
Arduino IDE

Hand tools and fabrication machines

3D Printer (generic)
3D Printer (generic)
Soldering iron (generic)
Soldering iron (generic)
Solder Wire, Lead Free
Solder Wire, Lead Free
Hot glue gun (generic)
Hot glue gun (generic)
Multitool, Screwdriver
Multitool, Screwdriver

Story

Read more

Custom parts and enclosures

CAD File

Schematics

Wio Terminal

It is the schematic for the Wio Terminal which is the microcontroller that controls all the sensors and sends the data back to us.

Code

Decoder for K1100

JavaScript
This is the code you need to use on The Things Network to get the data to display correctly.
function Decoder(bytes, port) {

    var decoded = {};

    function transformersint(bytes){
        value = bytes[0] * 256 + bytes[1];
        if (value == 32768){
          return;
        }
        if (value > 32768) {
        value = 32768 - value;
        }
        value = value;
        return value;
    }

    function transformersfloat(bytes){
        value = bytes[0] * 256 + bytes[1];
        if (value == 32768){
          return;
        }
        if (value > 32768) {
        value = 32768 - value;
        }
        value = value;
        return value/100;
    }

    function transformersAI(bytes){
        value = bytes[0];
        if (value == 255 || value >100){
          return;
        }
        return value;
    }

    if (port == 3) {
      if(bytes[0]==0x40) {
        decoded.light = transformersint(bytes.slice(1, 3));
        decoded.mic = transformersint(bytes.slice(3, 5));
        decoded.imux = transformersfloat(bytes.slice(5, 7));
        decoded.imuy = transformersfloat(bytes.slice(7, 9));
        decoded.imuz = transformersfloat(bytes.slice(9, 11));
      }
      if(bytes[0]==0x42) {
        decoded.temp = transformersfloat(bytes.slice(1, 3));
        decoded.humi = transformersfloat(bytes.slice(3, 5));
        decoded.voc = transformersint(bytes.slice(5, 7));
        decoded.co2 = transformersint(bytes.slice(7, 9));
        decoded.soil = transformersint(bytes.slice(9, 11));
      }
      if(bytes[0]==0x44) {
        decoded.confidence_1 = transformersAI(bytes.slice(2));
        decoded.confidence_2 = transformersAI(bytes.slice(4));
        decoded.confidence_3 = transformersAI(bytes.slice(6));
        decoded.confidence_4 = transformersAI(bytes.slice(8));
        decoded.confidence_5 = transformersAI(bytes.slice(10));
      }

    }

    return decoded;
}

Credits

Lalitya Sahukara

Lalitya Sahukara

1 project • 1 follower
Jacob Gardanier

Jacob Gardanier

0 projects • 1 follower

Comments