💬 NodeManager
-
@openhardware.io Great idea. Can we expect to see support for Sonoff/ESP8266(without SLEEP) in a near future?
Also, would love to see an example of a custom sensor/HC-SR04 distance sensor, 3-pin implementation.
Keep up the great work. -
@user2684 I have a sonoff and have posted a few examples here https://www.mysensors.org/build/sonoff, nodeManager would maybe save a few lines of code for the end user but you will have quite a lot to code :smile: I guess if you add esp8266 support, the sonoff is just a relay with a LED and a button which nodeManager already supports.
@Efflon said in 💬 NodeManager:
@user2684 I have a sonoff and have posted a few examples here https://www.mysensors.org/build/sonoff,
Cool project, I wonder how I've missed it so far! I understand the idea, basically the sonoff runs as a gateway (otherwise would require a radio attached which is not possible/easy) and has a relay type of sensor attached. I think I can make it easily, I'm ordering a sonoff right now so to test the implementation. I need this https://github.com/mysensors/NodeManager/issues/65 first of all and then I can adapt the SENSOR_RELAY which is already available in NodeManager. I'll keep you posted while I will progress.
Thanks! -
@Straydog just to be sure I'm buying the right sensor, I can only see HC-SR04 with 4 pins on aliexpress I guess this is the right sensor but I will use only three of the four pins, is it the case?
Thanks@user2684 It's the regular HC-SR04, with ECHO & TRIGGER soldered together. I believe you can get them in either 5 or 3.3V
There are only 3 exposed pins on the SonOff SV, I need the other pins for other sensors.
Would like to help you test this project, tried to sign up to GIT yesterday but all Usernames came back as in use, will try again.
Two issues 1) AVR/EEPROM is not found, with PERSIST 0 & board ESP8266. 2) Don't know how to define HC-SR04 as a custom sensor, or can disguise it as another sensor type, with a PulseWidth.Great job
-
@Straydog said in 💬 NodeManager:
Can we expect to see support for Sonoff/ESP8266(without SLEEP) in a near future?
I spend some time in the forum but still I'm struggling a bit to understand the Sonoff use case to then buy the right piece to test. Is it related to what has been discussed in this thread?
https://forum.mysensors.org/topic/5858/sonoff-relay-using-mysensors-esp8266-wifi-or-mqtt-gateway
Thanks! -
@user2684 It's the regular HC-SR04, with ECHO & TRIGGER soldered together. I believe you can get them in either 5 or 3.3V
There are only 3 exposed pins on the SonOff SV, I need the other pins for other sensors.
Would like to help you test this project, tried to sign up to GIT yesterday but all Usernames came back as in use, will try again.
Two issues 1) AVR/EEPROM is not found, with PERSIST 0 & board ESP8266. 2) Don't know how to define HC-SR04 as a custom sensor, or can disguise it as another sensor type, with a PulseWidth.Great job
@Straydog said in 💬 NodeManager:
It's the regular HC-SR04, with ECHO & TRIGGER soldered together.
Great, so if I order the HC-SR04 with 4 pins I should be ready to go. As for the Sonoff, I'm working on it right now, I need to add a few conditions here and there to have NodeManager running as a gateway but it is not that complicated. I'll let you know when I have something ready to test, can be quicker while I'm waiting my sonoff to be delivered.
As for the Sonoff use case it took me a while because it was not clear to me why a gateway and not a node but now I can see it clearly. And btw I needed something similar at home so I'll explore it even more ;-) -
Way too cool solution :dancers:
I decided to give it a go with my Light/Baro/Hum/Temp node.
Installed the dependencies from Adafruit, cleared EEPROM, compiled and flashed - no issues :+1:The node reports the expected sensors to MyController.
The BH1750 light sensor works like a charm, but I'm not getting anything from the BME280 except from a 0.0°C reading on temperature (which, even though spring is pretty lousy so far is a bit on the low side for my office).Output on serial looks like this:
PWR G=6 V=7 REG I=1 P=18 P=16 T=37 REG I=2 P=18 P=6 T=0 REG I=3 P=18 P=7 T=1 REG I=4 P=18 P=8 T=4 NodeManager v1.4 INT1 M=255 INT2 M=255 RADIO OK PRES I=200, T=23 PRES I=201, T=30 BATT V=3.35 P=94 SEND D=0 I=201 C=0 T=38 S= I=0 F=3.35 PRES I=1 T=16 PRES I=2 T=6 PRES I=3 T=7 PRES I=4 T=8 READY MY I=1 M=1 ON P=7 BH1 I=1 L=2500 SEND D=0 I=1 C=0 T=37 S= N=2500 F=0.00 BME I=2 T=0.00 SEND D=0 I=2 C=0 T=0 S= N=0 F=0.00 BME I=3 H=69.25 SEND D=0 I=3 C=0 T=1 S= N=0 F=69.25 BME I=4 P=0.00 SEND D=0 I=4 C=0 T=4 S= N=0 F=0.00 OFF P=7 SLEEP 300s AWAKE ON P=7 BH@PWR G=6 V=7 REG I=1 P=18 P=16 T=37 REG I=2 P=18 P=6 T=0 REG I=3 P=18 P=7 T=1 REG I=4 P=18 P=8 T=4 NodeManager v1.4 INT1 M=255 INT2 M=255 RADIO OK PRES I=200, T=23 PRES I=201, T=30 BATT V=3.35 P=94 SEND D=0 I=201 C=0 T=38 S= I=0 F=3.35 PRES I=1 T=16 PRES I=2 T=6 PRES I=3 T=7 PRES I=4 T=8 READY MY I=1 M=1 ON P=7 BH1 I=1 L=9951 SEND D=0 I=1 C=0 T=37 S= N=9951 F=0.00 BME I=2 T=0.00 SEND D=0 I=2 C=0 T=0 S= N=0 F=0.00 BME I=3 H=69.25 SEND D=0 I=3 C=0 T=1 S= N=0 F=69.25 BME I=4 P=0.00 SEND D=0 I=4 C=0 T=4 S= N=0 F=0.00 OFF P=7 SLEEP 300sThe node was running fine for months using the same BH1750 library, but the BME280 library by Tyler Glenn.
Any ideas?
Should notice that I'm using this kind of BME280 from Ali
-
Way too cool solution :dancers:
I decided to give it a go with my Light/Baro/Hum/Temp node.
Installed the dependencies from Adafruit, cleared EEPROM, compiled and flashed - no issues :+1:The node reports the expected sensors to MyController.
The BH1750 light sensor works like a charm, but I'm not getting anything from the BME280 except from a 0.0°C reading on temperature (which, even though spring is pretty lousy so far is a bit on the low side for my office).Output on serial looks like this:
PWR G=6 V=7 REG I=1 P=18 P=16 T=37 REG I=2 P=18 P=6 T=0 REG I=3 P=18 P=7 T=1 REG I=4 P=18 P=8 T=4 NodeManager v1.4 INT1 M=255 INT2 M=255 RADIO OK PRES I=200, T=23 PRES I=201, T=30 BATT V=3.35 P=94 SEND D=0 I=201 C=0 T=38 S= I=0 F=3.35 PRES I=1 T=16 PRES I=2 T=6 PRES I=3 T=7 PRES I=4 T=8 READY MY I=1 M=1 ON P=7 BH1 I=1 L=2500 SEND D=0 I=1 C=0 T=37 S= N=2500 F=0.00 BME I=2 T=0.00 SEND D=0 I=2 C=0 T=0 S= N=0 F=0.00 BME I=3 H=69.25 SEND D=0 I=3 C=0 T=1 S= N=0 F=69.25 BME I=4 P=0.00 SEND D=0 I=4 C=0 T=4 S= N=0 F=0.00 OFF P=7 SLEEP 300s AWAKE ON P=7 BH@PWR G=6 V=7 REG I=1 P=18 P=16 T=37 REG I=2 P=18 P=6 T=0 REG I=3 P=18 P=7 T=1 REG I=4 P=18 P=8 T=4 NodeManager v1.4 INT1 M=255 INT2 M=255 RADIO OK PRES I=200, T=23 PRES I=201, T=30 BATT V=3.35 P=94 SEND D=0 I=201 C=0 T=38 S= I=0 F=3.35 PRES I=1 T=16 PRES I=2 T=6 PRES I=3 T=7 PRES I=4 T=8 READY MY I=1 M=1 ON P=7 BH1 I=1 L=9951 SEND D=0 I=1 C=0 T=37 S= N=9951 F=0.00 BME I=2 T=0.00 SEND D=0 I=2 C=0 T=0 S= N=0 F=0.00 BME I=3 H=69.25 SEND D=0 I=3 C=0 T=1 S= N=0 F=69.25 BME I=4 P=0.00 SEND D=0 I=4 C=0 T=4 S= N=0 F=0.00 OFF P=7 SLEEP 300sThe node was running fine for months using the same BH1750 library, but the BME280 library by Tyler Glenn.
Any ideas?
Should notice that I'm using this kind of BME280 from Ali
@ksga I can see from the logs the light sensor correctly returning something but the BME280 apparently only able to get the humidity. I also see the node rebooting itself at a certain point. Was it you resetting it? Because if it was not you, it may be due to the memory almost full and when this happens, the behaviors I've seen are really unpredictable including weird numbers reported. To start with, I'd recommend to disable NodeManager's debug which will save some memory and see on the controller if the data returned is correct. If it is still not correct, do you set any specific i2c channel in the other sketch where both the sensors are working fine? I wonder if there is any difference between the two sketches.
Also, are the sensors powered by pin 6 and 7? If so I'd power them directly just to take away this variable at least for now.
Thanks! -
@ksga I can see from the logs the light sensor correctly returning something but the BME280 apparently only able to get the humidity. I also see the node rebooting itself at a certain point. Was it you resetting it? Because if it was not you, it may be due to the memory almost full and when this happens, the behaviors I've seen are really unpredictable including weird numbers reported. To start with, I'd recommend to disable NodeManager's debug which will save some memory and see on the controller if the data returned is correct. If it is still not correct, do you set any specific i2c channel in the other sketch where both the sensors are working fine? I wonder if there is any difference between the two sketches.
Also, are the sensors powered by pin 6 and 7? If so I'd power them directly just to take away this variable at least for now.
Thanks!@user2684 Yeah.. missed that it rebooted... Thanks.
I cleared EEPROM again, recompiled with and without debug (no usable result without, so decided to add eyes again :) )
void before() part of the sketch looks like this:
// before void before() { // setup the serial port baud rate Serial.begin(MY_BAUD_RATE); /* * Register below your sensors */ nodeManager.setSleep(SLEEP,1,MINUTES); nodeManager.registerSensor(SENSOR_BH1750); nodeManager.registerSensor(SENSOR_BME280); /* * Register above your sensors */ nodeManager.before(); }and config.h:
/*********************************** * NodeManager configuration */ // if enabled, enable debug messages on serial port #define DEBUG 1 //#define DEBUG 0 // if enabled, will load the sleep manager library. Sleep mode and sleep interval have to be configured to make the board sleeping/waiting #define SLEEP_MANAGER 1 // if enabled, enable the capability to power on sensors with the arduino's pins to save battery while sleeping #define POWER_MANAGER 0 // if enabled, will load the battery manager library to allow the battery level to be reported automatically or on demand #define BATTERY_MANAGER 0 // if enabled, allow modifying the configuration remotely by interacting with the configuration child id #define REMOTE_CONFIGURATION 1 // if enabled, persist the remote configuration settings on EEPROM #define PERSIST 0 // if enabled, send a SLEEPING and AWAKE service messages just before entering and just after leaving a sleep cycle and STARTED when starting/rebooting #define SERVICE_MESSAGES 0 // if enabled, a battery sensor will be created at BATTERY_CHILD_ID and will report vcc voltage together with the battery level percentage #define BATTERY_SENSOR 0 // Enable this module to use one of the following sensors: SENSOR_ANALOG_INPUT, SENSOR_LDR, SENSOR_THERMISTOR, SENSOR_MQ, SENSOR_ML8511 #define MODULE_ANALOG_INPUT 1 // Enable this module to use one of the following sensors: SENSOR_DIGITAL_INPUT #define MODULE_DIGITAL_INPUT 1 // Enable this module to use one of the following sensors: SENSOR_DIGITAL_OUTPUT, SENSOR_RELAY, SENSOR_LATCHING_RELAY #define MODULE_DIGITAL_OUTPUT 1 // Enable this module to use one of the following sensors: SENSOR_DHT11, SENSOR_DHT22 #define MODULE_DHT 0 // Enable this module to use one of the following sensors: SENSOR_SHT21 #define MODULE_SHT21 0 // Enable this module to use one of the following sensors: SENSOR_SWITCH, SENSOR_DOOR, SENSOR_MOTION #define MODULE_SWITCH 0 // Enable this module to use one of the following sensors: SENSOR_DS18B20 #define MODULE_DS18B20 0 // Enable this module to use one of the following sensors: SENSOR_BH1750 #define MODULE_BH1750 1 // Enable this module to use one of the following sensors: SENSOR_MLX90614 #define MODULE_MLX90614 0 // Enable this module to use one of the following sensors: SENSOR_BME280 #define MODULE_BME280 1 #endifThe serial output seems to show no reboot this time ;):
REG I=1 P=18 P=16 T=37 REG I=2 P=18 P=6 T=0 REG I=3 P=18 P=7 T=1 REG I=4 P=18 P=8 T=4 NodeManager v1.4 INT1 M=255 INT2 M=255 RADIO OK PRES I=200, T=23 PRES I=1 T=16 PRES I=2 T=6 PRES I=3 T=7 PRES I=4 T=8 READY MY I=3 M=1 BH1 I=1 L=-10924 BME I=2 T=0.00 SEND D=0 I=2 C=0 T=0 S= N=0 F=0.00 BME I=3 H=0.00 SEND D=0 I=3 C=0 T=1 S= N=0 F=0.00 BME I=4 P=-793.67 SLEEP 60s AWAKE BH1 I=1 L=-10924 BME I=2 T=0.00 SEND D=0 I=2 C=1 T=0 S= N=0 F=0.00 BME I=3 H=0.00 SEND D=0 I=3 C=1 T=1 S= N=0 F=0.00 BME I=4 P=-793.67 SLEEP 60sI would guess there should be enough memory on the arduino:
Sketch uses 26.024 bytes (80%) of program storage space. Maximum is 32.256 bytes. Global variables use 1.262 bytes (61%) of dynamic memory, leaving 786 bytes for local variables. Maximum is 2.048 bytes.Definately not fixed :(
Maybe I could try adding support for the alternative BME library to NodeManager... -
@user2684 Yeah.. missed that it rebooted... Thanks.
I cleared EEPROM again, recompiled with and without debug (no usable result without, so decided to add eyes again :) )
void before() part of the sketch looks like this:
// before void before() { // setup the serial port baud rate Serial.begin(MY_BAUD_RATE); /* * Register below your sensors */ nodeManager.setSleep(SLEEP,1,MINUTES); nodeManager.registerSensor(SENSOR_BH1750); nodeManager.registerSensor(SENSOR_BME280); /* * Register above your sensors */ nodeManager.before(); }and config.h:
/*********************************** * NodeManager configuration */ // if enabled, enable debug messages on serial port #define DEBUG 1 //#define DEBUG 0 // if enabled, will load the sleep manager library. Sleep mode and sleep interval have to be configured to make the board sleeping/waiting #define SLEEP_MANAGER 1 // if enabled, enable the capability to power on sensors with the arduino's pins to save battery while sleeping #define POWER_MANAGER 0 // if enabled, will load the battery manager library to allow the battery level to be reported automatically or on demand #define BATTERY_MANAGER 0 // if enabled, allow modifying the configuration remotely by interacting with the configuration child id #define REMOTE_CONFIGURATION 1 // if enabled, persist the remote configuration settings on EEPROM #define PERSIST 0 // if enabled, send a SLEEPING and AWAKE service messages just before entering and just after leaving a sleep cycle and STARTED when starting/rebooting #define SERVICE_MESSAGES 0 // if enabled, a battery sensor will be created at BATTERY_CHILD_ID and will report vcc voltage together with the battery level percentage #define BATTERY_SENSOR 0 // Enable this module to use one of the following sensors: SENSOR_ANALOG_INPUT, SENSOR_LDR, SENSOR_THERMISTOR, SENSOR_MQ, SENSOR_ML8511 #define MODULE_ANALOG_INPUT 1 // Enable this module to use one of the following sensors: SENSOR_DIGITAL_INPUT #define MODULE_DIGITAL_INPUT 1 // Enable this module to use one of the following sensors: SENSOR_DIGITAL_OUTPUT, SENSOR_RELAY, SENSOR_LATCHING_RELAY #define MODULE_DIGITAL_OUTPUT 1 // Enable this module to use one of the following sensors: SENSOR_DHT11, SENSOR_DHT22 #define MODULE_DHT 0 // Enable this module to use one of the following sensors: SENSOR_SHT21 #define MODULE_SHT21 0 // Enable this module to use one of the following sensors: SENSOR_SWITCH, SENSOR_DOOR, SENSOR_MOTION #define MODULE_SWITCH 0 // Enable this module to use one of the following sensors: SENSOR_DS18B20 #define MODULE_DS18B20 0 // Enable this module to use one of the following sensors: SENSOR_BH1750 #define MODULE_BH1750 1 // Enable this module to use one of the following sensors: SENSOR_MLX90614 #define MODULE_MLX90614 0 // Enable this module to use one of the following sensors: SENSOR_BME280 #define MODULE_BME280 1 #endifThe serial output seems to show no reboot this time ;):
REG I=1 P=18 P=16 T=37 REG I=2 P=18 P=6 T=0 REG I=3 P=18 P=7 T=1 REG I=4 P=18 P=8 T=4 NodeManager v1.4 INT1 M=255 INT2 M=255 RADIO OK PRES I=200, T=23 PRES I=1 T=16 PRES I=2 T=6 PRES I=3 T=7 PRES I=4 T=8 READY MY I=3 M=1 BH1 I=1 L=-10924 BME I=2 T=0.00 SEND D=0 I=2 C=0 T=0 S= N=0 F=0.00 BME I=3 H=0.00 SEND D=0 I=3 C=0 T=1 S= N=0 F=0.00 BME I=4 P=-793.67 SLEEP 60s AWAKE BH1 I=1 L=-10924 BME I=2 T=0.00 SEND D=0 I=2 C=1 T=0 S= N=0 F=0.00 BME I=3 H=0.00 SEND D=0 I=3 C=1 T=1 S= N=0 F=0.00 BME I=4 P=-793.67 SLEEP 60sI would guess there should be enough memory on the arduino:
Sketch uses 26.024 bytes (80%) of program storage space. Maximum is 32.256 bytes. Global variables use 1.262 bytes (61%) of dynamic memory, leaving 786 bytes for local variables. Maximum is 2.048 bytes.Definately not fixed :(
Maybe I could try adding support for the alternative BME library to NodeManager...@ksga thanks for running this additional test! I don't like that -10924 for the BH1750 which looks to me like a random value and not impacted by the BME280 library you are using if I've understood correctly. This makes me still think of a memory issue: despite the sketch is not consuming all the memory, both the BME280 and BH1750 objects are allocated dynamically in the code so would not count against that percentage I'm afraid.
Let's start by disabling MODULE_ANALOG_INPUT, MODULE_DIGITAL_INPUT and MODULE_DIGITAL_OUTPUT to save some more memory. Then I'd still try disabling NodeManager's debug: the serial output would be blank of course but on the controller you should see if the the measures reported will look better. I just want to be sure it is not a memory issue (which typically shows up as random reboots and random values) before moving ahead and troubleshoot the library you are using.
Thanks! -
@ksga thanks for running this additional test! I don't like that -10924 for the BH1750 which looks to me like a random value and not impacted by the BME280 library you are using if I've understood correctly. This makes me still think of a memory issue: despite the sketch is not consuming all the memory, both the BME280 and BH1750 objects are allocated dynamically in the code so would not count against that percentage I'm afraid.
Let's start by disabling MODULE_ANALOG_INPUT, MODULE_DIGITAL_INPUT and MODULE_DIGITAL_OUTPUT to save some more memory. Then I'd still try disabling NodeManager's debug: the serial output would be blank of course but on the controller you should see if the the measures reported will look better. I just want to be sure it is not a memory issue (which typically shows up as random reboots and random values) before moving ahead and troubleshoot the library you are using.
Thanks!@user2684 Sorry about the delay - but life claimed some time (stupid life claiming time I want to use for stuff :-| )
Disabled MODULE_ANALOG_INPUT, MODULE_DIGITAL_INPUT and MODULE_DIGITAL_OUTPUT, and even tried without BH1750 - but still no luck.
Node registers correctly and fires bogus data on one or two sensors...Pretty sure I have to use the other library - tried using Adafruit's examples, and it claims no BME is attached...
I can make all the logic changes to NodeManager, but have not been able to initialize the sensor - maybe I could upload my edits to Git and someone could help me get the last bits together ???
Made the changes here.
-
Double comment in NodeMamaged.h - setBatteryInternalVcc
-
Please use IFDEF for "Battery procetage"
I calculate this in the controller (Save battery) -
@user2684 Sorry about the delay - but life claimed some time (stupid life claiming time I want to use for stuff :-| )
Disabled MODULE_ANALOG_INPUT, MODULE_DIGITAL_INPUT and MODULE_DIGITAL_OUTPUT, and even tried without BH1750 - but still no luck.
Node registers correctly and fires bogus data on one or two sensors...Pretty sure I have to use the other library - tried using Adafruit's examples, and it claims no BME is attached...
I can make all the logic changes to NodeManager, but have not been able to initialize the sensor - maybe I could upload my edits to Git and someone could help me get the last bits together ???
Made the changes here.
@ksga said in 💬 NodeManager:
Pretty sure I have to use the other library - tried using Adafruit's examples, and it claims no BME is attached...
Thanks for digging into it! I just want to be sure with the Adafruit library I'm using you can get the sensor working before evaluating and integrating the other library. As far as I remember during my tests I got a similar issue and if I'm not wrong this is because the chinese version of the BME sensor is on the 0x76 address instead of the 0x77 Adafruit's. Try if you don't mind with the plain Adafruit example and passing the address to begin() to see if you get better results. Thanks!
-
@Ivan-Z said in 💬 NodeManager:
Please use IFDEF for "Battery procetage"
Do you mean the formula to calculate the percentage? If so, the issue is that the min and max can be defined in the code by the user so I cannot use the preprocessor to do the job. Am I wrong? Regarding the double comment of setBatteryInternalVcc(), I cannot find it, may you please point me out to the affected line numbers? Thanks!
-
@Ivan-Z said in 💬 NodeManager:
Please use IFDEF for "Battery procetage"
Do you mean the formula to calculate the percentage? If so, the issue is that the min and max can be defined in the code by the user so I cannot use the preprocessor to do the job. Am I wrong? Regarding the double comment of setBatteryInternalVcc(), I cannot find it, may you please point me out to the affected line numbers? Thanks!
-
Sorry, not fully read text
-
What about BMP085 ??
-
@user2684
Function name
Do you mean the formula to calculate the percentage?
Append flag IFDEF for not send this information (Only voltage)@Ivan-Z oh I see about the comment but they are correct because both setBatteryPin() and setBatteryVoltsPerBit() applies only if setBatteryInternalVcc() is set to false.
Regarding the ifdef thing, the behavior right now is to send percentage by default with sendBatteryLevel() and optionally the battery voltage through the custom service. I'd prefer to keep it in this way since sendBatteryLevel() is the part of the core MySensors api, I'd rather make it mandatory. Thanks! -
@Ivan-Z said in 💬 NodeManager:
What about BMP085 ??
I've ordered one and waiting for its delivery :-)
-
Why did you use the REQ type for the relay?
Please add support for SET tooREQ - nide to read Relay status