Giter Club home page Giter Club logo

arduino-node-lib's Introduction

The Things Node Arduino Library

Build Status

This is an Arduino Library for The Things Node to communicate via The Things Network.

Installation

Documentation

Examples

The library comes with examples. After installing the library you need to restart the Arduino IDE before they can be found under File > Examples > TheThingsNode.

arduino-node-lib's People

Contributors

cyberman54 avatar hallard avatar johanstokking avatar jpmeijers avatar mchevroulet avatar pedzed avatar per1234 avatar rgm3 avatar samvanbrussel avatar simmoinard avatar tdsmtdsm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

arduino-node-lib's Issues

Arduino serial instructions

Instructions on how to pass a serial to the library. Currently, we're assuming Arduino Leonardo boards with Serial1, but it can be anything

Battery voltage sensor stops working if battery voltage drops below around 3 volts

After the battery voltage has dropped to some voltage (e.g. 2.9V), the readout always returns the same value for all following messages sent (hundreds) although the DMM measured battery voltage is much below the reported fixed value of 3280mV. Probably rather a HW problem. But the SW should not send wrong data. This makes the sensor useless.
22:30:571763
dev id:ttn-node-01payload:0CD0001008E9battery:3280event:"motion"light:16temperature:22.81
... hundreds of messages later..
11:26:122514
dev id:ttn-node-01payload:0CD6002908E3battery:3280event:"button"light:41temperature:22.75
actual DMM measured battery voltage: 2.0V
In this case the SW should somehow indicate in the message, that the data is invalid.

No indication on requirements of serial hardware/software for Arduino device

Hi Guys
I just spent a nice day with several successes: then I tried "this".

Context:
"We" are trying to create a http://makecode.com solution for TTN for kids and needed a known setup to go thru GW (Pi : as a newbi), Device and the setup required to get a device working within the bounds of a quick test with TTN console pages: I got there thanks to some help from Gonzalos and Lorenz (his shield).

The next step was to do a Cayenne setup: I got some good info from cdro and found the necessary repos.
Then I hit #define loraSerial Serial1: some googling and something to do with SW and HW Serial.

As stated, I want to get the makecode devices onto TTN, and I don't have arduino, so I had borrowed an arduino uno R3 which seems to not support the requirements for hardware for this library

Summary:
Some statement of requirement for the arduino such that the ardunio chosen fits the code

My 5 cents :)

isMoving always false within onMotionStart callback

The Things Node CayenneLLP example always shows "Moving now: no" in the debug serial output because the callback function is executed before the motionStarted flag is set. This flag should be set before callback execution so that motion callbacks are run after the state is mutated.

wdtStarted never set to false

wdtStarted is set to true in TheThingsNode::WDT_start(), but in TheThingsNode::WDT_stop(), not set to false.

void TheThingsNode::WDT_stop()
{
if (!this->wdtStarted)
{
return;
}
cli();
MCUSR &= ~(1 << WDRF);
WDTCSR |= (1 << WDCE) | (1 << WDE);
WDTCSR = 0x00;
WDTCSR = 0 << WDP0 | 1 << WDP1 | 0 << WDP2 | 0 << WDP3;
sei();
this->wdtStarted = true;
}

Guidance: Tweaking US915 frequencies

I'm looking for some guidance to tweak the US frequencies on the Things Node so I can use it to test my gateway deployments.

The TTN US-915 frequencies are defined like this [1]. My gateways are using this frequency plan [2]. Could some one provide guidance on how I can program the Things Node to support plan [2]?

Thanks!

[1] US-915 plan defined for TTN Network

{
	"SX1301_conf": {
		"lorawan_public": true,
		"clksrc": 1,
		"clksrc_desc": "radio_1 provides clock to concentrator for most devices except MultiTech. For MultiTech set to 0.",
		"antenna_gain": 0,
		"antenna_gain_desc": "antenna gain, in dBi",
		"radio_0": {
			"enable": true,
			"type": "SX1257",
			"freq": 904300000,
			"rssi_offset": -166.0,
			"tx_enable": true,
			"tx_freq_min": 923000000,
			"tx_freq_max": 928000000
		},
		"radio_1": {
			"enable": true,
			"type": "SX1257",
			"freq": 905000000,
			"rssi_offset": -166.0,
			"tx_enable": false
		},
		"chan_multiSF_0": {
			"desc": "Lora MAC, 125kHz, all SF, 903.9 MHz",
			"enable": true,
			"radio": 0,
			"if": -400000
		},
		"chan_multiSF_1": {
			"desc": "Lora MAC, 125kHz, all SF, 904.1 MHz",
			"enable": true,
			"radio": 0,
			"if": -200000
		},
		"chan_multiSF_2": {
			"desc": "Lora MAC, 125kHz, all SF, 904.3 MHz",
			"enable": true,
			"radio": 0,
			"if": 0
		},
		"chan_multiSF_3": {
			"desc": "Lora MAC, 125kHz, all SF, 904.5 MHz",
			"enable": true,
			"radio": 0,
			"if": 200000
		},
		"chan_multiSF_4": {
			"desc": "Lora MAC, 125kHz, all SF, 904.7 MHz",
			"enable": true,
			"radio": 1,
			"if": -300000
		},
		"chan_multiSF_5": {
			"desc": "Lora MAC, 125kHz, all SF, 904.9 MHz",
			"enable": true,
			"radio": 1,
			"if": -100000
		},
		"chan_multiSF_6": {
			"desc": "Lora MAC, 125kHz, all SF, 905.1 MHz",
			"enable": true,
			"radio": 1,
			"if": 100000
		},
		"chan_multiSF_7": {
			"desc": "Lora MAC, 125kHz, all SF, 905.3 MHz",
			"enable": true,
			"radio": 1,
			"if": 300000
		},
		"chan_Lora_std": {
			"desc": "Lora MAC, 500kHz, SF8, 904.6 MHz",
			"enable": true,
			"radio": 0,
			"if": 300000,
			"bandwidth": 500000,
			"spread_factor": 8
		},
		"chan_FSK": {
			"desc": "disabled",
			"enable": false
		},
		"tx_lut_0": {
			"desc": "TX gain table, index 0",
			"pa_gain": 0,
			"mix_gain": 8,
			"rf_power": -6,
			"dig_gain": 0
		},
		"tx_lut_1": {
			"desc": "TX gain table, index 1",
			"pa_gain": 0,
			"mix_gain": 10,
			"rf_power": -3,
			"dig_gain": 0
		},
		"tx_lut_2": {
			"desc": "TX gain table, index 2",
			"pa_gain": 0,
			"mix_gain": 12,
			"rf_power": 0,
			"dig_gain": 0
		},
		"tx_lut_3": {
			"desc": "TX gain table, index 3",
			"pa_gain": 1,
			"mix_gain": 8,
			"rf_power": 3,
			"dig_gain": 0
		},
		"tx_lut_4": {
			"desc": "TX gain table, index 4",
			"pa_gain": 1,
			"mix_gain": 10,
			"rf_power": 6,
			"dig_gain": 0
		},
		"tx_lut_5": {
			"desc": "TX gain table, index 5",
			"pa_gain": 1,
			"mix_gain": 12,
			"rf_power": 10,
			"dig_gain": 0
		},
		"tx_lut_6": {
			"desc": "TX gain table, index 6",
			"pa_gain": 1,
			"mix_gain": 13,
			"rf_power": 11,
			"dig_gain": 0
		},
		"tx_lut_7": {
			"desc": "TX gain table, index 7",
			"pa_gain": 2,
			"mix_gain": 9,
			"rf_power": 12,
			"dig_gain": 0
		},
		"tx_lut_8": {
			"desc": "TX gain table, index 8",
			"pa_gain": 1,
			"mix_gain": 15,
			"rf_power": 13,
			"dig_gain": 0
		},
		"tx_lut_9": {
			"desc": "TX gain table, index 9",
			"pa_gain": 2,
			"mix_gain": 10,
			"rf_power": 14,
			"dig_gain": 0
		},
		"tx_lut_10": {
			"desc": "TX gain table, index 10",
			"pa_gain": 2,
			"mix_gain": 11,
			"rf_power": 16,
			"dig_gain": 0
		},
		"tx_lut_11": {
			"desc": "TX gain table, index 11",
			"pa_gain": 3,
			"mix_gain": 9,
			"rf_power": 20,
			"dig_gain": 0
		},
		"tx_lut_12": {
			"desc": "TX gain table, index 12",
			"pa_gain": 3,
			"mix_gain": 10,
			"rf_power": 23,
			"dig_gain": 0
		},
		"tx_lut_13": {
			"desc": "TX gain table, index 13",
			"pa_gain": 3,
			"mix_gain": 11,
			"rf_power": 25,
			"dig_gain": 0
		},
		"tx_lut_14": {
			"desc": "TX gain table, index 14",
			"pa_gain": 3,
			"mix_gain": 12,
			"rf_power": 26,
			"dig_gain": 0
		},
		"tx_lut_15": {
			"desc": "TX gain table, index 15",
			"pa_gain": 3,
			"mix_gain": 14,
			"rf_power": 27,
			"dig_gain": 0
		}
	},
	"gateway_conf": {
		"server_address": "router.us.thethings.network",
		"serv_port_up": 1700,
		"serv_port_down": 1700,
		"servers": [ {
			"server_address": "router.us.thethings.network",
			"serv_port_up": 1700,
			"serv_port_down": 1700,
			"serv_enabled": true
		} ]
	}

}

[2] Modified US-915 frequency plan

{
    "SX1301_conf": {
             "lorawan_public": true,
        "clksrc": 1, /* radio_1 provides clock to concentrator */
        "antenna_gain": 0, /* antenna gain, in dBi */
        "radio_0": {
            "enable": true,
            "type": "SX1257",
            "freq": 902700000,
            "rssi_offset": -166.0,
            "tx_enable": true,
            "tx_freq_min": 902000000,
            "tx_freq_max": 928000000
        },
        "radio_1": {
            "enable": true,
            "type": "SX1257",
            "freq": 903400000,
            "rssi_offset": -166.0,
            "tx_enable": false
        },
        "chan_multiSF_0": {
            /* Lora MAC channel, 125kHz, all SF, 902.3 MHz */
            "enable": true,
            "radio": 0,
            "if": -400000
        },
        "chan_multiSF_1": {
            /* Lora MAC channel, 125kHz, all SF, 902.5 MHz */
            "enable": true,
            "radio": 0,
            "if": -200000
        },
        "chan_multiSF_2": {
            /* Lora MAC channel, 125kHz, all SF, 902.7 MHz */
            "enable": true,
            "radio": 0,
            "if": 0
        },
        "chan_multiSF_3": {
            /* Lora MAC channel, 125kHz, all SF, 902.9 MHz */
            "enable": true,
            "radio": 0,
            "if": 200000
        },
        "chan_multiSF_4": {
            /* Lora MAC channel, 125kHz, all SF, 903.1 MHz */
            "enable": true,
            "radio": 1,
            "if": -300000
        },
        "chan_multiSF_5": {
            /* Lora MAC channel, 125kHz, all SF, 903.3 MHz */
            "enable": true,
            "radio": 1,
            "if": -100000
        },
        "chan_multiSF_6": {
            /* Lora MAC channel, 125kHz, all SF, 903.5 MHz */
            "enable": true,
            "radio": 1,
            "if": 100000
        },
        "chan_multiSF_7": {
            /* Lora MAC channel, 125kHz, all SF, 903.7 MHz */
            "enable": true,
            "radio": 1,
            "if": 300000
        },
        "chan_Lora_std": {
            /* Lora MAC channel, 500kHz, SF8, 903.0 MHz */
            "enable": true,
            "radio": 0,
            "if": 300000,
            "bandwidth": 500000,
            "spread_factor": 8
        },
        "chan_FSK": {
            /* FSK 100kbps channel, 903.0 MHz */
            "enable": false,
            "radio": 0,
            "if": 300000,
            "bandwidth": 250000,
            "datarate": 100000
        },
                "tx_lut_0": {
                        "desc": "TX gain table, index 0",
                        "pa_gain": 0,
                        "mix_gain": 8,
                        "rf_power": -6,
                        "dig_gain": 0
                },
                "tx_lut_1": {
                        "desc": "TX gain table, index 1",
                        "pa_gain": 0,
                        "mix_gain": 10,
                        "rf_power": -3,
                        "dig_gain": 0
                },
                "tx_lut_2": {
                        "desc": "TX gain table, index 2",
                        "pa_gain": 0,
                        "mix_gain": 12,
                        "rf_power": 0,
                        "dig_gain": 0
                },
                "tx_lut_3": {
                        "desc": "TX gain table, index 3",
                        "pa_gain": 1,
                        "mix_gain": 8,
                        "rf_power": 3,
                        "dig_gain": 0
                },
                "tx_lut_4": {
                        "desc": "TX gain table, index 4",
                        "pa_gain": 1,
                        "mix_gain": 10,
                        "rf_power": 6,
                        "dig_gain": 0
                },
                "tx_lut_5": {
                        "desc": "TX gain table, index 5",
                        "pa_gain": 1,
                        "mix_gain": 12,
                        "rf_power": 10,
                        "dig_gain": 0
                },
                "tx_lut_6": {
                        "desc": "TX gain table, index 6",
                        "pa_gain": 1,
                        "mix_gain": 13,
                        "rf_power": 11,
                        "dig_gain": 0
                },
                "tx_lut_7": {
                        "desc": "TX gain table, index 7",
                        "pa_gain": 2,
                        "mix_gain": 9,
                        "rf_power": 12,
                        "dig_gain": 0
                },
                "tx_lut_8": {
                        "desc": "TX gain table, index 8",
                        "pa_gain": 1,
                        "mix_gain": 15,
                        "rf_power": 13,
                        "dig_gain": 0
                },
                "tx_lut_9": {
                        "desc": "TX gain table, index 9",
                        "pa_gain": 2,
                        "mix_gain": 10,
                        "rf_power": 14,
                        "dig_gain": 0
                },
                "tx_lut_10": {
                        "desc": "TX gain table, index 10",
                        "pa_gain": 2,
                        "mix_gain": 11,
                        "rf_power": 16,
                        "dig_gain": 0
                },
                "tx_lut_11": {
                        "desc": "TX gain table, index 11",
                        "pa_gain": 3,
                        "mix_gain": 9,
                        "rf_power": 20,
                        "dig_gain": 0
                },
                "tx_lut_12": {
                        "desc": "TX gain table, index 12",
                        "pa_gain": 3,
                        "mix_gain": 10,
                        "rf_power": 23,
                        "dig_gain": 0
                },
                "tx_lut_13": {
                        "desc": "TX gain table, index 13",
                        "pa_gain": 3,
                        "mix_gain": 11,
                        "rf_power": 25,
                        "dig_gain": 0
                },
                "tx_lut_14": {
                        "desc": "TX gain table, index 14",
                        "pa_gain": 3,
                        "mix_gain": 12,
                        "rf_power": 26,
                        "dig_gain": 0
                },
                "tx_lut_15": {
                        "desc": "TX gain table, index 15",
                        "pa_gain": 3,
                        "mix_gain": 14,
                        "rf_power": 27,
                        "dig_gain": 0
                }
    },

    "gateway_conf": {
        "gateway_ID": "AA555A0000000000",
        /* change with default server address/ports, or overwrite in local_conf.json */
        "server_address": "192.168.0.17",
        "serv_port_up": 1680,
        "serv_port_down": 1680,
        /* adjust the following parameters for your network */
        "keepalive_interval": 10,
        "stat_interval": 30,
        "push_timeout_ms": 100,
        /* forward only valid packets */
        "forward_crc_valid": true,
        "forward_crc_error": false,
        "forward_crc_disabled": false
    }
}

Basic.ino issue

Hi,

On line 122 of the Basic.ino file the wake() does not seem to exist in the ttn object. Checking TheThinsNetwork.h I indeed could not find it either. Can I remove it and will it wake up at the end of the ttn.sleep(60000)?

Regs,
Jean-Pierre

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.