Soil Moisture Converter


Converts raw counts to mV, then using the Decagon supplied equation, takes those mV's and figures out soil moisture percentage.
//============================================
// Macro for data evaluation on PhotosynQ.org
// created: 6/6/2017
//============================================

//Define the output object here
var output = {};
var Counts = (json.analog_read / 17.99137829)-126.3651165922;
var Wet = ((0.000494*Counts)-0.554) * 100;
//Check if the key time exists in json

if (json.time !== undefined){

	//Add key time and value to output
	output["time"] = json.time;
}

//Return data
output ["Raw"] = json.analog_read;
output ["Soil Moisture %"] = Wet;
return output;
{
  "time": "1496776547329",
  "device_name": "MultispeQ",
  "device_version": "1",
  "device_id": "ff:ff:ff:ff",
  "device_battery": -203,
  "device_firmware": 1.17,
  "sample": [
    [
      {
        "time": "1496776547340",
        "protocol_id": 1,
        "analog_read": 25627,
        "data_raw": [

        ]
      }
    ]
  ],
  "app_os": "win32-ia32",
  "app_name": "PhotosynQ",
  "app_version": "0.0.10",
  "app_device": "ia32",
  "location": [
    "42.7225866",
    "-84.4746659"
  ],
  "time_offset": "America/New_York",
  "ConsoleMacro": "342"
}
Default avatar
Created by

Sean


Protocol connections:
1
Latest Update:
Jun 2017