JSON string to send from multiple wireless sensors?

Hi,

I have 3 sensor nodes that sends node ID, location, temperature, humidity, light intensity, and battery level to a collector board.

The collector board is connected to Notecard WiFi and Notecarrier A.

I want to know if I should send individual sensor data to Notecard Wifi or I should append the 3 sensor node data into one JSON string.

If I append the 3 sensor node data into one JSON string, how should I format it. This below is data from 1 sensor node.

{“req”:“note.add”,“body”:{“nodeid”:1,“location”: “garage”, “temp”:35.5,“humid”:56.23 ,“light”:100,“bat”:80}}

Regards,
Markel

Hey @mtrobregado,

And welcome to the Blues community!

Either way works and it’s up to you. The approach you have in your description is totally fine, and is probably going to be the easiest to use. You can just do one note.add for each node and they’ll all be queued for the next outbound sync.

{"req":"note.add","body":{"nodeid":1,"location":"garage","temp":35.5,"humid":56.23,"light":100,"bat":80}}
{"req":"note.add","body":{"nodeid":2,"location":"bedroom","temp":35.5,"humid":56.23,"light":100,"bat":80}}
{"req":"note.add","body":{"nodeid":3,"location":"kitchen","temp":35.5,"humid":56.23,"light":100,"bat":80}}

If you do want to combine the readings here’s one way you could do it.

{
  "req": "note.add",
  "body": {
    "nodes": [
      {
        "nodeid": 1,
        "location": "garage",
        "temp": 35.5,
        "humid": 56.23,
        "light": 100,
        "bat": 80
      },
      {
        "nodeid": 2,
        "location": "bedroom",
        "temp": 35.5,
        "humid": 56.23,
        "light": 100,
        "bat": 80
      }
    ]
  }
}

This is valid JSON so Notecard and Notehub will both handle it just fine. The downside is this JSON is a bit harder to use because you’ll always have to parse the readings out of an array.

It’s up to you.

Thanks,
TJ VanToll

Hi TJ Vantoll,

I attended a Blues wireless webinar with you and Rob Lauer as host. That was for the Build2Gether 2.0 Contest.

I will try note.add for each node.

I am using TI CC1352R1 Launchpad as collector. I am using 3 x TI LPSTK-CC1352R1 as sensor nodes. The communication from sensor node to collector is shown in this video below.

The collector can connect up to 100 sensor nodes. The limitation is due the FLASH and RAM of the collector board.

Just another question. Does Blues wireless notecards(WiFi, Cellular, Satellite) able to queue 100 messages from the collector board?

Regards,
Markel

Hey Markel,

Does Blues wireless notecards(WiFi, Cellular, Satellite) able to queue 100 messages from the collector board?

The Notecard enforces a limit of 100 queued Notes per Notefile, however, you can exceed this limit if you set up a Note Template for your Notefile. See Low Bandwidth Design - Blues Developers.

TJ

1 Like