Skip to content

Commit 8a48cf7

Browse files
author
user2684
committed
Release v1.4
1 parent 8280de9 commit 8a48cf7

File tree

3 files changed

+19
-12
lines changed

3 files changed

+19
-12
lines changed

NodeManager.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#include <Arduino.h>
99

1010
// define NodeManager version
11-
#define VERSION "1.4-dev1"
11+
#define VERSION "1.4"
1212

1313
/***********************************
1414
Constants

README.md

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ Those NodeManager's directives in the `config.h` file control which module/libra
7272
// if enabled, enable debug messages on serial port
7373
#define DEBUG 1
7474

75-
// if enabled, send a SLEEPING and AWAKE service messages just before entering and just after leaving a sleep cycle
75+
// if enabled, send a SLEEPING and AWAKE service messages just before entering and just after leaving a sleep cycle and STARTED when starting/rebooting
7676
#define SERVICE_MESSAGES 1
7777
// if enabled, a battery sensor will be created at BATTERY_CHILD_ID and will report vcc voltage together with the battery level percentage
7878
#define BATTERY_SENSOR 1
@@ -176,7 +176,7 @@ Node Manager comes with a reasonable default configuration. If you want/need to
176176
For example
177177

178178
~~~c
179-
nodeManager.setBatteryMin(1.8);
179+
nodeManager.setBatteryMin(1.8);
180180
~~~
181181

182182
## Register your sensors
@@ -207,11 +207,11 @@ SENSOR_ML8511 | ML8511 sensor, return UV intensity
207207

208208
To register a sensor simply call the NodeManager instance with the sensory type and the pin the sensor is conncted to. For example:
209209
~~~c
210-
nodeManager.registerSensor(SENSOR_THERMISTOR,A2);
211-
nodeManager.registerSensor(SENSOR_DOOR,3);
210+
nodeManager.registerSensor(SENSOR_THERMISTOR,A2);
211+
nodeManager.registerSensor(SENSOR_DOOR,3);
212212
~~~
213213

214-
Once registered, your job is done. NodeManager will assign a child id automatically, present each sensor for you to the controller, query each sensor and report the value back to the gateway/controller at at the end of each sleep cycle . For actuators (e.g. relays) those can be triggered by sending a `REQ` message to their assigned child id.
214+
Once registered, your job is done. NodeManager will assign a child id automatically, present each sensor for you to the controller, query each sensor and report the value back to the gateway/controller at at the end of each sleep cycle. An optional child id can be provided as a third argument if you want to assign it manually. For actuators (e.g. relays) those can be triggered by sending a `REQ` message to their assigned child id.
215215

216216
When called, registerSensor returns the child_id of the sensor so you will be able to retrieve it later if needed. If you want to set a child_id manually, this can be passed as third argument to the function.
217217

@@ -231,7 +231,7 @@ If you want to create a custom sensor and register it with NodeManager so it can
231231
232232
You can then instantiate your newly created class and register with NodeManager:
233233
~~~c
234-
nodeManager.registerSensor(new SensorCustom(child_id, pin));
234+
nodeManager.registerSensor(new SensorCustom(child_id, pin));
235235
~~~
236236

237237
## Configuring the sensors
@@ -240,7 +240,7 @@ Each built-in sensor class comes with reasonable default settings. In case you w
240240
To do so, use `nodeManager.getSensor(child_id)` which will return a pointer to the sensor. Remeber to cast it to the right class before calling their functions. For example:
241241

242242
~~~c
243-
((SensorLatchingRelay*)nodeManager.getSensor(2))->setPulseWidth(50);
243+
((SensorLatchingRelay*)nodeManager.getSensor(2))->setPulseWidth(50);
244244
~~~
245245
246246
@@ -548,7 +548,10 @@ Register a latching relay connecting to pin 6 (set) and pin 7 (unset):
548548

549549
## Analog Light and Temperature Sensor
550550

551-
The following sketch can be used to report the temperature and the light level based on a thermistor and LDR sensors attached to two analog pins of the arduino board (A1 and A2). Both the thermistor and the LDR are connected to ground on one side and to vcc via a resistor on the other so to measure the voltage drop across each of them through the analog pins. The sensor will be put to sleep after startup and will report both the measures every 10 minutes. NodeManager will take care of presenting the sensors, managing the sleep cycle, reporting the battery level every 10 cycles and report the measures in the appropriate format. This sketch requires MODULE_ANALOG_INPUT enabled in the global config.h file.
551+
The following sketch can be used to report the temperature and the light level based on a thermistor and LDR sensors attached to two analog pins of the arduino board (A1 and A2). Both the thermistor and the LDR are connected to ground on one side and to vcc via a resistor on the other so to measure the voltage drop across each of them through the analog pins.
552+
553+
The sensor will be put to sleep after startup and will report both the measures every 10 minutes. NodeManager will take care of presenting the sensors, managing the sleep cycle, reporting the battery level every 10 cycles and report the measures in the appropriate format. This sketch requires MODULE_ANALOG_INPUT enabled in the global config.h file.
554+
552555
Even if the sensor is sleeping most of the time, it can be potentially woke up by sending a V_CUSTOM message with a WAKEUP payload to NodeManager service child id (200 by default) just after having reported its heartbeat. At this point the node will report AWAKE and the user can interact with it by e.g. sending REQ messages to its child IDs, changing the duration of a sleep cycle with a V_CUSTOM message to the NodeManager service child id, etc.
553556

554557
~~~c
@@ -698,7 +701,9 @@ void receive(const MyMessage &message) {
698701
## Boiler Sensor
699702

700703
The following sketch controls a latching relay connected to a boiler. A latching relay (requiring only a pulse to switch) has been chosen to minimize the power consumption required by a traditional relay to stay on. This relay has normally two pins, one for closing and the other for opening the controlled circuit, connected to pin 6 and 7 of the arduino board. This is why we have to register two sensors against NodeManager so to control the two funtions indipendently. Since using a SENSOR_LATCHING_RELAY type of sensor, NodeManager will take care of just sending out a single pulse only when a REQ command of type V_STATUS is sent to one or the other child id.
704+
701705
In this example, the board also runs at 1Mhz so it can go down to 1.8V: by setting setBatteryMin() and setBatteryMax(), the battery percentage will be calculated and reported (by default, automatically every 10 sleeping cycles) based on these custom boundaries.
706+
702707
The board will be put to sleep just after startup and will report back to the controller every 5 minutes. It is the controller's responsability to catch when the board reports its heartbeat (using smart sleep behind the scene) and send a command back if needed. This sketch requires MODULE_DIGITAL_OUTPUT to be enabled in the config.h file.
703708

704709
~~~c
@@ -778,12 +783,14 @@ void receive(const MyMessage &message) {
778783
## Rain and Soil Moisture Sensor
779784
780785
The following sketch can be used to report the rain level and the soil moisture based on two sensors connected to the board's analog pins (A1 and A2). In this case we are customizing the out-of-the-box SENSOR_ANALOG_INPUT sensor type since we just need to measure an analog input but we also want to provide the correct type and presentation for each sensor.
786+
781787
We register the sensors first with registerSensor() which returns the child id assigned to the sensor. We then retrieve the sensor's reference by calling getSensor() so we can invoke the sensor-specific functions, like setPresentation() and setType().
788+
782789
In this example, the two sensors are not directly connected to the battery's ground and vcc but, to save additional power, are powered through two arduino's pins. By using e.g. setPowerPins(4,5,300), NodeManger will assume pin 4 is ground and pin 5 is vcc for that specific sensor so it will turn on the power just before reading the analog input (and waiting 300ms for the sensor to initialize) and back off before going to sleep.
790+
783791
For both the sensors we want a percentage output and with setRangeMin() and setRangeMax() we define the boundaries for calculating the percentage (if we read e.g. 200 when the rain sensor is completely into the water, we know for sure it will not go below this value which will represent the new lower boundary).
784792
Finally, since both the sensors reports low when wet and high when dry but we need the opposite, we set setReverse() so to have 0% reported when there is no rain/moisture, 100% on the opposite situation.
785793
786-
787794
~~~c
788795
/*
789796
NodeManager is intended to take care on your behalf of all those common tasks a MySensors node has to accomplish, speeding up the development cycle of your projects.

config.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@
4343
// if enabled, persist the remote configuration settings on EEPROM
4444
#define PERSIST 0
4545

46-
// if enabled, send a SLEEPING and AWAKE service messages just before entering and just after leaving a sleep cycle
47-
#define SERVICE_MESSAGES 1
46+
// if enabled, send a SLEEPING and AWAKE service messages just before entering and just after leaving a sleep cycle and STARTED when starting/rebooting
47+
#define SERVICE_MESSAGES 0
4848
// if enabled, a battery sensor will be created at BATTERY_CHILD_ID and will report vcc voltage together with the battery level percentage
4949
#define BATTERY_SENSOR 1
5050

0 commit comments

Comments
 (0)