Navigation

    • Register
    • Login
    • Search
    • OpenHardware.io
    • Categories
    • Recent
    • Tags
    • Popular
    1. Home
    2. user2684
    3. Best
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

    Best posts made by user2684

    • NodeManager: plugin for a rapid development of battery-powered sensors

      Hi, being a newbie in this wonderful MySensors world, I found myself excited about the flexibility of the overall platform but also somehow implementing the same common functionalities across my sensors over and over again. I decided then to spend some reasonable amount of time to expand the idea behind MyExtention (https://forum.mysensors.org/topic/6062/myextension) into something I have called NodeManager (I know, I'm bad with names!).

      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. It should help who is new to MySensors to get up to speed quicker and for those already into the matter to delegate to NodeManager common and boring tasks so to focus on more interesting scenarios.

      NodeManager main features are:

      • Manage all the aspects of a sleeping cycle by leveraging smart sleep
      • Allow configuring the sleep mode and the sleep duration remotely
      • Allow waking up a sleeping node remotely at the end of a sleeping cycle
      • Allow powering on each connected sensor only while the node is awake to save battery
      • Report battery level periodically and automatically
      • Calculate battery level without requiring an additional pin and the resistors
      • Report battery voltage through a built-in sensor
      • Can report battery level on demand
      • Allow rebooting the board remotely
      • Provide out-of-the-box sensors personalities and automatically execute their main task at each cycle

      Specifically on this last point, the idea behind providing built-in the functionalities of most common sensors is to simplify the development especially for somebody new to it.
      E.g. if I connect a thermistor to one of the pin, I just need a single line to have it working, as it was leveraging some sort of embedded firmware:

      nodeManager.registerSensor(SENSOR_THERMISTOR,A2);
      

      The following built-in sensors are available:

      • SENSOR_ANALOG_INPUT Generic analog sensor, return a pin's analog value or its percentage
      • SENSOR_LDR LDR sensor, return the light level of an attached light resistor in percentage
      • SENSOR_THERMISTOR Thermistor sensor, return the temperature based on the attached thermistor
      • SENSOR_DIGITAL_INPUT Generic digital sensor, return a pin's digital value
      • SENSOR_DIGITAL_OUTPUT Generic digital output sensor, allows setting the digital output of a pin to the requested value
      • SENSOR_RELAY Relay sensor, allows activating the relay
      • SENSOR_LATCHING_RELAY Latching Relay sensor, allows activating the relay with a pulse
      • SENSOR_DHT11 DHT11 sensor, return temperature/humidity based on the attached DHT sensor
      • SENSOR_DHT22 DHT22 sensor, return temperature/humidity based on the attached DHT sensor
      • SENSOR_SHT21 SHT21 sensor, return temperature/humidity based on the attached SHT21 sensor
      • SENSOR_SWITCH Generic switch, wake up the board when a pin changes status
      • SENSOR_DOOR Door sensor, wake up the board and report when an attached magnetic sensor has been opened/closed
      • SENSOR_MOTION Motion sensor, wake up the board and report when an attached PIR has triggered
      • SENSOR_DS18B20 DS18B20 sensor, return the temperature based on the attached sensor

      I put the package on Sourceforce so to avoid leaving here piece of code which may become obsolete in a short time.

      The project is here: https://sourceforge.net/projects/mynodemanager
      I've also tried to document everything the best as I could on https://sourceforge.net/p/mynodemanager/wiki

      Thanks

      posted in NodeManager
      user2684
      user2684
    • NodeManager v1.8 now available!

      NodeManager v1.8 is finally here!

      With 8 months of development from 12 different contributors, the new NodeManager v1.8 ships now as an Arduino library to allow an easier integration, a more consistent upgrade process across the versions and a simpler way of using it.

      This version includes also a number of enhancements and bug fixes, a better integration with the MySensors library (including the capability to use the web-based Log Parser) and support for an additional 11 new sensors, with a grand total of 62 built-in sensors that can be added to your project by just a single line of code.

      NodeManager v1.8 can be downloaded directly from Github https://github.com/mysensors/NodeManager where detailed installation instructions are also provided.
      Please read the README file carefully before starting so to get a sense on how to use it or what has changed from the previous releases.

      The full release notes for this version are listed below:

      • Split NodeManager's core classes in individual files and each sensor code in its own dedicated header file
      • New Arduino-compatible library structure to allow easier integration and more consistent updates across version
      • Included a complete set of examples which can be loaded directly from the Arduino IDE
      • Simplified the template sketch with a global nodeManager object and sensors that can be imported directly from there
      • Debug output is now fully compatible with the one used by the MySensors library and integrated into MySensors LogParser
      • Better control on how often, if and when to sync the time with the controller for time-aware nodes
      • Added a Measure Timer so to allow splitting between taking measures and reporting
      • Added support for every sensor to keep track of the last value assigned to a child in EEPROM and restoring it upon a reboot
      • Introduced new capabilities for reporting every minute/hour/day or only at a given minute/hour/day
      • Added ability to read from the serial port at the end of each loop cycle, useful for debugging interactive sensors
      • Added support for pH sensor
      • Added support for PCA9685 as RGB/RGBW/W dimmer
      • Added support for DSM501A dust sensor
      • Added support for PN532 NFC RFID module
      • Added support for CCS811 CO2/VOC sensor
      • Added support for MPR121 Capacitive Touch Sensor
      • Added support for serial GSM/SMS device
      • Added support for FPM10A fingerprint sensor
      • Added support for SDS011 Air quality sensor
      • Added support for ESP32 devices
      • Added support for nRF52 radio
      • Improved SensorDigitalInput and NeoPixelSensor
      • Si7021 sensor is now using the library from the MySensors example
      • Reviewed the MQ Sensor implementation
      • Optimized memory utilization
      • Added Travis Continuous Integration tests
      • Fixed wrong battery report when using battery pin and SensorRain/SensorSoilMoisture
      • Fixed DigitalOutput safeguard not working as expected
      • Fixed radio signal level reporting wrong values
      • Fixed SensorLatchingRelay2Pins wrong pin selection
      • Other minor bug fixes
      posted in NodeManager
      user2684
      user2684
    • Clock with temperature, humidity and CO2 level sensors

      My bedside alarm clock recently got broken so I decided to build up one by myself.
      The prototype looks like that:
      0_1529326386412_1.png

      • 1: arduino pro mini 3.3v
      • 2: RFM69 radio
      • 3: MQ135 sensor to measure CO2 level
      • 4: 20k/10k voltage divider to connect the MQ AO pin to an analog pin of the arduino (the MQ sensor runs at 5v, the arduino at 3.3v so we need to "scale" the output)
      • 5: DS3231 RTC so when the power goes down the node will be able to restore its clock even without requesting time to the controller
      • 6: SHT21 sensor for temperature and humidity
      • 7: SSD1306 OLED display 128x64

      The "production" version looks like this:
      0_1529326672488_2.png
      I'm again using the versatile EasyPCB from @sundberg84, here in the middle. The voltage divider has been soldered on the board, where battery measurement level is used to be placed. Of course Vin is not connected but instead it is used for MQ's AO pin connection.
      The SH21 and MQ sensors are just outside the box so to have accurate readings. The project is powered by 0.5€ USB ttl Chinese key which allows to power both the board (3.3v) and the MQ sensor (5v).
      I've also added a push button, hidden within the case which will request the time to the controller for the first initialization of the RTC.

      As for the code this is what I'm using based on NodeManager (with the latest SensorMQ code change not yet merged into the development branch):

      /**********************************
       * MySensors node configuration
       */
      
      // General settings
      #define SKETCH_NAME "Clock"
      #define SKETCH_VERSION "1.0"
      //#define MY_DEBUG
      #define MY_NODE_ID 1
      
      // RFM69 radio settings
      #define MY_RADIO_RFM69
      //#define MY_RFM69_FREQUENCY RFM69_433MHZ
      #define MY_IS_RFM69HW
      #define MY_RFM69_NEW_DRIVER
      
      /***********************************
       * NodeManager modules for supported sensors
       */
      
      #define USE_SIGNAL
      #define USE_SHT21
      #define USE_INTERRUPT
      #define USE_MQ
      #define USE_SSD1306
      
      /***********************************
       * NodeManager built-in features
       */
      
      // Enable/disable NodeManager's features
      #define FEATURE_DEBUG OFF
      #define FEATURE_POWER_MANAGER OFF
      #define FEATURE_INTERRUPTS ON
      #define FEATURE_CONDITIONAL_REPORT OFF
      #define FEATURE_EEPROM OFF
      #define FEATURE_SLEEP OFF
      #define FEATURE_RECEIVE ON
      #define FEATURE_TIME ON
      #define FEATURE_RTC ON
      #define FEATURE_SD OFF
      #define FEATURE_HOOKING ON
      
      /***********************************
       * Load NodeManager Library
       */
      
      #include "NodeManagerLibrary.h"
      NodeManager node;
      
      /***********************************
       * Add your sensors below
       */
      
      // built-in sensors
      SensorSignal signal(node);
      
      // Attached sensors
      SensorSHT21 sht21(node);
      SensorMQ mq(node,A0);
      DisplaySSD1306 ssd1306(node);
      SensorInterrupt button(node,3);
      
      /***********************************
       * Main Sketch
       */
      
      void syncTime(Sensor* sensor) {
        // update the time with the controller
        node.syncTime();
        // update the display
        ssd1306.onLoop(ssd1306.children.get(1));
      }
      
      // before
      void before() {
        // setup the serial port baud rate
        Serial.begin(MY_BAUD_RATE);
        /*
        * Configure your sensors below
        */
      
        // temperature/humidity sensor
        sht21.setReportIntervalMinutes(5);
      
        // gas sensor
        mq.setReportIntervalMinutes(5);
        mq.setRoValue(56842);
        mq.setCurveScalingFactor(38.35);
        mq.setCurveExponent(-2.74);
        
        // display
        ssd1306.setReportIntervalSeconds(30);
      
        // button
        button.setInitialValue(HIGH);
        button.setInterruptMode(FALLING);
        button.setInterruptHook(&syncTime);
        
        /*
        * Configure your sensors above
        */
        node.before();
      }
      
      // presentation
      void presentation() {
        // call NodeManager presentation routine
        node.presentation();
      }
      
      // setup
      void setup() {
        // call NodeManager setup routine
        node.setup();
      }
      
      // loop
      void loop() {
        // call NodeManager loop routine
        node.loop();
      }
      
      #if FEATURE_RECEIVE == ON
      // receive
      void receive(const MyMessage &message) {
        // call NodeManager receive routine
        node.receive(message);
      }
      #endif
      
      #if FEATURE_TIME == ON
      // receiveTime
      void receiveTime(unsigned long ts) {
        // call NodeManager receiveTime routine
        node.receiveTime(ts);
      }
      #endif
      

      To show on the display only the information relevant for this project, I had to override DisplaySSD1306 onLoop() function in this way:

      void DisplaySSD1306::onLoop(Child* child) {
        long timestamp = now()+60*60*2;
        _oled->setCursor(0,0);
        // print the current date
        _oled->setFont(X11fixed7x14);
        _oled->print(F("    "));
        if (day(timestamp) < 10) _oled->print(F("0"));
        _oled->print(day(timestamp));
        _oled->print(F("-"));
        if (month(timestamp) < 10) _oled->print(F("0"));
        _oled->print(month(timestamp));
        _oled->print(F("-"));
        _oled->println(year(timestamp));
        // print the current time
        _oled->setFont(lcdnums12x16);
        _oled->set2X();
        if (hour(timestamp) < 10) _oled->print(F("0"));
        _oled->print(hour(timestamp));
        _oled->print(F(":"));
        if (minute(timestamp) < 10) _oled->print(F("0"));
        _oled->println(minute(timestamp));
        // print the sensors' data
        _oled->setFont(Adafruit5x7);
        _oled->set1X();
        _oled->println("");
        _oled->print(((ChildFloat*)_node->getChild(1))->getValueFloat());
        _oled->print(F("C "));
        _oled->print((int)((ChildFloat*)_node->getChild(2))->getValueFloat());
        _oled->print(F("% "));
        _oled->print(((ChildInt*)_node->getChild(3))->getValueInt());
        _oled->print(F("ppm"));
        _oled->clearToEOL();
      }
      

      Finally some pictures of the project once finalized:
      0_1529327416355_3.png

      0_1529327427911_4.png

      posted in My Project
      user2684
      user2684
    • RE: 💬 NodeManager

      Done! I've updated the documentation with four comprehensive examples including the full sketches

      posted in OpenHardware.io
      user2684
      user2684
    • RE: NodeManager: plugin for a rapid development of battery-powered sensors

      Hi, I've made an update of NodeManager in case can be of interest. Latest version v1.2 is available on https://sourceforge.net/projects/mynodemanager/.
      Short changelog:

      • Added out-of-the-box support for BH1750 light sensor
      • Added out-of-the-box support for HTU21D temperature and humidity sensor
      • Added out-of-the-box support for MLX90614 contactless temperature sensor
      • Added a few examples to the documentation (https://sourceforge.net/p/mynodemanager/wiki/NodeManager/#examples)
      • Fixed a few bugs
      posted in NodeManager
      user2684
      user2684
    • Inexpensive, analog, temperature and light sensor

      Hi,

      I couldn't find a similar project already posted here so in case somebody is interested in a very inexpensive temperature and light sensor, this can be easily implemented with a thermistor and a LDR (light dependent resistor). Probably the measurement is not as accurate as with other more complex sensors but in all my tests I've never had significant bias.

      The BOM is really cheap since a Thermistor can cost around 0.08$ (https://www.aliexpress.com/store/product/10pcs-Free-Shipping-10k-OHM-NTC-Thermistor-Resistor-NTC-MF52AT-10K-1-3950/110055_32412200713.html?spm=2114.12010615.0.0.iB5eTq) and a LDR around 0.04$ (https://www.aliexpress.com/store/product/Free-shiping-1000pcs-x-5528-Light-Dependent-Resistor-LDR-5MM-Photoresistor-wholesale-and-retail-Photoconductive-resistance/110055_2041703245.html?spm=2114.12010615.0.0.I9uWY1) so a pro mini + RF24 + the two sensors can be all even below the 3$.

      Wiring is simple as well, both the thermistor and the LDR have a pin connected to ground and the other connected to a (different) 10k resistor and an analog input. The resistors' other pin goes to vcc. In the (bad) picture below, the black connector goes to GND, the orange to VCC, the white to A1, the green to A2.

      0_1487525894727_IMG_2879.JPG

      Code is pretty simple as well. You basically need to read the analog input and in case of the thermistor apply its formula (https://en.wikipedia.org/wiki/Thermistor) while for the LDR if you like normalize the value to a percentage and invert it (when dark the analog read would be 1024 so I prefer having 0% in this case).

      I'm using my NodeManager (https://sourceforge.net/projects/mynodemanager/) to make things simple, having the node sleeping and reporting both the measures every 10 minutes and power on the sensors with two arduino pins just before reading the measures (otherwise even if sleeping, there will be some current going from VCC to GND):

      // load user settings
      #include "config.h"
      // load MySensors library
      #include <MySensors.h>
      // load NodeManager library
      #include "NodeManager.h"
      
      // create a NodeManager instance
      NodeManager nodeManager;
      
      // before
      void before() {
        // setup the serial port baud rate
        Serial.begin(9600);  
        // instruct the board to sleep for 10 minutes for each cycle
        nodeManager.setSleep(SLEEP,10,MINUTES);
        // all the sensors' vcc and ground are connected to pin 6 (ground) and 7 (vcc. NodeManager will enable the vcc pin every time just before loop() and wait for 100ms for the sensors to settle
        nodeManager.setPowerPins(6,7,100);
        // register the sensors
        nodeManager.registerSensor(SENSOR_THERMISTOR,A1);
        nodeManager.registerSensor(SENSOR_LDR,A2);
        
        nodeManager.before();
      }
      
      // presentation
      void presentation() {
        // Send the sketch version information to the gateway and Controller
      	sendSketchInfo("AnalogTemperatureLight", "1.0");
        // call NodeManager presentation routine
        nodeManager.presentation();
      
      }
      
      // setup
      void setup() {
      }
      
      // loop
      void loop() {
        // call NodeManager loop routine
        nodeManager.loop();
      
      }
      
      // receive
      void receive(const MyMessage &message) {
        // call NodeManager receive routine
        nodeManager.receive(message);
      }
      
      
      

      If you want to read the values in the traditional way, the code would look like the following for the thermistor:

          int _nominal_resistor = 10000;
          int _nominal_temperature = 25;
          int _b_coefficient = 3950;
          int _series_resistor = 10000;
        // read the voltage across the thermistor
        float adc = analogRead(_pin);
        // calculate the temperature
        float reading = (1023 / adc)  - 1;
        reading = _series_resistor / reading;
        float temperature;
        temperature = reading / _nominal_resistor;     // (R/Ro)
        temperature = log(temperature);                  // ln(R/Ro)
        temperature /= _b_coefficient;                   // 1/B * ln(R/Ro)
        temperature += 1.0 / (_nominal_temperature + 273.15); // + (1/To)
        temperature = 1.0 / temperature;                 // Invert
        temperature -= 273.15;                         // convert to C
        if (! getControllerConfig().isMetric) temperature = temperature * 1.8 + 32;
      

      And this for the LDR:

        // read the value
        int adc= analogRead(_pin);
        value = 1024 - adc;
        // calculate the percentage
        int percentage = 0;
        float value = (float)adc;
        // scale the percentage based on the range provided
        float percentage = ((value - 0) / (1024 - 0)) * 100;
        if (percentage > 100) percentage = 100;
        if (percentage < 0) percentage = 0;
        
      

      Thanks

      posted in My Project
      user2684
      user2684
    • RE: 💬 NodeManager

      Every new version of NodeManager, I try to review and hopefully improve its architecture. This time looked like a simple and quick task but eventually ended up in a complete and deep review of the code. Many many many things have changed with the main objective to better integrate with the MySensors library and simplify the life of users willing to contribute or to add support for new sensors.

      The new file structure (with a dedicated file for each supported sensor) and the way the package is delivered (as an arduino library now) go into this direction. There are also included a good amount of new features but still in most of the cases, resulting a smaller code.

      All the details are available at https://github.com/mysensors/NodeManager/pull/391 which will be merged into the development branch shortly.

      Due to the many changes, if anybody would be willing to give it a try and report any bug, would be really great. Thanks!

      user2684 created this issue in mysensors/NodeManager

      closed Architecture Review #391

      posted in OpenHardware.io
      user2684
      user2684
    • RE: NodeManager: plugin for a rapid development of battery-powered sensors

      Hello All,

      NodeManager v1.6 is finally available! Download and upgrade instructions can be found as always on https://github.com/mysensors/NodeManager

      First of all I want to thank everybody contributing to the project, especially those who have submitted pull requests to the repository.

      In v1.6 we have 36 out-of-the-box sensors as well as a good number fixes and enhancements. The most notable are for sure the capability to customize any sensor remotely through a brand new remote API and a more flexible and effective way to configure reporting intervals and sleep cycles:

      • Introduced new remote API to allow calling almost ALL NodeManager's and its sensors' functions remotely
      • Reporting interval configuration is now indipendent from the sleep cycle
      • Reporting interval can be customized per-sensor
      • All intervals (measure/battery reports) are now time-based
      • Added support for BMP280 temperature and pressure sensor
      • Added support for RS485 serial transport
      • Added support for TSL2561 light sensor
      • Added support for DHT21 temperature/humidity sensor
      • Added support for AM2320 temperature/humidity sensor
      • Added support for PT100 high temperature sensor
      • Added support for MH-Z19 CO2 sensor
      • Added support for analog rain and soil moisture sensors
      • Added support for generic dimmer sensor (PWM output)
      • Added support for power and water meter pulse sensors
      • Radio signal level (RSSI) is now reported automatically like the battery level
      • SensorRainGauge now supports sleep mode
      • SensorSwitch now supports awake mode
      • SensorLatchingRealy now handles automatically both on and off commands
      • SensorMQ now depends on its own module
      • Added safeguard (automatic off) to SensorDigitalOutput
      • Any sensor can now access all NodeManager's functions
      • DHT sensor now using MySensors' DHT library

      For those who have previously forked the repository, please ensure to merge the updated development branch first before submitting any new PR.

      Thanks!

      posted in NodeManager
      user2684
      user2684
    • Battery powered fingerprint reader

      This project is about a battery powered fingerprint sensor I placed just outside the door of my house. The last person leaving the house or the first entering it would use the sensor so the controller could arm/disarm the alarm but of course can be used to control anything (e.g. opening the door). Since the controller gets the id of the fingerprint when there is a match, would also know who is entering the house so greeting the person by name out loud (kind of funny :P).

      The fingerprint sensor I'm using is a FPM10A that can be found on Aliexpress for 5$ (https://www.aliexpress.com/item/Fingerprint-Reader-Sensor-Module-FPM10A-Optical-Fingerprint-Fingerprint-Module-Locks-Serial-Communication-Interface-For-Arduino/32835820214.html).
      Wiring is pretty simple (http://www.duino.lk/image/cache/catalog/Components/fingerprint scaner/fingerprint_sensor_6pwhs7n-500x500.jpg) , it uses a serial connection for the communication and sample code and a library is available from Adafruit (together with a Windows utility that can be used for troubleshooting and for enrolling your fingerprints).

      If battery powered, the sensor cannot of course stay always on since consuming around 150mAh. This is why I've attached a button to the project so the person using it can press the button, the node wakes up, the sensor turns on and the person can put the finger on it. After that, the board goes back to sleep. I've also added a buzzer to shortly beep in case of a positive match.

      This is how the project looks like:
      alt text

      • 1: EasyPCB from @sundberg84 RFM69 version
      • 2: FPM10A sensor. RX and TX connected to pin 5 and 6 (using SoftwareSerial).
      • 3: MCP1302 voltage regulator to provide 3.3v out of the 3 AA batteries (4.5v). I preferred using this configuration since the FPM10A works so so when the voltage is below 3v. The regulator is placed in the booster position so to measure the battery level
      • 4: battery measurement, resistors 1M and 300k ohm
      • 5: since the FPM10A has to be powered on only on demand and an arduino pin cannot provide enough current, I'm using a pn2222a transistor connected to an arduino pin on one side through a 220ohm resistor (with a 10k resistor going to ground) and the FPM10A gound on the other side
      • 6: button for waking up the board and starting the fingerprint sensor
      • 7: 3 AA battery pack
      • 8: buzzer

      This is the code I'm using (from the NodeManager's development branch):

      /**********************************
       * MySensors node configuration
       */
      
      // General settings
      #define SKETCH_NAME "Fingerprint"
      #define SKETCH_VERSION "1.0"
      #define MY_NODE_ID 9
      
      // RFM69 radio settings
      #define MY_RADIO_RFM69
      #define MY_IS_RFM69HW
      #define MY_RFM69_NEW_DRIVER
      
      // Advanced settings
      #define MY_BAUD_RATE 9600
      #define MY_SPLASH_SCREEN_DISABLED
      
      /***********************************
       * NodeManager modules for supported sensors
       */
      
      #define USE_BATTERY
      #define USE_SIGNAL
      #define USE_DIGITAL_OUTPUT
      #define USE_INTERRUPT
      #define USE_FPM10A
      
      /***********************************
       * NodeManager built-in features
       */
      
      // Enable/disable NodeManager's features
      #define FEATURE_DEBUG ON
      #define FEATURE_POWER_MANAGER ON
      #define FEATURE_INTERRUPTS ON
      #define FEATURE_CONDITIONAL_REPORT OFF
      #define FEATURE_EEPROM OFF
      #define FEATURE_SLEEP ON
      #define FEATURE_RECEIVE ON
      #define FEATURE_TIME OFF
      #define FEATURE_RTC OFF
      #define FEATURE_SD OFF
      #define FEATURE_HOOKING ON
      
      /***********************************
       * Load NodeManager Library
       */
      
      #include "NodeManagerLibrary.h"
      NodeManager node;
      
      /***********************************
       * Add your sensors below
       */
      
      // built-in sensors
      SensorBattery battery(node);
      SensorSignal signal(node);
      PowerManager power(-1,A1,1000);
      
      // Attached sensors
      SensorFPM10A fingerprint(node,5,6);
      SensorDigitalOutput buzzer(node,A5);
      
      /***********************************
       * Main Sketch
       */
      
      void bip(Sensor* sensor) {
        if (fingerprint.success) buzzer.setStatus(ON);
      }
      
      // before
      void before() {
        // setup the serial port baud rate
        Serial.begin(MY_BAUD_RATE);
      
        // battery sensor
        battery.setMinVoltage(3.2);
        battery.setMaxVoltage(4.6);
        battery.setBatteryInternalVcc(false);
        battery.setBatteryPin(A0);
        battery.setBatteryVoltsPerBit(0.00459433);
      
        // buzzer sensor
        buzzer.setPulseWidth(20);
        
        // fingerprint sensor
        fingerprint.setPowerManager(power);
        fingerprint.setWaitFingerForSeconds(15);
        fingerprint.setInterrupt(3,FALLING,HIGH);
        fingerprint.setPostLoopHook(&bip);
      
        // node configuration
        node.setSleepMinutes(60);
      
        node.before();
      }
      
      // presentation
      void presentation() {
        // call NodeManager presentation routine
        node.presentation();
      }
      
      // setup
      void setup() {
        // call NodeManager setup routine
        node.setup();
      }
      
      // loop
      void loop() {
        // call NodeManager loop routine
        node.loop();
      }
      
      #if FEATURE_RECEIVE == ON
      // receive
      void receive(const MyMessage &message) {
        // call NodeManager receive routine
        node.receive(message);
      }
      #endif
      
      #if FEATURE_TIME == ON
      // receiveTime
      void receiveTime(unsigned long ts) {
        // call NodeManager receiveTime routine
        node.receiveTime(ts);
      }
      #endif
      

      Basically the node sleeps and wakes up every hour to report battery and signal level. When the button (attached to pin 3) is pressed, the node wakes up and the FPM10A is powered on by PowerManager (which turns HIGH pin A1 so saturating the transistor and activating the sensor). If there is a fingerprint match, then the fingerprint id is sent back to the gateway and the node goes back to sleep. Before doing so a short "bip" is sent to the buzzer.
      If nothing happens for 15 seconds, the node goes back to sleep regardless.

      Just a little trick, since I'm running all my arduino nodes at 1Mhz, the FPM10A has to be configured to work at 9600 baud (57600 is the default). The only library that I found with a working example to change this into the device is the following https://github.com/brianrho/FPM/blob/master/examples/setParam/setParam.ino

      posted in My Project
      user2684
      user2684
    • NodeManager v1.7 now available!

      It took a few months but finally NodeManager v1.7 is here!
      With this release the entire NodeManager's architecture has been reviewed, mainly to improved the overall user experience and optimize the code so to use the memory in a more efficient manner. If coming from the previous release, you will find NodeManager way easier to use and more powerful now.
      Last but nost least the number of built-in sensors has no reached 52 (yes, fifty-two, including support for LCD displays), which can be enabled by just uncommeting a single line. For these sensors NodeManager will take care of importing the required library, presenting them to the gateway/controller, executing periodically the main function of the sensor, all without an additional line of code.

      Collaboration for this release has been also great with 15 PRs from other users of the community who I want to really thank.

      NodeManager v1.7 can be downloaded directly from Github https://github.com/mysensors/NodeManager.
      Please read the README file carefully before starting so to get a sense on how to use it or what has changed from the previous releases.

      The full release notes for this version are listed below:

      • Reviewed the entire NodeManager's architecture with children now automatically created from within each sensor
      • Optimized the code so to use the memory in a more efficient manner
      • Improved the overall user experience, also with sensors' patterns in the main sketch
      • Sensors can now be enabled by uncommenting the corresponding USE_* define and requiring a single line to be created and initialized
      • NodeManager's advanced features can be enabled/disabled by setting the corresponding FEATURE_* define
      • Simplified the configuration of each sensor, now without the need of getting the sensor back through a nasty casting
      • Merged config.h into the main sketch so to centralize the configuration in a single place
      • Added time-aware capability, with or without an attached RTC
      • Intra-sensor communication now possible with the possibility for the user to nicely hook into the sensor's code
      • Battery and signal reports are now available through the regular sensors SensorBattery and SensorSignal
      • Remote API interaction for all the sensors has been moved into the regular sensor SensorConfiguration
      • Fixed bug preventing negative temperatures to be reported for all the sensors
      • Added ability for each sensor to report only when value is above or below a configured threshold
      • Addded support for SD card reader
      • Added support for RFM95 radio
      • Added supoport for MySensors Sensebender Gateway and Sensebender Micro boards
      • Added support for generic LCD devices through an abstract Display class
      • SensorDimmer now supports both V_STATUS and V_PERCENTAGE
      • SensorPulseMeter now supports running on batteries
      • SensorDs18B20 optimized and now supporting V_ID
      • SensorSwitch (now renamed into SensorInterrupt) now catches interrupt in a more reliable way
      • SensorLatchingRelay now specialized and renamed into SensorLatchingRelay1Pin and SensorLatchingRelay2Pins
      • Added support for HD44780 i2c LCD
      • Added support for MG996R Servo sensor
      • Added support for VL53L0X laser time-of-flight distance sensor
      • Added support for SensorPlantowerPMS particulate matter sensors
      • Added support for SHT31 temperature and humidity sensor
      • Added support for SI7021 temperature and humidity sensor
      • Added support for for Neopixel LED
      • Added support for Chirp Sensor soil moisture sensor
      • Added support for SparkFun RGB and Gesture Sensor
      • Added support for TTP226/TTP229 Touch control sensor
      posted in NodeManager
      user2684
      user2684
    • Compact battery-powered motion + temperature + humidity project

      Very compact battery powered project based on @NeverDie Arduino Pro Mini Shield for RFM69(H)W board (https://www.openhardware.io/view/268/Arduino-Pro-Mini-Shield-for-RFM69HW) with attached a:

      • Mini Pir motion sensor (https://www.aliexpress.com/item/New-Arrival-Mini-IR-Pyroelectric-Infrared-PIR-Motion-Human-Sensor-Automatic-Detector-Module-high-reliability-12mm/32749804501.html)
      • SHT21 temperature + humidity sensor (https://www.aliexpress.com/item/HTU21D-SHT21-IIC-I2C-Digital-Temperature-Humidity-Sensor-Breakout-Board-Module-For-Weather-Stations-Humidor-Control/32846196764.html)

      I'd warmly recommend that PIR sensor, it's tiny, it works down to 2.7v (so not requiring any voltage regulator for this 3.3v project especially if the arduino runs at 1Mhz like all my boards), consumes nothing and produces very little false positives.

      Code and pictures down below.

      /**********************************
       * MySensors node configuration
       */
      
      // General settings
      #define SKETCH_NAME "Pir"
      #define SKETCH_VERSION "1.0"
      //#define MY_DEBUG
      #define MY_NODE_ID 6
      
      // RFM69 radio settings
      #define MY_RADIO_RFM69
      //#define MY_RFM69_FREQUENCY RFM69_433MHZ
      #define MY_IS_RFM69HW
      #define MY_RFM69_NEW_DRIVER
      //#define MY_RFM69_ENABLE_ENCRYPTION
      #define MY_RFM69_NETWORKID 110
      //#define MY_DEBUG_VERBOSE_RFM69
      //#define MY_RF69_IRQ_PIN D1
      //#define MY_RF69_IRQ_NUM MY_RF69_IRQ_PIN
      //#define MY_RF69_SPI_CS D2
      //#define MY_RFM69_ATC_MODE_DISABLED
      
      // Advanced settings
      #define MY_BAUD_RATE 9600
      //#define MY_SMART_SLEEP_WAIT_DURATION_MS 500
      #define MY_SPLASH_SCREEN_DISABLED
      //#define MY_DISABLE_RAM_ROUTING_TABLE_FEATURE
      //#define MY_SIGNAL_REPORT_ENABLED
      
      /***********************************
       * NodeManager modules for supported sensors
       */
      
      #define USE_BATTERY
      #define USE_SIGNAL
      #define USE_CONFIGURATION
      #define USE_SHT21
      #define USE_INTERRUPT
      
      /***********************************
       * NodeManager built-in features
       */
      
      // Enable/disable NodeManager's features
      #define FEATURE_DEBUG ON
      #define FEATURE_POWER_MANAGER ON
      #define FEATURE_INTERRUPTS ON
      #define FEATURE_CONDITIONAL_REPORT OFF
      #define FEATURE_EEPROM OFF
      #define FEATURE_SLEEP ON
      #define FEATURE_RECEIVE ON
      #define FEATURE_TIME OFF
      #define FEATURE_RTC OFF
      #define FEATURE_SD OFF
      #define FEATURE_HOOKING OFF
      
      /***********************************
       * Load NodeManager Library
       */
      
      #include "NodeManagerLibrary.h"
      NodeManager node;
      
      /***********************************
       * Add your sensors below
       */
      
      // built-in sensors
      SensorBattery battery(node);
      SensorConfiguration configuration(node);
      SensorSignal signal(node);
      
      // Attached sensors
      SensorSHT21 sht21(node);
      SensorMotion motion(node,3);
      
      /***********************************
       * Main Sketch
       */
      
      // before
      void before() {
        // setup the serial port baud rate
        Serial.begin(MY_BAUD_RATE);
        /*
        * Configure your sensors below
        */
      
        // battery sensor
        battery.setMinVoltage(1.8);
        battery.setMaxVoltage(3.2);
        
        // pir sensor
        motion.setInterruptMode(RISING);
        motion.setInitialValue(LOW);
      
        // sht21 sensor
        sht21.setReportIntervalMinutes(5);
      
        // node configuration
        node.setSleepMinutes(5);
        
        /*
        * Configure your sensors above
        */
        node.before();
      }
      
      // presentation
      void presentation() {
        // call NodeManager presentation routine
        node.presentation();
      }
      
      // setup
      void setup() {
        // call NodeManager setup routine
        node.setup();
      }
      
      // loop
      void loop() {
        // call NodeManager loop routine
        node.loop();
      }
      
      #if FEATURE_RECEIVE == ON
      // receive
      void receive(const MyMessage &message) {
        // call NodeManager receive routine
        node.receive(message);
      }
      #endif
      
      #if FEATURE_TIME == ON
      // receiveTime
      void receiveTime(unsigned long ts) {
        // call NodeManager receiveTime routine
        node.receiveTime(ts);
      }
      #endif
      

      0_1532192269076_1.png

      0_1532192281955_2.png

      posted in My Project
      user2684
      user2684
    • RE: 💬 myHouse

      @Gouds I've just added support for Ubuntu (well, should now run fine on any debian-based distribution) in this dev release: https://sourceforge.net/p/my-house/code/ci/8c70a57ed0267f0f2eda3ad9fbaada0462f95765/tree/ if you want to give it a try. Overwrite the files in the existing folder and run again the install.py and upgrade.py scripts.

      If you have any issue during installation/configuration which is not MySensors-related, please drop a message here: https://sourceforge.net/p/my-house/forum/general
      Thanks!

      posted in Announcements
      user2684
      user2684
    • RE: NodeManager: plugin for a rapid development of battery-powered sensors

      Pretty big enhancement in the development branch of NodeManager if anybody is interested. I spent quite a good amount of time working on the core code to introduce mainly two features opening up the door to a good list of enhancements.

      The first one is a sort of countdown utility. Can be based on the number of sleeping cycles or minutes. It detects automatically a sleeping node and instead of using millis sum up the sleep interval and reports when the time is over. This approach has been used to:

      • Allow different sensors reporting at different timeframes (e.g. by configuring a specific sensor to report every e.g. 5 minutes or 10 sleeping cycles instead of at the end of each cycle)
      • For output sensors optionally use the input value as an elapsed time (e.g. the output will be turned on and the input value will be used as a timer to turn it off automatically). For example by sending 3 to a relay, it will be turned on and after 3 minutes turned off automatically. Useful if you already know for how long the output should stay on.
      • For output sensors optionally set a safeguard (e.g. after a relay is set to on, turn it off automatically after 1 hour). Useful if e.g. you are controlling a boiler and you are afraid something could prevent the command to turn it off to reach the board.
      • Add timeframe option for reporting battery level (e.g. instead of reporting every 10 sleeping cycles, report every 1 hour regardless of how long is the sleeping cycles).

      The other big change is a an complete remote API. With the current version you could send to NodeManager's service child id a limited list of commands to change the behavior of the board remotely, mainly to alter the duration of the sleep cycle. In the development release instead, almost every function of both NodeManager AND of every sensor can be invoked remotely. This is done by sending a V_CUSTOM message with a function_id and optional value to pass along to the service child id or each sensor's child id. More details here: https://github.com/mysensors/NodeManager/tree/development#communicate-with-nodemanager-and-its-sensors

      This development branch is available here: https://github.com/mysensors/NodeManager/tree/development

      posted in NodeManager
      user2684
      user2684
    • Door + flood sensor

      Pretty simple door + flood project based on @sundberg84 EasyPCB RFM69 board with attached a:

      • Flood sensor: https://www.aliexpress.com/item/DC-220V-Liquid-Water-Level-Sensor-Right-Angle-Float-Switch-for-Fish-Tank/32643554836.html
      • Door sensor: https://www.aliexpress.com/item/10pairs-lot-NC-and-NO-two-kinds-type-Wired-Metal-Roller-Shutter-Door-Magnetic-Contact-Switch/32843185792.html

      Both the sensors have one wire connected to Ground and on the other wire to an Arduino pin. Principle is simple: we write HIGH to the pin (or let NodeManager doing the job), when the sensor switches (e.g. the circuit is closed), we catch the FALLING interrupt (or the LOW value).

      Since battery powered, the door sensor has to be normally open (e.g. when the door is closed, the circuit is open and no current is wasted). Many Chinese vendors, at least from my experience, makes confusion on this topic and send the wrong one or call it in a wrong way. This is why I bought those sensors with both NO and NC, so I'm sure to have enough flexibility.

      Code with NodeManager's is pretty simple, down below. Only caveat is both the sensors theoretically would be interrupt based but on a Pro Mini there is only one usable pin for it. I've gone crazy trying to use PinChangeInterrupt with NodeManager so eventually I decided to go for the easy way: if there is a water leakage inside my house, I can wait up to 5 minutes, so I'm just polling the flood sensor's pin periodically and send the value to the controller at a regular interval (using SensorDigitalInput).

      Pictures of the project down below.

      /**********************************
       * MySensors node configuration
       */
      
      // General settings
      #define SKETCH_NAME "Door"
      #define SKETCH_VERSION "1.0"
      //#define MY_DEBUG
      #define MY_NODE_ID 5
      
      // RFM69 radio settings
      #define MY_RADIO_RFM69
      //#define MY_RFM69_FREQUENCY RFM69_433MHZ
      #define MY_IS_RFM69HW
      #define MY_RFM69_NEW_DRIVER
      //#define MY_RFM69_ENABLE_ENCRYPTION
      #define MY_RFM69_NETWORKID 110
      //#define MY_DEBUG_VERBOSE_RFM69
      //#define MY_RF69_IRQ_PIN D1
      //#define MY_RF69_IRQ_NUM MY_RF69_IRQ_PIN
      //#define MY_RF69_SPI_CS D2
      //#define MY_RFM69_ATC_MODE_DISABLED
      
      // Advanced settings
      #define MY_BAUD_RATE 9600
      //#define MY_SMART_SLEEP_WAIT_DURATION_MS 500
      #define MY_SPLASH_SCREEN_DISABLED
      //#define MY_DISABLE_RAM_ROUTING_TABLE_FEATURE
      //#define MY_SIGNAL_REPORT_ENABLED
      
      /***********************************
       * NodeManager modules for supported sensors
       */
      
      #define USE_BATTERY
      #define USE_SIGNAL
      #define USE_CONFIGURATION
      #define USE_DIGITAL_INPUT
      #define USE_INTERRUPT
      
      /***********************************
       * NodeManager built-in features
       */
      
      // Enable/disable NodeManager's features
      #define FEATURE_DEBUG ON
      #define FEATURE_POWER_MANAGER OFF
      #define FEATURE_INTERRUPTS ON
      #define FEATURE_CONDITIONAL_REPORT OFF
      #define FEATURE_EEPROM OFF
      #define FEATURE_SLEEP ON
      #define FEATURE_RECEIVE ON
      #define FEATURE_TIME OFF
      #define FEATURE_RTC OFF
      #define FEATURE_SD OFF
      #define FEATURE_HOOKING OFF
      
      /***********************************
       * Load NodeManager Library
       */
      
      #include "NodeManagerLibrary.h"
      NodeManager node;
      
      /***********************************
       * Add your sensors below
       */
      
      // built-in sensors
      SensorBattery battery(node);
      SensorConfiguration configuration(node);
      SensorSignal signal(node);
      
      // Attached sensors
      SensorDigitalInput flood(node,6);
      SensorMotion door(node,3);
      
      /***********************************
       * Main Sketch
       */
      
      // before
      void before() {
        // setup the serial port baud rate
        Serial.begin(MY_BAUD_RATE);
        /*
        * Configure your sensors below
        */
      
        // battery sensor
        battery.setMinVoltage(1.8);
        battery.setMaxVoltage(3.2);
        
        // door sensor
        door.setInitialValue(HIGH);
        door.setInterruptMode(FALLING);
        door.setInvertValueToReport(true);
      
        // flood sensor
        flood.setReportIntervalMinutes(5);
        flood.children.get(1)->setPresentation(S_BINARY);
        flood.children.get(1)->setType(V_STATUS);
      
        // node configuration
        node.setSleepMinutes(5);
        
        /*
        * Configure your sensors above
        */
        node.before();
      }
      
      // presentation
      void presentation() {
        // call NodeManager presentation routine
        node.presentation();
      }
      
      // setup
      void setup() {
        // call NodeManager setup routine
        node.setup();
      }
      
      // loop
      void loop() {
        // call NodeManager loop routine
        node.loop();
      }
      
      #if FEATURE_RECEIVE == ON
      // receive
      void receive(const MyMessage &message) {
        // call NodeManager receive routine
        node.receive(message);
      }
      #endif
      
      #if FEATURE_TIME == ON
      // receiveTime
      void receiveTime(unsigned long ts) {
        // call NodeManager receiveTime routine
        node.receiveTime(ts);
      }
      #endif
      

      0_1532190948397_1.png

      0_1532190963945_2.png

      posted in My Project
      user2684
      user2684
    • MyExtension

      Hi,

      Even if I'm not very good with programming and terrible with C/C++, I tried to put together a sort of extension to the core engine providing additional functionalities but without impacting the core code. The idea was to embed within the sketch (better if in the future in a library), a sort of additional service taking care of common tasks automatically so to simplify the development. The "extension" hooks up (well, manually) into setup(), presentation(), loop() and receive(), present itself as a child-id node type S_CUSTOM to the controller and communicates with it with V_CUSTOM messages. A summary of what it does is:

      • Report battery level periodically and automatically, the period is configurable
      • Able to reboot the board on demand with the default bootloader, by connecting one of the pins to RST
      • Support multiple sleep mode: no sleep, sleep once and sleep cycle
      • Sleep mode and sleep time can be configured remotely with V_CUSTOM messages
      • Sleep mode and sleep time are made persistent within the EEPROM once changed
      • A pin can be configure to wake up a sleeping board when connected to ground
      • Can report battery level on demand
      • Allow changing the node_id remotely
      • Stop sleeping when a WAKEUP message is sent just after a smart sleeping cycle
      • Calculate battery from internal vcc without requiring a pin and the resistors
      • Can calculate the battery percentage using custom boundaries
      • Return the battery voltage through the custom service

      A message to the service would look like 254;200;2;0;48;HELLO and the language (kind of inspired by the old ciseco LLAP) used in the payload of the S_CUSTOM message is the following:

      • BATT: return the battery level
      • HELLO: hello request
      • NOSLEEP: set and save sleeping mode to no sleep
      • SLEEPONCE: set and save sleeping mode to sleep once and go to sleep just after
      • SLEEPCYCLE: set and save sleeping mode to sleep cycle and got to sleep just after
      • SLEEPnnnX: set and save the sleep interval to nnn where X is S=Seconds, M=mins, H=Hours, D=Days. E.g. SLEEP010M would be 10 minutes
      • MYxxx: change the node id to the provided one. E.g. MY025: change the node id to 25. Requires a reboot/restart
      • WAKEUP: when received after a sleeping cycle, abort cycle sleeping since the controller needs us awake
      • REBOOT: reboot the board
      • RESET: clear the user's eeprom
      • VERSION: send back the extension's version

      Now, this is just a proof of concept not suitable for production but I would like to hear your feedback. Does the idea make some sense? Do you see anything that could be interesting to have in the core engine instead? Should I go on developing the idea or trash everything?

      Thanks in advance!

      // Enable debug prints to serial monitor
      #define MY_DEBUG
      
      // Enable and select radio type attached
      #define MY_RADIO_NRF24
      //#define MY_RADIO_RFM69
      
      #include <MySensors.h>
      
      /*
       * MyExtension
       */
       // sample request messages
       /*
      254;200;2;0;48;BATT
      254;200;2;0;48;HELLO
      254;200;2;0;48;SLEEP005S
      254;200;2;0;48;WAKEUP
      254;200;2;0;48;NOSLEEP
      254;200;2;0;48;SLEEPONCE
      254;200;2;0;48;SLEEPCYCLE
      254;200;2;0;48;SLEEP010M
      254;200;2;0;48;REBOOT
      254;200;2;0;48;VERSION
        */
      // define supported sleeping mode
      #define MY_EXT_NO_SLEEP 0
      #define MY_EXT_SLEEP_CYCLE 1
      #define MY_EXT_SLEEP_ONCE 2
      #define MY_EXT_SLEEP_UNIT_S 0
      #define MY_EXT_SLEEP_UNIT_M 1
      #define MY_EXT_SLEEP_UNIT_H 2
      #define MY_EXT_SLEEP_UNIT_D 3
      // define eeprom addresses
      #define MY_EXT_EEPROM_SLEEP_SAVED 0
      #define MY_EXT_EEPROM_SLEEP_MODE 1
      #define MY_EXT_EEPROM_SLEEP_TIME_MAJOR 2
      #define MY_EXT_EEPROM_SLEEP_TIME_MINOR 3
      #define MY_EXT_EEPROM_SLEEP_UNIT 4
      // version
      #define MY_EXT_VERSION 1.0
      
      /*
       * configuration settings
       */
      // define if the board has to sleep every time entering loop(). It can be MY_EXT_NO_SLEEP (no sleep), MY_EXT_SLEEP_ONCE (sleep only once) or MY_EXT_SLEEP_CYCLE (sleep at every cycle)
      #define MY_EXT_SLEEP_MODE MY_EXT_NO_SLEEP
      // define for how long the board will sleep
      #define MY_EXT_SLEEP_TIME 0
      // define the unit of MY_EXT_SLEEP_TIME. It can be MY_EXT_SLEEP_UNIT_S (seconds), MY_EXT_SLEEP_UNIT_M (minutes), MY_EXT_SLEEP_UNIT_H (hours), MY_EXT_SLEEP_UNIT_D (days)
      #define MY_EXT_SLEEP_UNIT MY_EXT_SLEEP_UNIT_S
      // if defined, allow modifying sleep mode and interval remotely with NOSLEEP/SLEEPONCE/SLEEPCYCLE and SLEEPnnnX
      #define MY_EXT_SLEEP_REMOTE_CONFIGURATION
      // if defined, reset the board with the configured pin when receiving a REBOOT message
      
      #define MY_EXT_SOFT_REBOOT
      // the pin to connect to the RST pin to reboot the board
      #define MY_EXT_SOFT_REBOOT_PIN 4
      // if defined, wakeup from sleep when the configured pin changes
      
      #define MY_EXT_SLEEP_INTERRUPT
      // if defined, when waking up from the interrupt, the board stops sleeping. Disable it when attaching e.g. a motion sensor
      #define MY_EXT_SLEEP_INTERRUPT_ABORT_SLEEP
      // the pin to connect sued for waking up a sleeping board. Can be either 2, 3 or a different pin provided is reconfigured to act as an interrupt pin
      #define MY_EXT_SLEEP_INTERRUPT_PIN 3
      // the interrupt mode. Can be either FALLING or RISING 
      #define MY_EXT_SLEEP_INTERRUPT_MODE FALLING
      // the expected vcc when the batter is fully charged, used to calculate the percentage
      
      #define MY_EXT_BATTERY_MAX 3.3
      // the expected vcc when the batter is fully discharged, used to calculate the percentage
      #define MY_EXT_BATTERY_MIN 2.8
      // if defined, report automatically the battery level back to the controller after the given number of hours (if the board sleeping it will be reported when awake next)
      #define MY_EXT_REPORT_BATTERY
      // how frequently (in hours) to report the battery level to the controller
      #define MY_EXT_REPORT_BATTERY_H 1
      // if defined, enable debug of the extension on serial port
      
      #define MY_EXT_DEBUG
      // the sensor child id used by the extension to send messages to the controller
      #define MY_EXT_CHILD_ID 200
      
      /*
       * class definition
       */
      class MyExtension {
      	public:
          MyExtension();
          // functions to be explicitely called within the sketch allow the extension hooking into the flow
      		void setup();
      		void presentation();
      		void loop();
          void receive(const MyMessage &);
      	private:
          // define if and how to sleep
          int _sleep_mode = MY_EXT_SLEEP_MODE;
          // define for how long to sleep (time)
          int _sleep_time = MY_EXT_SLEEP_TIME;
          // define for how long to sleep (unit)
          int _sleep_unit = MY_EXT_SLEEP_UNIT;
          // store last time the battery level has been reported
          long _battery_last_reported = millis();
          // implement custom sleep
          void _sleep();
          // process an incoming message/command
          void _process(const char *);
          // the container of the message used to respond to any request
          MyMessage msg;
      };
      
      /*
       * implementation
       */
      // constructor
      inline MyExtension::MyExtension() {
        // initialize the response message container
        msg = MyMessage(MY_EXT_CHILD_ID,V_CUSTOM);
      }
      
      // what to do when called within setup()
      inline void MyExtension::setup() {
        #ifdef MY_EXT_SOFT_REBOOT
          // setup the reboot pin 
          digitalWrite(MY_EXT_SOFT_REBOOT_PIN,HIGH);
          pinMode(MY_EXT_SOFT_REBOOT_PIN,OUTPUT);
        #endif
        #ifdef MY_EXT_SLEEP_INTERRUPT
          // setup the sleep interrupt pin 
          pinMode(MY_EXT_SLEEP_INTERRUPT_PIN,INPUT);
          digitalWrite(MY_EXT_SLEEP_INTERRUPT_PIN,HIGH ? MY_EXT_SLEEP_INTERRUPT_MODE == FALLING : LOW);
        #endif
        #ifdef MY_EXT_SLEEP_REMOTE_CONFIGURATION
          // restore sleep configuration from eeprom
          if (loadState(MY_EXT_EEPROM_SLEEP_SAVED) == 1) {
            // sleep settings found in the eeprom, restore them
            _sleep_mode = loadState(MY_EXT_EEPROM_SLEEP_MODE);
            _sleep_time = loadState(MY_EXT_EEPROM_SLEEP_TIME_MINOR);
            int major = loadState(MY_EXT_EEPROM_SLEEP_TIME_MAJOR);
            if (major == 1) _sleep_time =  _sleep_time + 250;
            if (major == 2) _sleep_time =  _sleep_time + 250*2;
            if (major == 3) _sleep_time =  _sleep_time + 250*3;
            _sleep_unit = loadState(MY_EXT_EEPROM_SLEEP_UNIT);
            #ifdef MY_EXT_DEBUG
              Serial.print("Restored from eeprom sleep settings: sleep_mode=");
              Serial.print(_sleep_mode);
              Serial.print(" sleep_time=");
              Serial.print(_sleep_time);
              Serial.print(" sleep_unit=");
              Serial.println(_sleep_unit);
            #endif
          }
        #endif
      }
      
      // what to do when called within presentation()
      inline void MyExtension::presentation() {
        // present the extension as a custom sensor to the controller
        present(MY_EXT_CHILD_ID,S_CUSTOM);
        #ifdef MY_EXT_REPORT_BATTERY
          // report battery level
          MyExtension::_process("BATT");
        #endif
      }
      
      // what to do when called within loop()
      inline void MyExtension::loop() {
        // continue/start sleeping if requested
        if (_sleep_mode != MY_EXT_NO_SLEEP) MyExtension::_sleep();
      }
      
      // wrapper of smart sleep
      inline void MyExtension::_sleep() {
        // calculate the seconds to sleep
        long sleep_sec = _sleep_time;
        if (_sleep_unit == MY_EXT_SLEEP_UNIT_M) sleep_sec = sleep_sec*60;
        else if (_sleep_unit == MY_EXT_SLEEP_UNIT_H) sleep_sec = sleep_sec*3600;
        else if (_sleep_unit == MY_EXT_SLEEP_UNIT_D) sleep_sec = sleep_sec*43200;
        long sleep_ms = sleep_sec*1000;
        #ifdef MY_EXT_DEBUG
          Serial.print("Going to sleep for ");
          Serial.print(sleep_sec);
          Serial.println("s");
        #endif
        // notify the controller I'm going to sleep
        send(msg.set("SLEEPING"));
        // go in smart sleep for the requested sleep interval
        #ifdef MY_EXT_SLEEP_INTERRUPT
          // sleep and wakeup when the interrupt triggers
          int ret = sleep(digitalPinToInterrupt(MY_EXT_SLEEP_INTERRUPT_PIN),MY_EXT_SLEEP_INTERRUPT_MODE,sleep_ms,true);
        #else
          // sleep without any interrupt
          int ret = sleep(sleep_ms,true);
        #endif
        #ifdef MY_EXT_SLEEP_INTERRUPT
          if (ret > -1) {
            #ifdef MY_EXT_DEBUG
              Serial.println("Woke up by interrupt");
            #endif
            #ifdef MY_EXT_SLEEP_INTERRUPT_ABORT_SLEEP
              // when waking up from an interrupt on the wakup pin, stop sleeping
              _sleep_mode = MY_EXT_NO_SLEEP;
            #endif
            // restore the sleep interrupt pin 
            digitalWrite(MY_EXT_SLEEP_INTERRUPT_PIN,HIGH ? MY_EXT_SLEEP_INTERRUPT_MODE == FALLING : LOW);
          }
        #endif
        // coming out of sleep
        #ifdef MY_EXT_DEBUG
          Serial.println("Awake");
        #endif
        // if supposed to sleep once, reset sleep mode
        if (_sleep_mode == MY_EXT_SLEEP_ONCE) _sleep_mode = MY_EXT_NO_SLEEP;
        // notify the controller I am awake
        send(msg.set("AWAKE"));
        #ifdef MY_EXT_REPORT_BATTERY
          if ( (millis()-_battery_last_reported)/1000/3600 > MY_EXT_REPORT_BATTERY_H) {
            // time to report the battery level again
            MyExtension::_process("BATT");
            _battery_last_reported = millis();
          }
        #endif
      }
      
      // process a message/command
      inline void MyExtension::_process(const char *message) {
        // BATT: return the battery level
        if (strcmp(message,"BATT") == 0) {
          // measure the provided vcc
          float volt = (float)hwCPUVoltage()/1000;
          // send the measure back with a custom message
          char reply[25] = "BATT";
          dtostrf(volt,1,2,&reply[strlen(reply)]);
          send(msg.set(reply));
          // calculate the percentage
          int percentage = 100-(MY_EXT_BATTERY_MAX-volt/(MY_EXT_BATTERY_MAX-MY_EXT_BATTERY_MIN));
          if (percentage > 100) percentage = 100;
          if (percentage < 0) percentage = 0;
          // send battery level percentage
          sendBatteryLevel(percentage);
        }
        // HELLO: hello request
        else if (strcmp(message,"HELLO") == 0) {
          send(msg.set("HELLO"));
        }
        #ifdef MY_EXT_SLEEP_REMOTE_CONFIGURATION
          // NOSLEEP: set and save sleeping mode to no sleep
          else if (strcmp(message,"NOSLEEP") == 0) {
            // go to sleep
            _sleep_mode = MY_EXT_NO_SLEEP;
            // save it to the eeprom
            saveState(MY_EXT_EEPROM_SLEEP_SAVED,1);
            saveState(MY_EXT_EEPROM_SLEEP_MODE,MY_EXT_NO_SLEEP);
            send(msg.set(message));
          }
          // SLEEPONCE: set and save sleeping mode to sleep once and go to sleep just after
          else if (strcmp(message,"SLEEPONCE") == 0) {
            // go to sleep
            _sleep_mode = MY_EXT_SLEEP_ONCE;
            // save it to the eeprom
            saveState(MY_EXT_EEPROM_SLEEP_SAVED,1);
            saveState(MY_EXT_EEPROM_SLEEP_MODE,MY_EXT_SLEEP_ONCE);
          }
          // SLEEPCYCLE: set and save sleeping mode to sleep cycle and got to sleep just after
          else if (strcmp(message,"SLEEPCYCLE") == 0) {
            // go to sleep
            _sleep_mode = MY_EXT_SLEEP_CYCLE;
            // save it to the eeprom
            saveState(MY_EXT_EEPROM_SLEEP_SAVED,1);
            saveState(MY_EXT_EEPROM_SLEEP_MODE,MY_EXT_SLEEP_CYCLE);
          }
          // SLEEPnnnX: set and save the sleep interval to nnn where X is S=Seconds, M=mins, H=Hours, D=Days. E.g. SLEEP010M would be 10 minutes
          else if (strlen(message) == 9 && strncmp("SLEEP",message,strlen("SLEEP")) == 0) {
            // parse and set the sleep interval
            int offset = 5;
            // extract the unit (S=secs, M=mins, H=hours, D=Days)
            char unit[2];
            sprintf(unit,"%c",message[3+offset]);
            unit[1] = '\0';
            if (strcmp(unit,"S") == 0) _sleep_unit = MY_EXT_SLEEP_UNIT_S;
            else if (strcmp(unit,"M") == 0) _sleep_unit = MY_EXT_SLEEP_UNIT_M;
            else if (strcmp(unit,"H") == 0) _sleep_unit = MY_EXT_SLEEP_UNIT_H;
            else if (strcmp(unit,"D") == 0) _sleep_unit = MY_EXT_SLEEP_UNIT_D;
            else return;
            // extract the requested time
            char s[4];
            s[0] = message[0+offset];
            s[1] = message[1+offset];
            s[2] = message[2+offset];
            s[3] = '\0';
            _sleep_time = atoi(s);
            #ifdef MY_EXT_DEBUG
              Serial.print("Set sleep_interval to "); 
              Serial.print(_sleep_time);
              Serial.print(" ");
              Serial.println(_sleep_unit);
            #endif
            // save it to eeprom
            saveState(MY_EXT_EEPROM_SLEEP_UNIT,_sleep_unit);
            // encode sleep time
            int major = 0;
            if (_sleep_time > 750) major = 3;
            else if (_sleep_time > 500) major = 2;
            else if (_sleep_time > 250) major = 1;
            int minor = _sleep_time - 250*major;
            saveState(MY_EXT_EEPROM_SLEEP_SAVED,1);
            saveState(MY_EXT_EEPROM_SLEEP_TIME_MINOR,minor);
            saveState(MY_EXT_EEPROM_SLEEP_TIME_MAJOR,major);
            // interval set, reply back with the same message to acknowledge. Wait for SLEEP to start sleeping
            send(msg.set(message));
          }
        #endif
        // MYxxx: change the node id to the provided one. E.g. MY025: change the node id to 25. Requires a reboot/restart
        else if (strlen(message) == 5 && strncmp("MY",message,strlen("MY")) == 0) {
          // extract the node id
          char s[4];
          s[0] = message[2];
          s[1] = message[3];
          s[2] = message[4];
          s[3] = '\0';
          int node_id = atoi(s);
          // Save static ID to eeprom
          hwWriteConfig(EEPROM_NODE_ID_ADDRESS, (uint8_t)node_id);
          _transportConfig.nodeId = (uint8_t)node_id;
        }
        // WAKEUP: when received after a sleeping cycle, abort cycle sleeping since the controller needs us awake
        else if (strcmp(message,"WAKEUP") == 0) {
          send(msg.set(message));
          _sleep_mode = MY_EXT_NO_SLEEP;
        }
        // REBOOT: reboot the board
        else if (strcmp(message,"REBOOT") == 0) {
          #ifdef MY_EXT_SOFT_REBOOT
            // set the reboot pin connected to RST to low so to reboot the board
            send(msg.set(message));
            digitalWrite(MY_EXT_SOFT_REBOOT_PIN,LOW);
          #endif
        }
        // RESET: clear the user's eeprom
        else if (strcmp(message,"RESET") == 0) {
          for (int i = 0; i<=255; i++) saveState(i,0xFF);
          send(msg.set(message));
        }
        // VERSION: send back the extension's version
        else if (strcmp(message,"VERSION") == 0) {
          send(msg.set(MY_EXT_VERSION,1));
        }
        
      }
      
      // what to do when called within receive()
      inline void MyExtension::receive(const MyMessage &message) {
        // ignore messages not for this extension
        if (message.sensor != MY_EXT_CHILD_ID) return;
        #ifdef MY_EXT_DEBUG
          Serial.print("Received message from=");
          Serial.print(message.sender);
          Serial.print(" command=");
          Serial.print(message.getCommand());
          Serial.print(" type=");
          Serial.print(message.type);
          Serial.print(" payload=");
          Serial.println(message.getString());
        #endif
        // parse incoming req messages
      	if (message.getCommand() == C_REQ && message.type == V_CUSTOM) {
          // process only V_CUSTOM messages
      		MyExtension::_process(message.getString());
      	}
      }
      
      // instantiate MyExtension
      MyExtension extension;
      
      //setup
      void setup() {
        // setup MyExtension
        extension.setup();
      }
      
      // presentation
      void presentation() {
        // Send the sketch version information to the gateway and Controller
      	sendSketchInfo("Test Sketch", "1.0");
        // present MyExtension
      	extension.presentation();
        
      }
      
      // loop
      void loop() {
        // loop for MyExtension
        extension.loop();
      }
      
      // receive
      void receive(const MyMessage &message) {
        // receive for MyExtension
        extension.receive(message);
      }
      
      posted in Development
      user2684
      user2684
    • RE: Request for contribution - controller selection matrix

      Done it! (https://www.mysensors.org/controller/egeoffrey). I've already removed the legacy myHouse project and updated the spreadsheet. If there is anything wrong in the changes, just let me know. Do I also need to create a subcategory under https://forum.mysensors.org/category/3/controllers? Thanks!

      posted in Controllers
      user2684
      user2684
    • RE: 💬 NodeManager

      After a few months working behind the scene, NodeManager got kind of a full review in terms of architecture and usability. The code should be now simpler to understand for new users, the memory utilization has been optimized and the overall user experience has been improved.

      The looooong list of things that have been changed are detailed on https://github.com/mysensors/NodeManager/pull/229.
      Please note this is only available in the development branch (https://github.com/mysensors/NodeManager/tree/development) and will be generally available only when NodeManager's v1.7 will be released (it will take I guess still a few months).

      Since this change was blocking other pending changes, I hope now the development will be faster and feel free to submit your PRs now that the new architecture has been finalized.
      As always, any feedback is more than welcome.
      Thanks

      user2684 created this issue in mysensors/NodeManager

      closed Architecture review #229

      posted in OpenHardware.io
      user2684
      user2684
    • RE: Browser-based firmware generator

      @rakeshpai fully agree with you. I'll start working in order to push those changes which are not a priority or too complex to implement to a future release in order to finalize v1.6 asap and give you the time to start working with something stable. Mean while I'll let you know once the development code will be good enough to start working on it. I can probably target a final v1.6 by end of August and a stable version in a couple of weeks if it fits your plans. I've also created a specific thread we can use to discuss about the integration (https://forum.mysensors.org/topic/7212/integrating-nodemanager-with-sketch-generator) so to keep this as clean as possible from implementation details. Thanks!

      posted in Development
      user2684
      user2684
    • MLX90614 contactless temperature sensor

      In case somebody can be interested (I've not seen any old posts talking about it), I've just tested this contactless temperature sensor from aliexpress (https://www.aliexpress.com/item/Free-Shipping-GY-906-MLX90614ESF-New-MLX90614-Contactless-Temperature-Sensor-Module-For-Arduino-Compatible/32465332978.html?spm=2114.13010608.0.0.gJhz6T) which is pretty cool.

      It reports BOTH the ambient temperature and the object temperature (the latter ranging from -70 to +380 C), has a standard i2c interface and works great with this library: https://github.com/adafruit/Adafruit-MLX90614-Library.

      The price is also pretty interesting, being around 3.5$.

      It can be used in many applications to e.g. measure the temperature of a body, the temperature of an oven, the temperature of a board, or whatever object could make sense in your project.

      posted in Hardware
      user2684
      user2684
    • RE: 💬 Selecting a Controller

      Thanks @rmtucker! @hek, I'll take care of sharing the description and feature list here as soon as the new version of MyHouse with the MySensors plugin will be made available (of course if anybody is interested to give it a try, please come in touch with me). So far the plugin in the development version is working fine so I'm confident to finalize it soon.
      Thanks

      posted in Announcements
      user2684
      user2684
    • RE: 💬 NodeManager

      Hi, I've updated the project (including files and documentation) to version 1.4.
      Main changes are:

      • Added support for ML8511 UV intensity sensor
      • Added support for MQ air quality sensor
      • Added ability to manually assign a child id to a sensor
      • Ensured compatibility for non-sleeping nodes
      • Ability to control if waking up from an interrupt counts for a battery level report
      • When power pins are set the sensor is powered on just after
      • Service messages are disabled by default
      • Bug fixes

      Thanks!

      posted in OpenHardware.io
      user2684
      user2684
    • RE: Modular sketch to be configured with JSON (idea)

      @monte said in Modular sketch to be configured with JSON (idea):

      Imagine you have base firmwares for most sensor types, or it can be generated with NodeManager.

      I don't see specific technical limitations to have this working. On the NodeManager side would be:

      • Include in the sketch all the sensors you want, which is already there
      • Have a logic to configure sensors remotely, which is mostly there through SensorConfiguration (https://github.com/mysensors/NodeManager/blob/master/sensors/SensorConfiguration.h). If then the configuration is through individual messages or json, it makes little difference. There might be some configuration settings missing since not all are available OTA
      • Implement a logic for configuring only specific sensors. Shouldn't be that difficult, probably best is to have a enable/disable switch for each sensor (https://github.com/mysensors/NodeManager/issues/500), having all the sensors disabled by default and then dynamically enabling them

      Bottomline not something to put in place in a few minutes but all the building blocks are there. I do not have at this time spare cycle to spend unfortunately but feel free to start looking at it if you like.

      user2684 created this issue in mysensors/NodeManager

      closed Add option to enable/disable a sensor dynamically and remotely #500

      posted in Development
      user2684
      user2684
    • RE: best approach to add MySensors Node to an existing smoke detector?

      Quick update on this one: I've used a pro mini with the voltage regulator still on board just to test, connected raw and ground to the smoke detector power supply, connected the I/O pin with a 100k/47k voltage divider to the arduino's pin 3, used the same code of a motion sensor and put the board to sleep. When I push the test button the board wakes up from the interrupt and reports back so it works to me. I now need a better LDO than the AMS1117 for the 9v->3.3v conversion. Picture below in case can be useful to somebody else.

      0_1494607989801_Untitled.png

      posted in Hardware
      user2684
      user2684
    • RE: 💬 MySensors Library - v2.x

      @martinhjelmare Thanks, I've completely missed it expecting it somehow in the message constructor section, my bad! Thanks again

      posted in Announcements
      user2684
      user2684
    • RE: 💬 NodeManager

      @core_c found a great way to to let NodeManager identifying automatically which i2c address the sensor is using without the need for the user to change anything in the code. This is done by requesting the chip_id for the two i2c address and comparing it with the expected one to identify the right address. I've implemented it for both the BME280 and BMP085/BMP180 sensors and it is available in 1.5-dev3 (https://github.com/mysensors/NodeManager/tree/702a05c7e2f4425c188d5abf62b4a119fea29bc8). Also, under the hood, I've created a SensorBosch class which is not exposed but helps providing common functionalities to the two sensors without duplicating the code.

      Finally, specifically for your problem @ksga, I found a critical bug in the BME280 class. I wonder how I've missed it so far. For some unknown reasons, the bme object created by registerSensor and passed to the SensorBME280 class, was not stored by the latter. This means it was calling e.g. readTemperature on a null pointer which I even wonder why was not crashing everything. It has been fixed in 1.5-dev3 so if you would like to give it a try, I'm more confident it will work just fine finally 🙂

      posted in OpenHardware.io
      user2684
      user2684
    • RE: [SOLVED] Multiple source files & including MySensors.h problem

      Hi, I think you have a similar issue to mine at https://forum.mysensors.org/topic/6084/including-mysensors-h-in-multiple-files. You don't want to include MySensors.h in the other header files but individual MySensors headers containing the functions you need e.g.

      #include <core/MySensorsCore.h>
      
      posted in Troubleshooting
      user2684
      user2684
    • My first board (Arduino Pro Mini Shield for RFM69)

      I'm very new to Kicad and PCB design so I'd be very grateful if anybody has any thought, comment, suggestion, etc. to share regarding my first board. I'm sharing the entire kicad project at https://www.openhardware.io/view/605/Arduino-Pro-Mini-Shield-for-RFM69.
      Even something such as best practice/naming convention, etc. which may sound trivial for an experienced designer could be helpful for a beginner like me 🙂
      Thanks!

      posted in Hardware
      user2684
      user2684
    • RE: 💬 NodeManager

      Hello All,

      NodeManager v1.6 is finally available! Download and upgrade instructions can be found as always on https://github.com/mysensors/NodeManager

      First of all I want to thank everybody contributing to the project, especially those who have submitted pull requests to the repository.

      In v1.6 we have 36 out-of-the-box sensors as well as a good number fixes and enhancements. The most notable are for sure the capability to customize any sensor remotely through a brand new remote API and a more flexible and effective way to configure reporting intervals and sleep cycles:

      • Introduced new remote API to allow calling almost ALL NodeManager's and its sensors' functions remotely
      • Reporting interval configuration is now indipendent from the sleep cycle
      • Reporting interval can be customized per-sensor
      • All intervals (measure/battery reports) are now time-based
      • Added support for BMP280 temperature and pressure sensor
      • Added support for RS485 serial transport
      • Added support for TSL2561 light sensor
      • Added support for DHT21 temperature/humidity sensor
      • Added support for AM2320 temperature/humidity sensor
      • Added support for PT100 high temperature sensor
      • Added support for MH-Z19 CO2 sensor
      • Added support for analog rain and soil moisture sensors
      • Added support for generic dimmer sensor (PWM output)
      • Added support for power and water meter pulse sensors
      • Radio signal level (RSSI) is now reported automatically like the battery level
      • SensorRainGauge now supports sleep mode
      • SensorSwitch now supports awake mode
      • SensorLatchingRealy now handles automatically both on and off commands
      • SensorMQ now depends on its own module
      • Added safeguard (automatic off) to SensorDigitalOutput
      • Any sensor can now access all NodeManager's functions
      • DHT sensor now using MySensors' DHT library

      For those who have previously forked the repository, please ensure to merge the updated development branch first before submitting any new PR.

      Thanks!

      posted in OpenHardware.io
      user2684
      user2684
    • RE: NodeManager: plugin for a rapid development of battery-powered sensors

      Hi, I've added a "How to contribute" section in the documentation of the dev release in case anybody is interested to contribute to this project: https://github.com/mysensors/NodeManager/tree/development#contributing.

      I'm not a git expert so I hope those instructions to have some sense 🙂

      posted in NodeManager
      user2684
      user2684
    • RE: Implementing a new controller

      Hi, I've just committed a working alpha version of myHouse acting as a controller. If anyone is interested to give it a try or to review the implementation, feel free to download the snapshot from https://sourceforge.net/p/my-house/code/ci/b8d057329438c7c434f7de6b8e76dc9bdee13ca6/tree/. Of course this is a development version, it does not necessarily work great. Feel free to report any issue here or on https://sourceforge.net/p/my-house/tickets/153/.

      The implementation is pretty simple, the gateway has to be configured in the "plugins" section (it will be part of the default configuration in the next release) and once a sensor is configured in one of the modules of myHouse, anytime a message is received from the given node_id,child_id,command,type tuple, the payload is saved as a new measure. It does support both ethernet, serial and mqtt gateways but does not support multiple gateways to run together for now. Node id generation is supported as well as smart sleep (messages are queued and delivered once the sensor is back online).

      The sensors have to be configured before starting receiving data (this is the logic of myHouse so I couldn't change it to allow "discovering" of new sensors).

      Full documentation of the stable version of myHouse can be found here https://sourceforge.net/p/my-house/wiki/. FYI the first time you look at the configuration, it is not really user friendly but eventually results pretty flexible. If already running it, I'd recommend creating a separate instance and using a different database to avoid interfering with the stable version.

      The global configuration looks like the following:

      	"mysensors": {
      		"enabled": true,
      		"gateway_type": "ethernet",
      		"gateways": {
      			"serial": {
      				"port": "/dev/ttyAMA0",
      				"baud": 57600
      			},
      			"ethernet": {
      				"hostname": "localhost",
      				"port": 5003
      			},
      			"mqtt": {
      				"hostname": "localhost",
      				"port": 1883,
      				"subscribe_topic_prefix": "mysensors-out",
      				"publish_topic_prefix": "mysensors-in"
      			}
      		}
      	}
      

      A temperature sensor using the plugin would look like the following:

              {
      		  "module_id": "test",
                "group_id": "temperature",
                "sensor_id": "test",
      		  "enabled": true,
                "display_name": {
      			"en": "Temperature"
      			},
                "plugin": {
                  "plugin_name": "mysensors",
      			"node_id": 254,
                  "child_id": 1,
      			"command": "SET",
      			"type": "V_TEMP"
                },
                "format": "temperature"
              }
      

      Thanks

      posted in Controllers
      user2684
      user2684
    • PM10 + PM2.5 + UV + Temperature + Humidity + Pressure + Weather Forecast + Light Sensor

      Despite the long name, it is a pretty simple sensor to build and program.

      0_1546189322015_1.png

      BOM is:

      • 1: @sundberg84 EasyPCB fro RFM69
      • 2: BME280 for Temperature + Humidity + Pressure + Weather Forecast (https://www.aliexpress.com/item/BME280-Digital-Sensor-Temperature-Humidity-Barometric-Pressure-Sensor-Module-I2C-SPI-1-8-5V-GY-BME280/32849462236.html)
      • 3: LDR sensor for light level (https://www.aliexpress.com/item/KY-018-3pin-Optical-Sensitive-Resistance-Light-Detection-Photosensitive-Sensor-Module-for-arduino-DIY-Kit-KY018/32820189174.html)
      • 4: ML8511 for UV rays (https://www.aliexpress.com/item/Analog-output-module-GY-ML8511-UV-UV-sensor-Sensor-Breakout/32533518448.html)
      • 5: DSM501A dust sensor for PM10 and PM2.5 (https://www.aliexpress.com/item/DSM501A-Dust-Sensor-Module-PM2-5-Detection-Dector-Allergic-Smoke-Particles-Sensor-Module-For-Arduino-For/32880813740.html)
      • 5a: two pair of 1K/400R resistors as a voltage divider for allowing the 3.3V arduino to read the two 4.8V outputs of the DSM501A
      • 6: USB TTL to power both the board with the 3.3v output and the DSM501A with the 5V output (https://www.aliexpress.com/item/1pcs-USB-to-TTL-converter-UART-module-CH340G-CH340-3-3V-5V-switch/32668180966.html)

      Of course this cannot run on batteries since the DSM501A requires at least 90mA to work.
      Wiring is pretty simple, with BME280 connect to A4-A5 for I2C communication, the LDR to an analog pin, ML8511 to another analog pin, DSM501A connected to two digital pins through the voltage resistor 5a.

      0_1546189567141_2.png

      All those sensors are supported by NodeManager so the code is super-simple, with the board reporting battery and signal level periodically as well. All sensors reporting every 5 minutes but the DSM501A reporting every 10 minutes (since for a measure it take 1-2 minutes):

      /**********************************
       * MySensors node configuration
       */
      
      // General settings
      #define SKETCH_NAME "DustTemp"
      #define SKETCH_VERSION "1.0"
      #define MY_NODE_ID 13
      
      // RFM69 radio settings
      #define MY_RADIO_RFM69
      #define MY_IS_RFM69HW
      #define MY_RFM69_NEW_DRIVER
      
      // Advanced settings
      #define MY_BAUD_RATE 9600
      #define MY_SPLASH_SCREEN_DISABLED
      
      /***********************************
       * NodeManager configuration
       */
      
      #define NODEMANAGER_DEBUG OFF
      #define NODEMANAGER_INTERRUPTS OFF
      #define NODEMANAGER_SLEEP OFF
      #define NODEMANAGER_RECEIVE OFF
      #define NODEMANAGER_DEBUG_VERBOSE OFF
      #define NODEMANAGER_POWER_MANAGER OFF
      #define NODEMANAGER_CONDITIONAL_REPORT OFF
      #define NODEMANAGER_EEPROM OFF
      #define NODEMANAGER_TIME OFF
      #define NODEMANAGER_RTC OFF
      #define NODEMANAGER_SD OFF
      #define NODEMANAGER_HOOKING OFF
      #define NODEMANAGER_OTA_CONFIGURATION OFF
      #define NODEMANAGER_SERIAL_INPUT OFF
      
      // import NodeManager library (a nodeManager object will be then made available)
      #include <MySensors_NodeManager.h>
      
      /***********************************
       * Add your sensors
       */
       
      #include <sensors/SensorBattery.h>
      SensorBattery battery;
      
      #include <sensors/SensorSignal.h>
      SensorSignal signal;
      
      #include <sensors/SensorLDR.h>
      SensorLDR ldr(A1);
      
      #include <sensors/SensorML8511.h>
      SensorML8511 ml8511(A0);
      
      #include <sensors/SensorBME280.h>
      SensorBME280 bme280;
      
      #include <sensors/SensorDSM501A.h>
      SensorDSM501A DSM501A(6,5);
      
      /***********************************
       * Main Sketch
       */
      
      // before
      void before() {
      	
        /***********************************
         * Configure your sensors
         */
      
        // DSM501A sensor
        DSM501A.setReportIntervalMinutes(10);
         
        // node configuration
        nodeManager.setReportIntervalMinutes(5);
         
        // call NodeManager before routine
        nodeManager.before();
      }
      
      // presentation
      void presentation() {
        // call NodeManager presentation routine
        nodeManager.presentation();
      }
      
      // setup
      void setup() {
        // call NodeManager setup routine
        nodeManager.setup();
      }
      
      // loop
      void loop() {
        // call NodeManager loop routine
        nodeManager.loop();
      }
      
      #if NODEMANAGER_RECEIVE == ON
      // receive
      void receive(const MyMessage &message) {
        // call NodeManager receive routine
        nodeManager.receive(message);
      }
      #endif
      
      #if NODEMANAGER_TIME == ON
      // receiveTime
      void receiveTime(unsigned long ts) {
        // call NodeManager receiveTime routine
        nodeManager.receiveTime(ts);
      }
      #endif
      

      And this is the final result (yes the box doesn't look really great):

      0_1546189773866_3.png

      Overall everything works fine even if I'm not that satisfied of the DSM501A sensor since most of the times it doesn't return a valid read (negative value which is then ignored) and when it does the value looks to me a bit too high (I should be already dead if this level of pollution would be real :P).

      0_1546190106354_4.png

      Hope it can help

      posted in My Project
      user2684
      user2684
    • RE: 💬 NodeManager

      @reinhold thanks for reporting this issue. One of the main objectives of the new architecture was to reduce the memory footprint so if this is not the case, there is definitely something to fix. I've noticed in your sketch you are using the remote configuration sensor, that one is huge in terms of memory, if not strictly required I'd comment it out (BTW very nice project!). In PR #229 I've also uploaded a spreadsheet with all tests I run for realizing what was using the memory the most. Anyway, there is still a lot of room for improvement looks like 🙂
      Thanks @mfalkvidd , I'll give the directives you pointed out a try!

      posted in OpenHardware.io
      user2684
      user2684
    • RE: NodeManager: plugin for a rapid development of battery-powered sensors

      Hello, NodeManager's version 1.6 is almost ready. Plenty of new things and fixes are about to be available but I'd need some diverse testing before officially releasing it.

      The first step would be to ensure that what was working with the current version is still working with this new release 🙂

      All the new things are instead detailed here https://github.com/mysensors/NodeManager/issues?utf8=✓&q=milestone%3Av1.6 is%3Aclosed label%3Afixed and in the associated PRs.

      The code is available at https://github.com/mysensors/NodeManager/tree/development.

      Whoever is willing to give it a try, please report any issue directly on github whenever there is already an issue open or on https://forum.mysensors.org/topic/7266/nodemanager-v1-6-dev-comments-and-issues otherwise.

      Ideally I'm targeting mid August for releasing a stable v1.6.

      Many thanks!

      posted in NodeManager
      user2684
      user2684
    • RE: Request for contribution - controller selection matrix

      Thanks all, yes I do have privileges to edit pages. Will work on it and when ready publish directly the changes. Should I face any issue in the process I'll get back here. Thanks again!

      posted in Controllers
      user2684
      user2684
    • RE: 💬 NodeManager

      @alowhum many thanks for the feedback, really appreciated!

      posted in OpenHardware.io
      user2684
      user2684
    • NodeManager v1.7-beta: feedback needed

      Hi, NodeManager v1.7 is almost ready and all the major features and bug fixes for this release have been now implemented. For those willing to give it a try to identify any potential issue or just share a comment, please feel free to do so (https://github.com/mysensors/NodeManager/tree/development).

      There are no compatibility issue with the MySensors library but an automatic upgrade from NodeManager v1.6 is not possible due to a deep architecture review.

      Please review the README file and the release notes for a summary of the new features. For a full list of what has changed please refer to https://github.com/mysensors/NodeManager/milestone/9?closed=1.

      Ideally I'd love to release it in a couple of weeks if no major issues will be reported. Thanks in advance!
      Thanks!

      posted in NodeManager
      user2684
      user2684
    • RE: Newbie, adding more than one relay to nodemanager

      Hi @mghaff, just add additional instances of the relay and you can configure them individually. E.g.

      #include <sensors/SensorRelay.h>
      SensorRelay relay1(4);
      SensorRelay relay2(5);
      SensorRelay relay3(6);
      
      posted in NodeManager
      user2684
      user2684
    • ESP8266 and RFM69 send issue

      Hi, it could be a newbie question but I couldn't find something similar in the old messages here in the forum.
      I have on one side an ESP8266 + RFM69 connected according to https://www.mysensors.org/build/connect_radio, running the gateway sketch. On the other side I have a pro mini + RFM69 with the MockMySensors sketch. On the pro mini I have the following logs so it looks like the radio is working but couldn't get an answer from the gw:

      16 TSF:WUR:MS=0
      34 TSM:INIT:TSP OK
      55 TSM:INIT:STATID=254
      79 TSF:SID:OK,ID=254
      100 TSM:FPAR
      3241 TSF:MSG:SEND,254-254-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
      5318 !TSM:FPAR:NO REPLY
      5343 TSM:FPAR
      8484 TSF:MSG:SEND,254-254-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
      10561 !TSM:FPAR:NO REPLY
      10586 TSM:FPAR
      11732 TSF:MSG:SEND,254-254-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
      13811 !TSM:FPAR:NO REPLY
      13836 TSM:FPAR
      14981 TSF:MSG:SEND,254-254-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
      17059 !TSM:FPAR:FAIL
      17080 TSM:FAIL:CNT=1
      17102 TSM:FAIL:PDT
      

      On the gateway I have the following so looks like radio is working, it is able to receive the request message, but no able to send the response back:

      0;255;3;0;9;TSF:MSG:READ,254-254-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
      0;255;3;0;9;TSF:MSG:BC
      0;255;3;0;9;TSF:MSG:FPAR REQ,ID=254
      0;255;3;0;9;TSF:PNG:SEND,TO=0
      0;255;3;0;9;TSF:CKU:OK
      0;255;3;0;9;TSF:MSG:GWL OK
      0;255;3;0;9;!TSF:MSG:SEND,0-0-254-254,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0
      0;255;3;0;9;TSF:MSG:READ,254-254-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
      0;255;3;0;9;TSF:MSG:BC
      0;255;3;0;9;TSF:MSG:FPAR REQ,ID=254
      0;255;3;0;9;TSF:CKU:OK,FCTRL
      0;255;3;0;9;TSF:MSG:GWL OK
      0;255;3;0;9;!TSF:MSG:SEND,0-0-254-254,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0
      0;255;3;0;9;TSF:MSG:READ,254-254-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
      0;255;3;0;9;TSF:MSG:BC
      0;255;3;0;9;TSF:MSG:FPAR REQ,ID=254
      0;255;3;0;9;TSF:CKU:OK,FCTRL
      0;255;3;0;9;TSF:MSG:GWL OK
      0;255;3;0;9;!TSF:MSG:SEND,0-0-254-254,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0
      0;255;3;0;9;TSF:MSG:READ,254-254-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
      0;255;3;0;9;TSF:MSG:BC
      0;255;3;0;9;TSF:MSG:FPAR REQ,ID=254
      0;255;3;0;9;TSF:CKU:OK,FCTRL
      0;255;3;0;9;TSF:MSG:GWL OK
      

      I've tried the usual things (moving the radio at a certain distance, adding capacitors, etc) as well as the excellent document at https://forum.mysensors.org/topic/666/debug-faq-and-how-ask-for-help but without much luck.

      I've also tried replacing the radio with another. Btw both of them are HW so I have the define MY_IS_RFM69HW in both my sketches.
      What am I missing?

      Thanks

      posted in Troubleshooting
      user2684
      user2684
    • RE: 💬 NodeManager

      Thanks for you feedback @Efflon! Good advice to have sample sketches as well, I'll work on it!

      posted in OpenHardware.io
      user2684
      user2684
    • Battery-powered irrigation controller

      Hi, this is still a work in progress but I wanted to share the approach I'm aiming to for a battery-powered irrigation controller in case can be useful to somebody else.

      Since I have no way to power a device in my garden, I cannot use neither an electrovalve nor a traditional relay controlling a valve (would drain the battery while staying on).

      I then found the following solenoid valves which works at a low voltage (3.6V) and requires just a pulse to switch (you may find the same also on amazon):

      • http://www.ebay.com/itm/Plastic-Toilet-Closestool-20mm-Male-Thread-Bi-stable-Pulse-Solenoid-Valve-/162277805621?hash=item25c882ce35:g:DCcAAOSw3ihXTc9L
      • http://www.ebay.com/itm/Toilet-Closestool-20mm-Male-Thread-Bi-stable-Pulse-Solenoid-Valve-DC-3-6-/332118670306?hash=item4d53d0bbe2:g:ll8AAOSwA3dYlHDN

      The principle behind is to switch with positive/negative pulses which I've discovered means simply connecting the two wires to vcc and gnd to open and reverse the wires to close.

      All good but when I tried to control this with two arduino pins, there was no way to have it working and the reason simply is the solenoid requires a LOT of current (I've measured between 0.6 and 1A) which is of course way more than what the board the provide.

      After some googling I've discovered I needed a H-bridge (http://www.instructables.com/id/H-Bridge-on-a-Breadboard/?ALLSTEPS) to control programmatically the valve. I've tried building mine on a breadboard with different transistors/resistor but the valve didn't switch due to a massive voltage drop. Once gain due to the current draw.

      I then bought the following and everything looks working just fine:

      • https://www.aliexpress.com/item/2-DC-motor-drive-module-reversing-PWM-speed-dual-H-bridge-stepper-motor-Mini-victory-L298N/32648692160.html?spm=2114.13010608.0.0.lvAQ6C

      I still need to build the rest but this looks like the easy part since I just need to connect the arduino board to IN1 and IN2 and use simple HIGH pulse to open or close.

      Thanks

      posted in My Project
      user2684
      user2684
    • RE: NodeManager: plugin for a rapid development of battery-powered sensors

      Thanks @Mark-Swift!
      By the way, if anybody is interested I've just fixed a few bugs and added some minor enhancements (for details: https://sourceforge.net/p/mynodemanager/tickets/milestone/v1.1/).

      The new version (v1.1) is available as always at https://sourceforge.net/projects/mynodemanager

      posted in NodeManager
      user2684
      user2684
    • RE: ESP8266 and RFM69 send issue

      You are the man @mfalkvidd! I've been very superficial to face this issue for saving a single line of code 😉 I didn't notice that define is actually used in MyTransportRFM69.cpp.

      After adding it back I had to reset it a good number of times, sometimes I had a soft WTD reset just before the send, other times I had !TSF:MSG:SEND once again and then started working, looks like consistently now. I cannot explain why hasn't worked straight away after the change, it could even be some bad wiring I fixed without noticing it. Thanks for the help!

      posted in Troubleshooting
      user2684
      user2684
    • RE: 💬 NodeManager

      Hello, I think I was able to implement most of the requests discussed here during the last few weeks in a pre-release v1.5 version. Please consider it still as a dev release which gone through very limited testing but since I had to make quite a few changes to core code, would be great to start collecting some feedback now.

      Is is available here: https://github.com/mysensors/NodeManager/tree/9a485cdcaf8e9856219338553335e2dce7253eb3

      It is complicated to reference each of you who requested something so please whoever is interested the full list of new additions/fixes is available here https://github.com/mysensors/NodeManager/milestone/5?closed=1. I did my best to add verbose comments so you should find all the details there. Please add any comment and report any problem directly to the existing issues on github so I can better understand the context. The documentation has been updated as well.
      Thanks

      posted in OpenHardware.io
      user2684
      user2684
    • RE: Battery-powered irrigation controller

      Yet another quick update on this. I think I was able to mitigate somehow the few issues I had:

      • Regarding the abnormal battery consumption, I placed two 330uF capacitor between gnd and Vcc of the H-bridge powering the valve and they seem to help. After a few on and off the battery went from 4.70V to 4.68V so it was not affected at all. Not sure if it is a good idea or not but I thought could help the valve to be more gentle against the battery. I've also added a sleep of two seconds just after the digitalOutput pulse so to allow the board not to suffer of the voltage drop before sending the ack back to the controller (it was sometimes lost before).
      • Regarding the pressure lost at the valve, I was able to gain this pressure somewhere else. First of all I bought new, high quality irrigation sprinklers and they cover with exactly the same pressure almost 50% more ground than the old one. Then I removed a few junctions which were losing additional pressure. Now at least it is usable since I have full coverage of the garden (about 100 square meters) with a single sprinkler.
      • Regarding the safeguard, I've added a very simple timer to my sketch. When a valve is turned on, the time starts (it just counts the number of cycles to make it simple). If too many cycles have passed by and the valve is still on, turns it off automatically.

      Bottom line, I was about to give up with this but now I'm back on track 🙂

      posted in My Project
      user2684
      user2684
    • RE: NodeManager: plugin for a rapid development of battery-powered sensors

      Hi, I've updated NodeManager to its 1.3 version. This should also solve your issue @Ben-Coton. Short changelog:

      • Added support for BME280 temperature/humudity/pressure sensor
      • Added option to measure battery level via a pin in addition to internal Vcc
      • Added example sketches to the documentation
      • Fixed a few bugs

      Code and updated documentation (now with with four comprehensive examples including the full sketches at the end) on https://github.com/mysensors/NodeManager

      posted in NodeManager
      user2684
      user2684
    • RE: Yet another fight against my RFM69

      @scalz sorry I always forget to add all the relevant information 🙂 The hw is a serial gw (pro mini 3.3v attached to a Rpi usb port), the node is another 3.3v pro mini powered by AA batteries. Both running at 1Mhz (which with the new driver is working fine provided all the nodes are running at the same speed) and I'm using tekka's https://github.com/tekka007/MySensors/tree/RFM69_Update which is initializing both the gw and the node at max power and since then I had no more range issues. Btw the logs above have been take with ATC disabled but I had similar logs with it enabled. The relay is connected to an arduino's pin and powered independently.

      I must say I have another three nodes running without a problem with a similar configuration since a few weeks now. Since the last reboot also this one is running perfectly once again. I remember I had a similar issue with another node, same configuration, after a few times I plugged in and out again and again it stared running fine and it is doing so since then. Like if it starts in a good shape, it will continue to do so, if it doesn't, oh then begins the troubles 🙂

      posted in Troubleshooting
      user2684
      user2684
    • RE: 💬 NodeManager

      @Dencan interesting thanks! I initially thought there were two use cases, one is to reboot with a remote command and the other is by using a pin (e.g. when having physical access is easier than sending out a message). But I think you're right, if you have physical access, well, hitting the reset button is way easier than connecting the reboot pin to RST 😉
      I'll use this snippet for the version about to be released (https://github.com/mysensors/NodeManager/issues/101). Thanks!

      user2684 created this issue in mysensors/NodeManager

      closed Use software reboot instead of reboot pin #101

      posted in OpenHardware.io
      user2684
      user2684
    • RE: Battery-powered irrigation controller

      @ionu very sorry for missing your reply for more than 6 months but I didn't get any notification 😞 Your understanding is correct, if you just connect the + and - of the battery to the valve you should hear a "click" and if you reverse the wire, another "click". I wonder if that battery would be powerful enough, I've noticed that valve drains really a lot of current (>1A) when triggering. Try with AA batteries at first, just to check if the valve is functioning.

      My project has evolved over the time, let me share a picture below:
      0_1528148437750_irrigation.png

      • 1: is the amazing EasyPCB from @sundberg84 RFM69 version
      • 2: since the valve works at 3.7v I'm powering the project with 3 AA batteries. I've noticed the valve works just fine with 4.5v when full, till down to around 3v
      • 3: this is a step down regulator for providing 3.3v to the arduino and the radio. I've soldered it there on the EasyPCB (where a booster is supposed to be soldered) since I needed to use the voltage divider which is not available when using the voltage regulator spot. For this reason the battery is connected to the "<=3.3" plug
      • 4: this is the voltage divider for measuring the battery, since we have 4.5v I've coupled the 1M with a 300k
      • 5: this is the bi-stable valve. Can be found on amazon for 5 euros. Ships from china of course
      • 6: this is a 2200uF capacitor placed between the + and the - of the H bridge controlling the valve. Without it, the huge current drain would destroy the battery shortly
      • 7: this is an analog rain sensor. It is powered on by an arduino pin so to save battery while sleeping
      • 8: this is an analog soil moisture. It is powered on by an arduino pin so to save battery while sleeping
      • 9: this is a button to manually turn the valve on or off. It is connected to the arduino pin 3
      • 10: this is the H-bridge capable of controlling the valve since rated at 2A

      The code I'm using, based on NodeManager, is the following:

      /**********************************
       * MySensors node configuration
       */
      
      // General settings
      #define SKETCH_NAME "Irrigation"
      #define SKETCH_VERSION "2.0"
      #define MY_NODE_ID 6
      
      // RFM69 radio settings
      #define MY_RADIO_RFM69
      #define MY_IS_RFM69HW
      #define MY_RFM69_NEW_DRIVER
      
      // Advanced settings
      #define MY_BAUD_RATE 9600
      #define MY_SMART_SLEEP_WAIT_DURATION_MS 1000
      #define MY_SPLASH_SCREEN_DISABLED
      
      /***********************************
       * NodeManager modules for supported sensors
       */
      
      #define USE_BATTERY
      #define USE_SIGNAL
      #define USE_CONFIGURATION
      #define USE_ANALOG_INPUT
      #define USE_DIGITAL_OUTPUT
      #define USE_INTERRUPT
      
      /***********************************
       * NodeManager built-in features
       */
      
      // Enable/disable NodeManager's features
      #define FEATURE_DEBUG ON
      #define FEATURE_POWER_MANAGER ON
      #define FEATURE_INTERRUPTS ON
      #define FEATURE_CONDITIONAL_REPORT OFF
      #define FEATURE_EEPROM OFF
      #define FEATURE_SLEEP ON
      #define FEATURE_RECEIVE ON
      #define FEATURE_TIME OFF
      #define FEATURE_RTC OFF
      #define FEATURE_SD OFF
      #define FEATURE_HOOKING ON
      
      /***********************************
       * Load NodeManager Library
       */
      
      #include "NodeManagerLibrary.h"
      NodeManager node;
      
      /***********************************
       * Add your sensors below
       */
      
      // built-in sensors
      SensorBattery battery(node);
      SensorConfiguration configuration(node);
      SensorSignal signal(node);
      PowerManager power(-1,A1,300);
      
      // Attached sensors
      SensorRain rain(node,A4);
      SensorSoilMoisture soil(node,A5);
      SensorInterrupt button(node,3);
      SensorLatchingRelay2Pins valve(node,5,6);
      
      /***********************************
       * Main Sketch
       */
      
      void toggleValve(Sensor* sensor) {
        valve.toggleStatus();
      }
      
      // before
      void before() {
        // setup the serial port baud rate
        Serial.begin(MY_BAUD_RATE);
        /*
        * Configure your sensors below
        */
      
        // battery sensor
        battery.setMinVoltage(3.2);
        battery.setMaxVoltage(4.6);
        battery.setBatteryInternalVcc(false);
        battery.setBatteryPin(A0);
        battery.setBatteryVoltsPerBit(0.00459433);
        battery.setReportIntervalMinutes(30);
      
        //signal sensor
        signal.setReportIntervalMinutes(30);
      
        // valve
        valve.setSafeguard(60);
        valve.setWaitAfterSet(2000);
        valve.setLegacyMode(true);
      
        // button
        button.setInterruptHook(&toggleValve);
        button.setInitialValue(HIGH);
        button.setInterruptMode(FALLING);
        button.setInvertValueToReport(true);
        node.setInterruptDebounce(1000);
        
        // rain sensor
        rain.setPowerManager(power);
        rain.setReportIntervalMinutes(10);
        rain.setRangeMin(300);
        rain.setReverse(true);
      
        // soil moisture sensor
        soil.setPowerManager(power);
        soil.setReportIntervalMinutes(10);
        soil.setRangeMin(500);
      
        // node configuration
        node.setSleepSeconds(60);
       
        /*
        * Configure your sensors above
        */
        node.before();
      }
      
      // presentation
      void presentation() {
        // call NodeManager presentation routine
        node.presentation();
      }
      
      // setup
      void setup() {
        // call NodeManager setup routine
        node.setup();
      }
      
      // loop
      void loop() {
        // call NodeManager loop routine
        node.loop();
      }
      
      #if FEATURE_RECEIVE == ON
      // receive
      void receive(const MyMessage &message) {
        // call NodeManager receive routine
        node.receive(message);
      }
      #endif
      
      #if FEATURE_TIME == ON
      // receiveTime
      void receiveTime(unsigned long ts) {
        // call NodeManager receiveTime routine
        node.receiveTime(ts);
      }
      #endif
      

      Rain and soil moisture are connected to A4 and A5, reports every 10 minutes and are powered on just before taking the measure through pin A1. The button through the hooking function toggles the valve, when pressed. The valve (or better the H-bridge) is connected through pin 5 and 6 (off and on). The node wakes up every minute to pick up from the controller new orders (using smart sleep). There is also a safeguard of 60 minutes (if something goes wrong with the communication, irrigation is turned off regardless after 60 minutes).

      posted in My Project
      user2684
      user2684
    • RE: NodeManager: plugin for a rapid development of battery-powered sensors

      @vikasjee I'm very open to whatever can make the life of an average user easier, so far I've just pitched what were common requirements for me as a new user but I'm sure there is a lot more that I'm missing. Give me some more info or pointers regarding Virtual Button and IOExpander and how you are using it right now, I couldn't find much here on the forum and my knowledge is limited and I'll look into it for sure!
      Thanks

      posted in NodeManager
      user2684
      user2684
    • RE: Yet another fight against my RFM69

      @scalz thanks, well, nothing is irrelevant, when not working there must be at least one of your points above which I'm not considering enough 🙂
      Now it is still working well, checking in every minute without a single duplicated message in the controller even if far away from the gw and the remote relay triggering when requested. I should probably do a better job in replicating the issue to at least limit the possible causes...I'll report back in the future with better data I hope 🙂 Thanks!

      posted in Troubleshooting
      user2684
      user2684
    • RE: 💬 NodeManager

      Version 1.5 of NodeManager is finally available here!
      https://github.com/mysensors/NodeManager

      I've done my best to implement most of the requests received so far since unfortunately I'm expecting starting from June very little spare time to spend here so I tried to hurry up a bit 🙂 The result is a pretty long change log and a total of 26 between ad-hoc and generic out-of-the-box sensors supported up to this release:

      • Added support for ACS712 current sensor
      • Added support for HC-SR04 distance sensor
      • Added support for BMP085/BMP180 temperature and pressure sensor
      • Added support for Sonoff smart switch
      • Added support for Rain Gauge sensor
      • Added support for MCP9808 temperature sensor
      • Added forecast output to all Bosch sensors
      • Added I2C address auto-discovery for all Bosch sensors
      • Added support for running as a gateway
      • Added option to retrieve the latest value of a sensor from outside NodeManager
      • Remote reboot now does not need a reboot pin configured
      • A heartbeat is now sent also when waking up from a wait cycle
      • When waking up for an interrupt, only the code of the sensor expecting that interrupt is executed
      • Added capability to retrieve the time from the controller
      • Optimized battery life for DS18B20 sensors
      • SLEEP_MANAGER has been deprecated (now always enabled) and setMode() replaces setSleepMode()
      • New mode ALWAYS_ON to let the node staying awake and executing each sensors' loop
      • ESP8266WiFi.h has to be included in the main sketch if MY_GATEWAY_ESP8266 is defined
      • Added receiveTime() wrapper in the main sketch
      • Fixed the logic for output sensors
      • Added common gateway settings in config.h

      I've added upgrade instructions as well in the documentation. Generally speaking to upgrade it is safe to just replace the existing NodeManager.h and NodeManager.cpp files but with this release I had to do some minor changes to the main sketch as well, as documented in the release notes.

      Thanks everybody for all the advice and for reporting any issue always in a constructive way 🙂

      posted in OpenHardware.io
      user2684
      user2684
    • RE: Door + flood sensor

      @jhussain the board is the one pointed out by @mfalkvidd and as for the wiring it is very simple: the door sensor has one wire connected to pin 3 (since interrupt based) and the other to ground, the flood sensor has one connected to pin 6 (can be any) and the other to ground.

      posted in My Project
      user2684
      user2684
    • RE: NodeManager: plugin for a rapid development of battery-powered sensors

      @Efflon thanks for reporting these two issues, I'll track them down with https://github.com/mysensors/NodeManager/issues/34 and https://github.com/mysensors/NodeManager/issues/33 and fix asap!
      Thank you all for your comments!

      user2684 created this issue in mysensors/NodeManager

      closed Default baud rate wrongly set to 9800 instead of 9600 #34

      user2684 created this issue in mysensors/NodeManager

      closed Fix the link to the the latest releases #33

      posted in NodeManager
      user2684
      user2684
    • RE: Sonoff gateway: sketch uploads fine but doesn't run

      @kimot thanks you've definitely given to me the right direction to look into.

      Looks like my chip info is different and is the following:

      esptool.py v2.6
      Serial port COM7
      Connecting....
      Detecting chip type... ESP8266
      Chip is ESP8266EX
      Features: WiFi
      MAC: ec:fa:bc:86:da:e2
      Uploading stub...
      Running stub...
      Stub running...
      Manufacturer: 5e
      Device: 4014
      Detected flash size: 1MB
      Hard resetting via RTS pin...
      

      I see that manufacturer 5e is given problems to many people so I've followed the advice I found here https://forum.micropython.org/viewtopic.php?t=3777 to actually solve the issue, specifically flashing with the -fm dout flag (e.g. esptool.py --port COM5 write_flash -fs 1MB -fm dout 0x0 file.bin) and now it works!

      Many thanks!

      posted in Troubleshooting
      user2684
      user2684
    • RE: 💬 NodeManager

      Hi, I've added a "How to contribute" section in the documentation of the dev release in case anybody is interested to contribute to this project: https://github.com/mysensors/NodeManager/tree/development#contributing.

      I'm not a git expert so I hope those instructions to have some sense 🙂

      posted in OpenHardware.io
      user2684
      user2684
    • RE: Battery-powered irrigation controller

      @Andreas-Menzel I personally tend to replace the batteries early enough. I also have at the controller level a couple of safety checks with are ensuring 1) the "close" message is acknowledged by the sensor and if not resend it again 2) a humidity sensor in the ground checking if it is still irrigating after e.g. 2-3 hours the valve is supposed to be closed.
      I've noticed if the battery is almost over and unable to close the valve once, it will likely succeed when retrying. Then of course batteries have to be changed.
      Over the years I've refined this old project over and over mainly making the capacitor bigger since the valve would otherwise drain so much current to dramatically shorten the battery's life. But this is still border line for the capability of a battery powered sensor I believe.

      posted in My Project
      user2684
      user2684
    • RE: 💬 Selecting a Controller

      Thanks guys! @hek, will do and let you know. @AWI, sorry for missing that thread, I'll edit the table accordingly

      posted in Announcements
      user2684
      user2684
    • RE: NodeManager: plugin for a rapid development of battery-powered sensors

      Hi, v1.4 is out and available at https://github.com/mysensors/NodeManager:

      • Added support for ML8511 UV intensity sensor
      • Added support for MQ air quality sensor
      • Added ability to manually assign a child id to a sensor
      • Ensured compatibility for non-sleeping nodes
      • Ability to control if waking up from an interrupt counts for a battery level report
      • When power pins are set the sensor is powered on just after
      • Service messages are disabled by default
      • Bug fixes

      Full changelog at https://github.com/mysensors/NodeManager/milestone/4?closed=1
      Thanks!

      posted in NodeManager
      user2684
      user2684
    • RE: 💬 NodeManager

      https://www.mysensors.org/controller/myhouse but since I wrote it, my opinion would be biased 😛

      posted in OpenHardware.io
      user2684
      user2684
    • RE: 💬 Log Parser

      Hi, I wonder why the following is parsed as a S_LIGHT presentation. Shouldn't be S_BINARY the type number 3? (https://www.mysensors.org/download/serial_api_20). Thanks!

      0;1;0;0;3;
      
      posted in Announcements
      user2684
      user2684
    • RE: NodeManager: plugin for a rapid development of battery-powered sensors

      @BeniK said in NodeManager: plugin for a rapid development of battery-powered sensors:

      PRES I=1 T=6
      PRES I=2 T=6
      PRES I=3 T=7

      Hi, the sensors are all presented correctly, child id 1 is type temperature (6, the DS18B20), child id 2 is type temperature (6, the DHT22), child id 3 is type humidity (7, the DHT22).
      What it looks like from the logs is that it hangs after sending out the temperature of child id 2, never get to child id 3 so never goes to sleep.

      I wonder if having both DHT and DS18B20 together would consume too much memory causing the sketch to halt. When you compile it, what is the percentage of program storage space and dynamic memory used? For those sensors the objects are allocated dynamically so when getting closer to the memory limit strange behaviors can happen.
      Try also disabling NodeManager's debug (#define DEBUG 0) and all the other modules you are not using (e.g. MODULE_ANALOG_INPUT, MODULE_DIGITAL_INPUT, etc.). All of this should help saving additional memory. Then check on your controller if you get the humidity as well and if the node goes to sleep.

      Thanks!

      posted in NodeManager
      user2684
      user2684
    • RE: 💬 NodeManager

      @Sergio-Rius yes, this is the case, since two different and completely independent child IDs are created, you need to call the methods on both. This is true for any sensor creating multiple IDs. And you're right, it doesn't make sense to me either, it is something I've realized recently. I'm tracking it down with https://github.com/mysensors/NodeManager/issues/198 but I do not expect this to be an easy fix. Thanks

      user2684 created this issue in mysensors/NodeManager

      closed For sensors creating multiple child IDs allow invoking their functions just once #198

      posted in OpenHardware.io
      user2684
      user2684
    • RE: 💬 myHouse

      The new release of myHouse (v2.4) is now available for download from https://sourceforge.net/projects/my-house/.

      Short changelog for this version:

      • Added support for SMS/phone call notifications through an attached GSM module
      • Added support for activating a buzzer when an alert triggers
      • Added support for Orange Pi GPIO
      • Added support for running on a generic debian-based linux distribution
      • Enhanced the scheduler's flexibility
      • Enhaced the rule-based engine's capabilities
      • Added additional backup options
      • Bug fixes and minor enhancements

      As for the MySensors plugin, which is pretty solid since the previous release, I've added support for the new INTERNAL messages added to the beta release (even if it is kind of early) and handled the new I_PRE_SLEEP_NOTIFICATION as I_HEARTBEAT_RESPONSE (that is by releasing the queue of messages to sensors implementing smart sleep).

      As always, follow the installation/upgrade instructions from the documentation after downloading. For any issue, have a look at the relevant sections in the FAQ or use the forum (https://sourceforge.net/p/my-house/forum/) for anything which is not MySensors-related. Feel free to report any issue with the MySensors plugin either here or in the myHouse forum.

      Thanks

      posted in Announcements
      user2684
      user2684
    • RE: NodeManager: plugin for a rapid development of battery-powered sensors

      @mar.conte said in NodeManager: plugin for a rapid development of battery-powered sensors:

      It happens even if i put 6 hours or every 3 hours so in the specified hours it is not regular the report sometimes jumps some report

      Ok, I'd probably need both MySensors and NodeManagers's logs to troubleshoot this, just to ensure there is no failure in sending out the messages as I've seen in the other logs you have previously shared.

      Thanks!

      posted in NodeManager
      user2684
      user2684
    • RE: 💬 NodeManager

      Hi @dakipro, I've just commented on github for the Si7021. Regarding the custom sensor, have a look at this https://github.com/mysensors/NodeManager#creating-a-custom-sensor (or the same section on the development branch documentation if you are using it). As far as you create an (inline) class inheriting from Sensor or its subclasses and implement the methods listed in the documentation you can invoke registerSensor() providing the instance of your class and NodeManager will take care of it. Just take inspiration from an existing sensor if you want to do so, it should save you some time. Thanks

      posted in OpenHardware.io
      user2684
      user2684
    • RE: MySensors Contest 2017 - Winners

      What a honor! Thanks to this fantastic community and congrats to the other winners!

      posted in Announcements
      user2684
      user2684
    • RE: NodeManager: plugin for a rapid development of battery-powered sensors

      @mar.conte said in NodeManager: plugin for a rapid development of battery-powered sensors:

      Should the gateway have the right nodemamager sketch?

      Just to confirm what already discussed: a node/sensor with NodeManager running does not require a gateway with NodeManager on it. Generally speaking, there are two situations in which you may want use NodeManager on a gateway as well (available starting from v1.5):

      • It as to run on a Sonoff device which requires to be configured as a gateway
      • The gateway has sensors attached to it so you may want to use NodeManager's capabilities to configure your sensors in an easy way

      There is also a third situation: you are just lazy and have NodeManager already open in the arduino IDE so you just configure the gateway's settings in config.h and upload the sketch 😛

      posted in NodeManager
      user2684
      user2684
    • RE: 💬 NodeManager

      @vikasjee thanks all clear now! I'll track this with https://github.com/mysensors/NodeManager/issues/224. Thanks again for the detailed explanation!

      user2684 created this issue in mysensors/NodeManager

      open Power Management GND-On/Vcc-On #224

      posted in OpenHardware.io
      user2684
      user2684
    • Implementing a new controller

      Hello Folks,

      I'm writing some code to make my Home Automation Suite project (https://sourceforge.net/projects/my-house/) acting as a controller. I went through old posts here on this topic, the source code of the engine, the serial protocol and API documentation as well as I've reviewed the code of other open source controllers to have an idea of what it really takes.
      I'm almost done but there are still a few things not completely clear to me. If I go through the list of functionalities that must be supported by a controller (https://www.mysensors.org/controller), I'm unsure about the following:

      • Heartbeat support: assuming this is not referring to smart sleep support which is a different item, as far as I have understood the controller is not supposed to reply to heartbeat requests (also because the controller does not have a node id). If a request is for a sensor in the network, the gateway would push it towards the radio network without even reaching the controller, if the destination is 0, the gateway itself would respond. What does this really imply?
      • Ack support: similar to the above, looks like the ack is handled by the gateway when a message comes from the radio network and it is requesting an ack.
      • Request: I've seen controllers handling requests on behalf of other sensors but apparently if e.g. sensor 1 requests something to sensor 2, the gateway would route the message to sensor 2 directly so there is no need for the controller to replay back to 1, right?

      All clear instead for the others: node id generation, OTA support and smart sleep.

      Thanks in advance!
      Dave

      posted in Controllers
      user2684
      user2684
    • RE: NodeManager: plugin for a rapid development of battery-powered sensors

      Version 1.5 of NodeManager is finally available here!
      https://github.com/mysensors/NodeManager

      I've done my best to implement most of the requests received so far since unfortunately I'm expecting starting from June very little spare time to spend here so I tried to hurry up a bit 🙂 The result is a pretty long change log and a total of 26 between ad-hoc and generic out-of-the-box sensors supported up to this release:

      • Added support for ACS712 current sensor
      • Added support for HC-SR04 distance sensor
      • Added support for BMP085/BMP180 temperature and pressure sensor
      • Added support for Sonoff smart switch
      • Added support for Rain Gauge sensor
      • Added support for MCP9808 temperature sensor
      • Added forecast output to all Bosch sensors
      • Added I2C address auto-discovery for all Bosch sensors
      • Added support for running as a gateway
      • Added option to retrieve the latest value of a sensor from outside NodeManager
      • Remote reboot now does not need a reboot pin configured
      • A heartbeat is now sent also when waking up from a wait cycle
      • When waking up for an interrupt, only the code of the sensor expecting that interrupt is executed
      • Added capability to retrieve the time from the controller
      • Optimized battery life for DS18B20 sensors
      • SLEEP_MANAGER has been deprecated (now always enabled) and setMode() replaces setSleepMode()
      • New mode ALWAYS_ON to let the node staying awake and executing each sensors' loop
      • ESP8266WiFi.h has to be included in the main sketch if MY_GATEWAY_ESP8266 is defined
      • Added receiveTime() wrapper in the main sketch
      • Fixed the logic for output sensors
      • Added common gateway settings in config.h

      I've added upgrade instructions as well in the documentation. Generally speaking to upgrade it is safe to just replace the existing NodeManager.h and NodeManager.cpp files but with this release I had to do some minor changes to the main sketch as well, as documented in the release notes.

      Thanks everybody for all the advice and for reporting any issue always in a constructive way 🙂

      posted in NodeManager
      user2684
      user2684
    • RE: 💬 NodeManager

      Hello all, just to let you know when compiling against the latest version of the mysensors 2.2.0-beta library, NodeManager will crash on startup, just after presenting the mysensors logo. Thanks @gohan for pointing this out! Root cause is still unknown but when MY_DEBUG is defined, the crash doesn't take place (https://github.com/mysensors/NodeManager/issues/223)

      user2684 created this issue in mysensors/NodeManager

      closed Crash on startup with latest 2.2.0-beta #223

      posted in OpenHardware.io
      user2684
      user2684
    • RE: Request for contribution - controller selection matrix

      @hek thanks! It took us way more than expected to re-architect all the thing but now that is ready, happy with the result so your positive feedback is appreciated 🙂 Legacy myHouse issue was mainly around extensibility hence this distributed, plugin-based architecture allowing users to package functionalities and/or contents without me doing any change in the core code. And turning it in a cloud-based service (as an option) could be also really easy. But for now the hope is to build a little community around it so to make it evolve further. Just as a starting point 🙂

      posted in Controllers
      user2684
      user2684
    • RE: NodeManager: plugin for a rapid development of battery-powered sensors

      Hi, only for those having problems with a too high utilization of the dynamic memory preventing NodeManager to run smoothly (e.g. generating random data / outputting garbage characters / rebooting, etc), a quick fix is to decrease from 255 to a small number like 5 or 10 the size of the Sensor* _sensors array. This saves more than 20% on a pro mini which is huge. Of course you also need to change every cycle in NodeManager.cpp which is using that 255.

      This of course will be also fixed in the next release. Very silly mistake I know to initialize such a big array but I couldn't image 255 pointers were consuming so much 🙂

      posted in NodeManager
      user2684
      user2684
    • RE: 💬 NodeManager

      Hi, for those looking for making NodeManager time aware (with and without an attached RTC), this capability has been added to the development branch through https://github.com/mysensors/NodeManager/pull/259 and it is of course transparent to the end user. When this feature is enabled, also, the node resumes the remainder sleep time when woken up by an interrupt and allows SensorPulseMeter and subclasses to support sleep mode. Thanks

      user2684 created this issue in mysensors/NodeManager

      closed Time Aware capability #259

      posted in OpenHardware.io
      user2684
      user2684
    • RE: wireless door / window sensor

      Oh you're right, also the "Magnetic Door Switch Sensor" from the example https://www.mysensors.org/build/binary is normally closed. I read somewhere a high value resistor can help in limiting the current flow in these situations but never tried myself

      posted in Hardware
      user2684
      user2684
    • RE: SensorMotion to send both tripped and not tripped

      @tubby SENSOR_MOTION reacts on RISING only so you will not get the low tripped. Try adding the following:

      sensorMotion->setInitial(LOW);
      sensorMotion->setMode(CHANGE);
      

      This should send a message on both RISING and FALLING.

      posted in NodeManager
      user2684
      user2684
    • RE: 💬 NodeManager

      @rfm69 v1.7 is still not completed but theoretically fully functional and with most of the architectural changes already done (https://github.com/mysensors/NodeManager/milestone/9 for the full list of things still to be completed and those already implemented). For sure safe to be tested out! Thanks

      posted in OpenHardware.io
      user2684
      user2684
    • Wiring a RFM69 radio

      Hi, I want to recommend to new users (like myself) to buy some additional items when going for a RFM69 radio. I've discovered in the hard way that this radio has a 2.00mm pin spacing and not 2.54mm. This means that unless you want to solder each pin individually to your arduino, you need some additional piece to wire the radio. First of all, you need to solder 2.00mm pin headers like this one:

      https://www.aliexpress.com/item/50pcs-40-Pin-1x40-Single-Row-2-0mm-Pin-Header-Connector-Copper/32534590109.html?spm=2114.13010608.0.0.lXyGem

      Then you have a couple of alternatives. The first one is to use 2.54mm to 2.0mm Female cables like the following:

      https://www.aliexpress.com/item/UXCELL-40Pcs-1P-2-54Mm-To-2P-2-0Mm-Female-Jumper-Cables-Wire-20Cm/32790868818.html?spm=2114.13010608.0.0.9oaP2q

      Alternatively, this 1.27MM 2.0MM 2.54MM 8pin adapter board is very handy if you want to use traditional cables:

      https://www.aliexpress.com/item/20pcs-1-27MM-2-0MM-2-54MM-8pin-Adapter-Board-Adapter-for-Wireless-Module/32395360741.html?spm=2114.13010608.0.0.lXyGem

      I don't know if makes sense to have these or something similar into the MySensors store as well.

      Thanks!

      posted in Hardware
      user2684
      user2684
    • RE: NodeManager: plugin for a rapid development of battery-powered sensors

      Hello All,
      I've just released on GitHub (https://github.com/mysensors/NodeManager) a hotfix (v1.5.1) for NodeManager in order to include the memory optimization improvements already part of the development version.
      This is to allow saving up to 20% of memory on a pro mini and prevent the board to crash or become unpredictable when approaching the memory limit. No new features or enhancements have been added to this hotfix.
      If instead interested in testing out the development version or contribute please refer to https://github.com/mysensors/NodeManager/tree/development and https://github.com/mysensors/NodeManager/milestone/7.
      Thanks

      posted in NodeManager
      user2684
      user2684
    • RE: 💬 NodeManager

      @rfm69 for your SensorDimmer request, feel free to give v1.7-dev a try from here https://github.com/mysensors/NodeManager/tree/development. Details on the implementation of your request can be found at https://github.com/mysensors/NodeManager/pull/302. Thanks

      user2684 created this issue in mysensors/NodeManager

      closed SensorDimmer Enhancements #302

      posted in OpenHardware.io
      user2684
      user2684
    • RE: MLX90614 contactless temperature sensor

      Hi, in case can be useful, this sensor is also available through NodeManager (https://github.com/mysensors/NodeManager) as SENSOR_MLX90614.
      Thanks

      posted in Hardware
      user2684
      user2684
    • RE: how to use a pwm output

      Hi, a feature request for this is already in (https://github.com/mysensors/NodeManager/issues/118), it should be part of the next release. Thanks

      rakeshpai created this issue in mysensors/NodeManager

      closed Add support for generic PWM output node #118

      posted in NodeManager
      user2684
      user2684
    • RE: Including "MySensors.h" in multiple files

      Thanks for all the answers guys! @mfalkvidd unfortunately without including a mysensors header, file.cpp cannot not compile (e.g. 'sendSketchInfo' was not declared in this scope).
      @pansen to you point include guards do not solve the problem here since the error is coming from the linker, not from the compiler.
      @hek, you are absolutely right! How could I miss such a simple solution! With this in file.h, everything seems working fine:

      #include <core/MySensorsCore.h>
      
      posted in Development
      user2684
      user2684
    • RE: 💬 NodeManager

      Hi, for anybody interested in giving the upcoming NodeManager v1.7 a try or share a feedback, please have a look at https://forum.mysensors.org/topic/9085/nodemanager-v1-7-beta-feedback-needed. Thanks!

      posted in OpenHardware.io
      user2684
      user2684
    • RE: Integrating NodeManager with Sketch Generator

      Hi @rakeshpai, I've finally merged the big update I mentioned in my previous post and postponed to v1.7 a few things I had on the list so to speed up the development and having v1.6 out asap. There will be no major changes left (apart from adding a few other sensors) so I think you can start from the current development branch https://github.com/mysensors/NodeManager/tree/development. With https://github.com/mysensors/NodeManager/pull/177 I've introduced a completely different way to define reporting intervals and sleeping cycles, more details in the PR and in the updated documentation. Of course feel free to let me know in case of any doubt.

      Something else you would need to evaluate is what explained at https://github.com/mysensors/NodeManager/issues/176. This has always been in this way but not sure if you took it into consideration.

      Also, regarding your screen for configuring every sensor, I was wondering if you want to somehow apply a logic similar to mine. I mean, for every sensor in NM you can call a member function of the Sensor class or one from the subclass. E.g. for the thermistor you can set the number of samples (like every sensor since setSamples() is a member of Sensor or a thermistor class specific function. This could for example translate into two tabs, one common for all the sensors and another sensor specific; which has no impact in the code since the object to use is still the same but would probably help you in the configuration screen.
      Thanks

      user2684 created this issue in mysensors/NodeManager

      closed When using setSamples() in DHT only humidity is sampled multiple times #176

      user2684 created this issue in mysensors/NodeManager

      closed Reporting intervals and sleeping cycles review #177

      posted in NodeManager
      user2684
      user2684
    • RE: API, Documentation and examples

      Kind of off topic but maybe can save somebody's else time: presentation() is called before setup(). For some unknown reasons I was convinced setup() was called first due to its name and it took me a while to find this out even if in all the examples the order is correct. So if there is any need to do something which will be used during presentation(), this has to go into before().

      posted in Development
      user2684
      user2684
    • RE: 💬 NodeManager

      Hi, the new version of NodeManager (v1.7) is now available! For those interested in having a look at the new features, supported sensors and capabilities, I've opened a dedicated thread on the forum here https://forum.mysensors.org/topic/9165/nodemanager-v1-7-now-available
      Thanks

      posted in OpenHardware.io
      user2684
      user2684
    • RE: NodeManager: plugin for a rapid development of battery-powered sensors

      Hi, kind of the the last chance to share any feedback regarding NodeManager v1.6-dev which is almost ready and should be out in a week or two.

      Instructions on how to test the pre-release and report issues here: https://forum.mysensors.org/topic/6183/nodemanager-plugin-for-a-rapid-development-of-battery-powered-sensors/184

      Thanks!

      posted in NodeManager
      user2684
      user2684
    • RE: Browser-based firmware generator

      @rakeshpai yes indeed 🙂
      I wonder if you can give a try to https://github.com/user2684/NodeManager/tree/release/1.5.1 before I'll make publicly available. It is basically the same v1.5 version you are using which just applied the memory optimization patch on top. It should save 25% of the memory so it is a huge fix 🙂
      Let me know if works better. Something else I recommend to disable when you are approaching the memory limit is #define DEBUG 1 which will prevent storing all the debug messages giving you another boost.
      Generally speaking you need to stay pretty distant from the 100% memory utilization with NodeManager: since it is allocating its objects dynamically (which is not a good practice but I couldn't find a better way), you can get weird behavior even if the compiler doesn't not complain.

      Thanks!

      posted in Development
      user2684
      user2684
    • RE: 💬 NodeManager

      @rpunkt you don't necessarily need to use an additional pin for ground, just set the value to -1 in case you don't need it (https://github.com/mysensors/NodeManager/blob/master/nodemanager/PowerManager.cpp#L34). The logic is when PowerManager is set, at the end of a sleep cycle, the virtual vcc pin is set to HIGH and all the sensors' loop are executed, then is set back to LOW and board goes back to sleep.
      To use it for all the sensors try just with:

      #define NODEMANAGER_POWER_MANAGER ON
      PowerManager power(5,6, 500);
      nodeManager.setPowerManager(power);
      

      Also ensure the sensor can work with the limited current the arduino's pin is able to provide. Thanks

      posted in OpenHardware.io
      user2684
      user2684
    • RE: Optimisation for button cells (CR2032 and the likes)

      Referencing the enhancement request on https://github.com/mysensors/NodeManager/issues/233

      Thanks!

      dakipro created this issue in mysensors/NodeManager

      closed Optimization for button cell batteries (CR2032 and the likes) #233

      posted in NodeManager
      user2684
      user2684
    • RE: Browser-based firmware generator

      I finally had the chance to spend some time and review the output and put together some comments. Of course some of those are just personal opinions so take out from here whatever you like the most 🙂

      • I would add the "+" for adding a new node on every screen, when on the gateway page it took me a while to realize the button was on the other page
      • I love the way you can see realtime the code generated, easier not only during this phase but also for advanced users to have better understanding of the output
      • I would personally disable signing and encryption by default and I'll let the user chose. Especially for newbie this would avoid the user to understand the steps required to set it up
      • On the gateway config.h, I'd turn off POWER_MANAGER and BATTERY_SENSOR since do not apply
      • On both the gateway and the node I'd turn off PERSIST (requires the user to understand what is persisted so better to leave it for advanced users to manually enable it) and SERVICE_MESSAGES (I'm afraid sending out strings would impact the battery lifetime).
      • ESP8266, when DHCP is set, static network configuration is added to config.h anyway
      • when I click on code and the back on editor, I see the "Other settings" but I cannot go back to the main settings and I have to click on the node on the left side to restore the full layout
      • I'm not sure "As a client, connecting to the controller's server." is applicable. As far as I've understood, it can act either as a server or connecting to a MQTT broker but I may be wrong
      • I'd not use setPowerPins() by default since it is not necessarily something a new user would use/understand
      • The code generated for setPowerPins() is incorrect, you should request the user the gnd pin AND the vcc pin. I see now 12 is always used as vcc pin.
      • For PIR/Door/Switch I'd provide pin 2 or 3 options since those are the only pins accepting interrupts
      • When generating the code for a switch sensor, the output includes "int switch". Since switch is a reserved keyword, I guess it would not compile correctly
      • I'd keep debounce to 0 by default for the switch sensor
      • For the latching relay, I'd add setPulseWidth() since it is a common setting a user would need to customize
      • I'd use RF24_PA_HIGH by default, not because is wrong asking the user to confirm regarding the good power supply but I'm afraid a new user would leave it unchecked and would complain about the poor range he will get
      • I'd split the battery powered checkbox from the mode the node should operate. When not battery powered, in order to get some data out of your sensors, you still need to use setMode() and use WAIT for having a cycle and sensors reporting at the end of every cycle. I'd probably need to change this in future releases since not very intuitive but this is another story 🙂
      posted in Development
      user2684
      user2684
    • RE: NodeManager: plugin for a rapid development of battery-powered sensors

      Hi, the new version of NodeManager (v1.7) is now available! For those interested in having a look at the new features, supported sensors and capabilities, I've opened a dedicated thread on the forum here https://forum.mysensors.org/topic/9165/nodemanager-v1-7-now-available
      Thanks

      posted in NodeManager
      user2684
      user2684
    • RE: Browser-based firmware generator

      @pjr I guess this is partially dependent on NodeManager as well, @rakeshpai I've added https://github.com/mysensors/NodeManager/issues/169 for this. Thanks

      user2684 created this issue in mysensors/NodeManager

      closed Add support for RS485 serial transport #169

      posted in Development
      user2684
      user2684
    • RE: Arduino minimum hw requirements (Nano problems)

      Hi, despite the continuous effort to make NodeManager small in size to fit into any board, when there are a few sensors registered and/or features enabled you can have issues to fit the board's memory. I'm running most of the tests on Pro Mini boards so with the same memory layout of your Nano to put myself in a worst case scenario but especially when using sensors requiring external libraries, the memory consumption could become an issue. Start by disabling NodeManager debug once you trust your code enough as a starting point but if you need all of those features all together you may also consider a board with more memory available. Thanks!

      posted in NodeManager
      user2684
      user2684
    • RE: Browser-based firmware generator

      @rakeshpai FYI I'm making some good progress with the new version of NodeManager (https://github.com/mysensors/NodeManager/milestones) thanks also to the many users contributing 🙂 However, the list of things to do is still pretty long and last thing I want to do is to keep your amazing project on hold depending on mine. So whenever you are almost ready, just let me know so that I can push some of the less critical requests I have on the list to another release and hurry up to finalize the current one I'm working on. Whenever you will tell me "I'm ready", I expect at least a couple of weeks for me to finalize the current code and test the release before will be made available. Thanks

      posted in Development
      user2684
      user2684
    • RE: Newbie, adding more than one relay to nodemanager

      @mghaff inside before() you have to call the function setInvertValueToWrite() on the relay you want to apply it to. E.g.

      relay1.setInvertValueToWrite(true);
      relay2.setInvertValueToWrite(true);
      .....
      
      posted in NodeManager
      user2684
      user2684
    • RE: Modular sketch to be configured with JSON (idea)

      @monte first of all I like the idea of having a multi-purpose sensor which can embody different "personalities" on the fly. NodeManager came in exactly for the purpose of providing a simple to configure, modular firmware with a set of predefined sensor ready to use.

      BUT this is defined at compilation time not at runtime as you are suggesting. Reason is simple: since there are 60+ ready-to-use sensors in NodeManager, accommodating everything especially in a small arduino is not feasible, also considering the dependencies some sensors bring in. I see usually up to 3-4 sensors can fit the flash, no more. But I expect in different environments the situation could be different or at least for a subset of those.

      All of this to say I believe NodeManager is a good starting point for what you are intended to do since you already have modular code for a good number of sensors, hooks for the different phases of the lifecycle and a way for communicating with the node through a "service" channel if you need to send something and act upon it. So feel free to fork the project (preferred way) or start from there.
      All of NodeManager's details can be found on https://github.com/mysensors/NodeManager
      Thanks

      posted in Development
      user2684
      user2684
    • RE: NodeManager: plugin for a rapid development of battery-powered sensors

      @justfra thanks for reporting this issue, I believe there is some sort of library conflicts which is arising across MySensors/Nodemanager versions...something which has to be investigated carefully, I'll track this bug with https://github.com/mysensors/NodeManager/issues/491

      user2684 created this issue in mysensors/NodeManager

      closed ESP32 compilation error #491

      posted in NodeManager
      user2684
      user2684
    • RE: NodeManager on STM32F103C8 - RS485 Gateway + INA219 + OLED

      @adampr1 sorry for reading this thread only now with so much delay 😕 Nice project btw! Which compilation error are you receiving from Nodemanager? I also wonder if you can leverage Nodemanager's hooks capabilities to interact with it in a more clean way. Thanks!

      posted in NodeManager
      user2684
      user2684