OPEnSLab-OSU / Loom

Arduino library for Internet of Things Rapid Prototyping in environmental sensing
GNU General Public License v3.0
26 stars 3 forks source link

Test Loom_Multiplexer - Winnie #152

Closed winniiew closed 3 years ago

winniiew commented 3 years ago

Testing w/ TSL2591, SHT31D but TSL isn't outputting data

winniiew commented 3 years ago
///////////////////////////////////////////////////////////////////////////////

// This is an example to use with the Loom Multiplexer to enable you to
// dynamically connect any Loom-supported I2C sensors

// The code is essentially the same a 'Basic', the only real different is the
// enabling of the Multiplexer in the configuration.

///////////////////////////////////////////////////////////////////////////////

#include <Loom.h>

// Include configuration
const char* json_config =
#include "config.h"
;

// In Tools menu, set:
// Internet  > Disabled
// Sensors   > Enabled
// Radios    > Disabled
// Actuators > Disabled
// Max       > Disabled

using namespace Loom;

Loom::Manager Feather{};

void setup()
{
    Feather.begin_serial(true,true);
    Feather.parse_config(json_config);
    Feather.print_config();

    LPrintln("\n ** Setup Complete ** ");
}

void loop()
{
    Feather.measure();
    Feather.package();
    Feather.display_data();
    Feather.pause();
}
winniiew commented 3 years ago
"{\
    'general':\
    {\
        'name':'Device',\
        'instance':1,\
        'interval':2000\
    },\
    'components':[\
        {\
        'name':'Analog',\
        'params':'default'\
        },\
        {\
        'name':'Multiplexer',\
        'params':'default'\
        },\
    {\
      'name':'TSL2591',\
      'params':'default'\
    },\
      {\
      'name':'SHT31D',\
      'params':'default'\
    }\
    ]\
}"
winniiew commented 3 years ago
Initialized Serial!

= = = = = Parse Config = = = = =

Config Pretty Version:
{
  "general": {
    "name": "Device",
    "instance": 1,
    "interval": 2000
  },
  "components": [
    {
      "name": "Analog",
      "params": "default"
    },
    {
      "name": "Multiplexer",
      "params": "default"
    },
    {
      "name": "TSL2591",
      "params": "default"
    },
    {
      "name": "SHT31D",
      "params": "default"
    }
  ]
}
SIZE: 435
= = = = = Generate Objects = = = = =

[Device] Adding Module: Analog
[Multiplexer] Setup Complete
[Device] Adding Module: Multiplexer
[TSL2591] Initialize failed
[Device] Cannot add inactive module
[SHT31D] Initialize sucessful
[Device] Adding Module: SHT31D
= = = = = = = = = = = = = = = = =

[Device] Config:
    Device Name         : Device
    Instance Number     : 1
    Device Type         : Node
    Interval            : 2000
[Device] Modules:
        [+] Analog
        [+] Multiplexer
        [+] SHT31D

 ** Setup Complete ** 
Adding Sensor at address:41
[TSL2591_6] Initialize sucessful
[Multiplexer] Added TSL2591_6
[SHT31D] Failed to read temp/humid
[Device] Json:
{
  "type": "data",
  "id": {
    "name": "Device",
    "instance": 1
  },
  "contents": [
    {
      "module": "Packet",
      "data": {
        "Number": 1
      }
    },
    {
      "module": "Analog",
      "data": {
        "Vbat": 4.323194,
        "A[0]": 1037,
        "A[1]": 1504,
        "A[2]": 1370,
        "A[3]": 1294,
        "A[4]": 1541,
        "A[5]": 1592
      }
    },
    {
      "module": "TSL2591_6",
      "data": {
        "Vis": 0,
        "IR": 0,
        "Full": 0
      }
    },
    {
      "module": "SHT31D",
      "data": {
        "temp": 1.189331e-8,
        "humid": 4.520462e-39
      }
    }
  ]
}
winniiew commented 3 years ago

updated config.h

"{\
  'general':\
  {\
    'name':'Device',\
    'instance':1,\
    'interval':2000\
  },\
  'components':[\
    {\
      'name':'Analog',\
      'params':'default'\
    },\
    {\
      'name':'Multiplexer',\
      'params':'default'\
    },\
    {\
      'name':'DS3231',\
      'params':'default'\
    },\
     {\
      'name':'SHT31D',\
      'params':'default'\
    },\
      {\
      'name':'SD',\
      'params':[true,1000,10,'test',true]\
    },\
        {\
      'name':'TSL2591',\
      'params':'default'\
    }\
  ]\
}"
winniiew commented 3 years ago

Serial monitor output

 ** Setup Complete ** 
Adding Sensor at address:68
[SHT31D_2] Initialize sucessful
[Multiplexer] Added SHT31D_2
Adding Sensor at address:41
[TSL2591_4] Initialize sucessful
[Multiplexer] Added TSL2591_4
[SHT31D] Failed to read temp/humid
[Device] Json:
{
  "type": "data",
  "id": {
    "name": "Device",
    "instance": 1
  },
  "contents": [
    {
      "module": "Packet",
      "data": {
        "Number": 1
      }
    },
    {
      "module": "Analog",
      "data": {
        "Vbat": 5.082129,
        "A[0]": 2812,
        "A[1]": 1410,
        "A[2]": 1379,
        "A[3]": 1286,
        "A[4]": 1505,
        "A[5]": 1573
      }
    },
    {
      "module": "SHT31D_2",
      "data": {
        "temp": 29.8146,
        "humid": 37.10384
      }
    },
    {
      "module": "TSL2591_4",
      "data": {
        "Vis": 1043,
        "IR": 294,
        "Full": 1339
      }
    },
    {
      "module": "SHT31D",
      "data": {
        "temp": 29.8146,
        "humid": 37.10689
      }
    }
  ],
  "timestamp": {
    "date": "2165/165/165",
    "time": "165:165:85"
  }
}
[Multiplexer] Free Memory of TSL2591_4
Adding Sensor at address:0
[Device] Json:
{
  "type": "data",
  "id": {
    "name": "Device",
    "instance": 1
  },
  "contents": [
    {
      "module": "Packet",
      "data": {
        "Number": 2
      }
    },
    {
      "module": "Analog",
      "data": {
        "Vbat": 5.014453,
        "A[0]": 3481,
        "A[1]": 1481,
        "A[2]": 1396,
        "A[3]": 1296,
        "A[4]": 1568,
        "A[5]": 1617
      }
    },
    {
      "module": "SHT31D_2",
      "data": {
        "temp": 29.78256,
        "humid": 37.26711
      }
    },
    {
      "module": "SHT31D",
      "data": {
        "temp": 29.78256,
        "humid": 37.2549
      }
    }
  ],
  "timestamp": {
    "date": "2165/165/165",
    "time": "165:165:85"
  }
}