diff --git a/arduino-mkr-wan-1310/CHANGELOG.md b/arduino-mkr-wan-1310/CHANGELOG.md new file mode 100644 index 00000000..393db04c --- /dev/null +++ b/arduino-mkr-wan-1310/CHANGELOG.md @@ -0,0 +1,5 @@ +# Changelog + +## 1.0.0 - 2026-02-18 + +- First version of plugin \ No newline at end of file diff --git a/arduino-mkr-wan-1310/LICENSE.md b/arduino-mkr-wan-1310/LICENSE.md new file mode 100644 index 00000000..bffeef34 --- /dev/null +++ b/arduino-mkr-wan-1310/LICENSE.md @@ -0,0 +1,7 @@ +Copyright 2026 Thinger.io + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/arduino-mkr-wan-1310/README.md b/arduino-mkr-wan-1310/README.md new file mode 100644 index 00000000..a4c570c4 --- /dev/null +++ b/arduino-mkr-wan-1310/README.md @@ -0,0 +1,63 @@ +# Arduino MKR WAN 1310 + +The Arduino MKR WAN 1310 is a development board that provides a practical and cost-effective solution to add LoRaWAN® connectivity for projects requiring long-range, low-power wireless communication. Sensors and actuators can be connected to the board through the analog, digital, UART, SPI, and I2C pins. The MKR WAN 1310 comes complete with an ATECC508 secure element, a battery charger, 2MByte SPI Flash, and power consumption as low as 104 uA. + +## Features + +- **Microcontroller**: SAMD21 Cortex-M0+ 32-bit low power ARM MCU +- **Radio Module**: Murata CMWX1ZZABZ (based on Semtech SX1276) +- **Operating Voltage**: 3.3V +- **Input Voltage**: 5V (via USB/VIN) +- **Secure Element**: ATECC508 cryptographic co-processor +- **Memory**: 2MB SPI Flash +- **Power Consumption**: As low as 104 µA +- **Battery Charger**: Integrated Li-Po charging circuit +- **Connectivity**: LoRaWAN®, I2C, SPI, UART +- **I/O**: Analog and digital pins + +## Use Cases + +- Long-range IoT sensor networks +- Remote environmental monitoring +- Smart agriculture applications +- Asset tracking +- Smart city deployments +- Industrial IoT solutions +- Battery-powered remote sensors + +## Thinger.io Integration + +The Arduino MKR WAN 1310 can be integrated with Thinger.io through LoRaWAN network servers, enabling remote device management, data visualization, and bidirectional communication. + +## Requirements + +A LoRaWAN server is required to communicate the Arduino MKR WAN 1310 into Thinger.io, some options are: + +- [The Things Stack](https://www.thethingsindustries.com/stack/) +- [LORIOT](https://loriot.io/) +- [ChirpStack](https://www.chirpstack.io/) + +Alongside, the corresponding plugin for the selected LoRaWAN server needs to be installed in your Thinger.io instance. + +## Get Started + +### Installation + +Look for the plugin in the [Thinger.io Plugin Store](https://marketplace.thinger.io/) and install it in your Thinger.io instance. Once the plugin is installed a new Product will be created for this device. + +### Configuration + +The Product is already preconfigured, check that the auto provision prefix matches the one selected in your LoRaWAN server plugin in Thinger.io, or change it to your desire. + +### Usage + +Start sending uplinks for autoprovisioning devices and buckets. +This product also provides a predefined dashboard and downlinks. + +## Additional Resources + +Arduino resources can be found at: + +- [Arduino MKR WAN 1310 Documentation](https://docs.arduino.cc/hardware/mkr-wan-1310) +- [Arduino Store](https://store.arduino.cc/products/arduino-mkr-wan-1310) +- [Thinger docs](https://docs.thinger.io) \ No newline at end of file diff --git a/arduino-mkr-wan-1310/assets/mkrwan1310.png b/arduino-mkr-wan-1310/assets/mkrwan1310.png new file mode 100644 index 00000000..99076f4b Binary files /dev/null and b/arduino-mkr-wan-1310/assets/mkrwan1310.png differ diff --git a/arduino-mkr-wan-1310/plugin.json b/arduino-mkr-wan-1310/plugin.json new file mode 100644 index 00000000..c20687cd --- /dev/null +++ b/arduino-mkr-wan-1310/plugin.json @@ -0,0 +1,254 @@ +{ + "name": "arduino_mkr_wan_1310", + "version": "1.0.0", + "description": "The Arduino MKR WAN 1310 is a development board that adds LoRaWAN connectivity to projects requiring long-range, low-power wireless communication. It allows easy connection of sensors and actuators.", + "author": "Thinger.io", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/thinger-io/plugins.git", + "directory": "arduino-mkr-wan-1310" + }, + "metadata": { + "name": "Arduino MKR-WAN-1310", + "description": "The Arduino MKR WAN 1310 is a development board that adds LoRaWAN connectivity to projects requiring long-range, low-power wireless communication. It allows easy connection of sensors and actuators.", + "image": "assets/mkrwan1310.png", + "category": "devices", + "vendor": "arduino" + }, + "resources": { + "products": [ + { + "description": "The Arduino MKR WAN 1310 is a development board that adds LoRaWAN connectivity to projects requiring long-range, low-power wireless communication. It allows easy connection of sensors and actuators.", + "enabled": true, + "name": "Arduino MKR-WAN-1310", + "product": "arduino_mkr_wan_1310", + "profile": { + "api": { + "downlink": { + "enabled": true, + "handle_connectivity": false, + "request": { + "data": { + "path": "/downlink", + "payload": "{\n \"data\" : \"{{payload.data=\"\"}}\",\n \"port\" : {{payload.port=85}},\n \"priority\": {{payload.priority=3}},\n \"confirmed\" : {{payload.confirmed=false}},\n \"uplink\" : {{property.uplink}} \n}", + "payload_function": "", + "payload_type": "", + "plugin": "{{property.uplink.source}}", + "target": "plugin_endpoint" + } + } + }, + "uplink": { + "device_id_resolver": "getId", + "enabled": true, + "handle_connectivity": true, + "request": { + "data": { + "payload": "{{payload}}", + "payload_function": "", + "payload_type": "source_payload", + "resource_stream": "uplink", + "target": "resource_stream" + } + } + } + }, + "autoprovisions": { + "device_autoprovisioning": { + "config": { + "mode": "pattern", + "pattern": "arduino-mkr-wan-1310-.*" + }, + "enabled": true + } + }, + "buckets": { + "arduino_mkr_wan_1310_data": { + "backend": "mongodb", + "data": { + "payload": "{{payload}}", + "payload_function": "decodeThingerUplink", + "payload_type": "source_payload", + "resource": "uplink", + "source": "resource", + "update": "events" + }, + "enabled": true, + "retention": { + "period": 3, + "unit": "months" + }, + "tags": [] + } + }, + "code": { + "code": "function decodeThingerUplink(thingerData) {\n // 0. If data has already been decoded, we will return it\n if (thingerData.decodedPayload) return thingerData.decodedPayload;\n \n // 1. Extract and Validate Input\n // We need 'payload' (hex string) and 'fPort' (integer)\n const hexPayload = thingerData.payload || \"\";\n const port = thingerData.fPort || 1;\n\n // 2. Convert Hex String to Byte Array\n const bytes = [];\n for (let i = 0; i < hexPayload.length; i += 2) {\n bytes.push(parseInt(hexPayload.substr(i, 2), 16));\n }\n\n // 3. Dynamic Function Detection and Execution\n \n // CASE A: (The Things Stack v3)\n if (typeof decodeUplink === 'function') {\n try {\n const input = {\n bytes: bytes,\n fPort: port\n };\n var result = decodeUplink(input);\n \n if (result.data) return result.data;\n\n return result; \n } catch (e) {\n console.error(\"Error inside decodeUplink:\", e);\n throw e;\n }\n }\n\n // CASE B: Legacy TTN (v2)\n else if (typeof Decoder === 'function') {\n try {\n return Decoder(bytes, port);\n } catch (e) {\n console.error(\"Error inside Decoder:\", e);\n throw e;\n }\n }\n\n // CASE C: No decoder found\n else {\n throw new Error(\"No compatible TTN decoder function (decodeUplink or Decoder) found in scope.\");\n }\n}\n\n\n// TTN decoder\n// This is used with the LoRa LED/ON off basic sketch\n// Please refer to https://create.arduino.cc/editor/FT-CONTENT/043f42fb-2b04-4cfb-a277-b1a3dd5366c2/preview\n\nvar LED_STATES = ['off', 'on']\n\nfunction decodeUplink(input) {\n var data = {};\n data.ledState = LED_STATES[input.bytes[0]];\n return {\n data: data,\n };\n}\n\nfunction encodeDownlink(input) {\n var i = LED_STATES.indexOf(input.data.ledState);\n if (i === -1) {\n return {\n errors: ['unknown led state'],\n };\n }\n return {\n bytes: [i],\n fPort: 1,\n };\n}\n\nfunction decodeDownlink(input) {\n return {\n data: {\n ledState: LED_STATES[input.bytes[0]]\n }\n }\n}\n", + "environment": "javascript", + "storage": "", + "version": "1.0" + }, + "properties": { + "uplink": { + "data": { + "payload": "{{payload}}", + "payload_function": "", + "payload_type": "source_payload", + "resource": "uplink", + "source": "resource", + "update": "events" + }, + "default": { + "source": "value" + }, + "enabled": true + } + } + }, + "_resources": { + "properties": [ + { + "property": "dashboard", + "value": { + "tabs": [ + { + "name": "Main", + "widgets": [ + { + "layout": { + "col": 0, + "row": 0, + "sizeX": 2, + "sizeY": 6 + }, + "panel": { + "color": "#ffffff", + "currentColor": "#ffffff", + "showOffline": { + "type": "none" + }, + "title": "Current LED State" + }, + "properties": { + "source": "code", + "template": "
\n ● ON\n ○ OFF\n NO DATA\n
" + }, + "sources": [ + { + "bucket": { + "backend": "mongodb", + "id": "arduino_mkr_wan_1310_data", + "mapping": "ledState", + "tags": { + "device": [], + "group": [] + } + }, + "color": "#1abc9c", + "name": "LED State", + "source": "bucket", + "timespan": { + "mode": "latest" + } + } + ], + "type": "html_time" + }, + { + "layout": { + "col": 2, + "row": 0, + "sizeX": 4, + "sizeY": 12 + }, + "panel": { + "color": "#ffffff", + "currentColor": "#ffffff", + "showOffline": { + "type": "none" + }, + "title": "LED State History" + }, + "properties": { + "source": "code", + "template": "
\n \n \n \n \n \n \n \n \n \n \n \n \n \n
TimestampLED State
{{ entry.ts | date:'medium' }}\n ● ON\n ○ OFF\n
\n
" + }, + "sources": [ + { + "aggregation": {}, + "bucket": { + "backend": "mongodb", + "id": "arduino_mkr_wan_1310_data", + "mapping": "ts", + "tags": { + "device": [], + "group": [] + } + }, + "color": "#1abc9c", + "name": "ts", + "source": "bucket", + "timespan": { + "magnitude": "hour", + "mode": "relative", + "period": "latest", + "value": 24 + } + }, + { + "aggregation": {}, + "bucket": { + "backend": "mongodb", + "id": "arduino_mkr_wan_1310_data", + "mapping": "ledState", + "tags": { + "device": [], + "group": [] + } + }, + "color": "#3498db", + "name": "ledState", + "source": "bucket", + "timespan": { + "magnitude": "hour", + "mode": "relative", + "period": "latest", + "value": 24 + } + } + ], + "type": "html_time" + }, + { + "layout": { + "col": 0, + "row": 6, + "sizeX": 2, + "sizeY": 6 + }, + "panel": { + "color": "#ffffff", + "currentColor": "#ffffff", + "showOffline": { + "type": "none" + }, + "title": "Device Info" + }, + "properties": { + "source": "code", + "template": "
\n

Product: Arduino MKR WAN 1310

\n

Type: LoRaWAN Development Board

\n

Features:

\n \n
" + }, + "sources": [], + "type": "text" + } + ] + } + ] + } + } + ] + } + } + ] + } +}