Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. My Project
  3. Office plant monitoring

Office plant monitoring

Scheduled Pinned Locked Moved My Project
223 Posts 39 Posters 131.6k Views 42 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • cattooC Offline
    cattooC Offline
    cattoo
    wrote on last edited by
    #175

    Well I have some issues with battery-power.
    When ill use the Usb cable to power the sensor up, everything is working fine. But when ill use 2x1,5V battery´s it does not show up in domoticz. Im not sure if I have connected the battery correct. Its on the VIN and GND and nothing more. Is it correct?

    mfalkviddM 1 Reply Last reply
    0
    • cattooC cattoo

      Well I have some issues with battery-power.
      When ill use the Usb cable to power the sensor up, everything is working fine. But when ill use 2x1,5V battery´s it does not show up in domoticz. Im not sure if I have connected the battery correct. Its on the VIN and GND and nothing more. Is it correct?

      mfalkviddM Online
      mfalkviddM Online
      mfalkvidd
      Mod
      wrote on last edited by
      #176

      @cattoo which Arduino are you using? I'm asking because the Pro Mini doesn't have any pin called VIN.

      cattooC 1 Reply Last reply
      0
      • mfalkviddM mfalkvidd

        @cattoo which Arduino are you using? I'm asking because the Pro Mini doesn't have any pin called VIN.

        cattooC Offline
        cattooC Offline
        cattoo
        wrote on last edited by
        #177

        @mfalkvidd
        Its a Arduino Nano (clone)

        mfalkviddM 1 Reply Last reply
        0
        • NetRapN Offline
          NetRapN Offline
          NetRap
          wrote on last edited by
          #178

          Why not using this sensor?
          Giesomat

          It didn't cost much and work like an angel.

          And if the frequency is to high, or you need a other logic level, you can use this one:
          frequency divider and level shifter

          Don't have any troubles with this.
          I only count the pulses. That all.

          mfalkviddM 1 Reply Last reply
          0
          • NetRapN NetRap

            Why not using this sensor?
            Giesomat

            It didn't cost much and work like an angel.

            And if the frequency is to high, or you need a other logic level, you can use this one:
            frequency divider and level shifter

            Don't have any troubles with this.
            I only count the pulses. That all.

            mfalkviddM Online
            mfalkviddM Online
            mfalkvidd
            Mod
            wrote on last edited by
            #179

            @NetRap You have already stated the same 3 times earlier in this thread. It looks like spam/advertising. What's your point?

            1 Reply Last reply
            0
            • cattooC cattoo

              @mfalkvidd
              Its a Arduino Nano (clone)

              mfalkviddM Online
              mfalkviddM Online
              mfalkvidd
              Mod
              wrote on last edited by
              #180

              @cattoo VIN on the Nano is used when powering with higher than 5V.
              The Nano is not suitable for battery power. I recommend that you use a Pro Mini instead. See https://www.mysensors.org/build/battery

              cattooC 1 Reply Last reply
              0
              • NetRapN Offline
                NetRapN Offline
                NetRap
                wrote on last edited by
                #181

                I don't want to spam.
                The point is, that the conducting based sensors are poison.
                The electrolytic processes destroy the sensor and giving ions into the
                earth !!!

                Look at this site:
                All Technologies
                There are compared all possible technology's.
                Giesomat wins.

                1 Reply Last reply
                0
                • mfalkviddM mfalkvidd

                  @cattoo VIN on the Nano is used when powering with higher than 5V.
                  The Nano is not suitable for battery power. I recommend that you use a Pro Mini instead. See https://www.mysensors.org/build/battery

                  cattooC Offline
                  cattooC Offline
                  cattoo
                  wrote on last edited by
                  #182

                  @mfalkvidd said:
                  Ah okey, well then ill use them with proper power and buy new pro mini´s instead. Tack :)

                  1 Reply Last reply
                  0
                  • TON RIJNAARDT Offline
                    TON RIJNAARDT Offline
                    TON RIJNAARD
                    wrote on last edited by
                    #183

                    Hello,

                    Is there a sketch for mysensors 2.0
                    I get error on the Mysensor gw;

                    Ton

                    1 Reply Last reply
                    0
                    • J Offline
                      J Offline
                      joshmosh
                      wrote on last edited by
                      #184

                      Just to give a feedback on power consumption: I have switched back to mysensors V 1.5.4. This was roughly one month ago. I take meadurements every two hours. Battery voltage hasn't changed a bit since then. So my guess is, that - for whatever reason - mysensors V 2.0 seems to produce a more power hungry code.
                      Whatever ...
                      I am happy now and will stick with V 1.5.4
                      I am

                      N 1 Reply Last reply
                      0
                      • J joshmosh

                        Just to give a feedback on power consumption: I have switched back to mysensors V 1.5.4. This was roughly one month ago. I take meadurements every two hours. Battery voltage hasn't changed a bit since then. So my guess is, that - for whatever reason - mysensors V 2.0 seems to produce a more power hungry code.
                        Whatever ...
                        I am happy now and will stick with V 1.5.4
                        I am

                        N Offline
                        N Offline
                        Nicklas Starkel
                        wrote on last edited by
                        #185

                        @joshmosh I use MySensors V2 and took a sample every 30 seconds over a few days simulating almost 28000 transmits.
                        I've come down to have roughly 0.08V decrease for all these transmits which is very close to what @mfalkvidd has.

                        @TON-RIJNAARD , here is my sketch! I think I use signing as well, so if you don't use it just remove :)

                        // Enable debug prints to serial monitor
                        #define MY_DEBUG
                        //The node ID
                        #define MY_NODE_ID 7 //250 is test 
                        // Enable and select radio type attached and also set parent ID
                        #define MY_RADIO_NRF24
                        #define MY_PARENT_NODE_ID 0
                        #define MY_PARENT_NODE_IS_STATIC
                        //Signing, make sure the arduino is prepped for signing before!
                        #define MY_SIGNING_SOFT
                        #define MY_SIGNING_SOFT_RANDOMSEED_PIN 7
                        #define MY_SIGNING_REQUEST_SIGNATURES
                        #include <SPI.h>
                        #include <MySensors.h>
                        
                        #define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5))
                        #define N_ELEMENTS(array) (sizeof(array)/sizeof((array)[0]))
                        
                        #define CHILD_ID_MOISTURE 0
                        #define CHILD_ID_BATTERY 1
                        #define SLEEP_TIME 1800000 // Sleep time between reads (in milliseconds)
                        #define STABILIZATION_TIME 1000 // Let the sensor stabilize before reading
                        #define BATTERY_FULL 3000 // 3,000 millivolts for 2xAA
                        #define BATTERY_ZERO 2800 // 1,900 millivolts (1.9V, limit for nrf24l01 without step-up. 2.8V limit for Atmega328 without BOD disabled))
                        const int SENSOR_ANALOG_PINS[] = {A0, A1}; // Sensor is connected to these two pins. Avoid A3 if using ATSHA204. A6 and A7 cannot be used because they don't have pullups.
                        
                        MyMessage msg(CHILD_ID_MOISTURE, V_HUM);
                        MyMessage voltage_msg(CHILD_ID_BATTERY, V_VOLTAGE);
                        long oldvoltage = 0;
                        byte direction = 0;
                        int oldMoistureLevel = -1;
                        
                        void setup()
                        {
                          sendSketchInfo("Plant moisture w bat", "1.5");
                        
                          present(CHILD_ID_MOISTURE, S_HUM);
                          delay(250);
                          present(CHILD_ID_BATTERY, S_CUSTOM);
                          for (int i = 0; i < N_ELEMENTS(SENSOR_ANALOG_PINS); i++) {
                            pinMode(SENSOR_ANALOG_PINS[i], OUTPUT);
                            digitalWrite(SENSOR_ANALOG_PINS[i], LOW);
                          }
                        }
                        
                        void loop()
                        {
                          pinMode(SENSOR_ANALOG_PINS[direction], INPUT_PULLUP); // Power on the sensor
                          analogRead(SENSOR_ANALOG_PINS[direction]);// Read once to let the ADC capacitor start charging
                          sleep(STABILIZATION_TIME);
                          int moistureLevel = (1023 - analogRead(SENSOR_ANALOG_PINS[direction]));
                        
                          // Turn off the sensor to conserve battery and minimize corrosion
                          pinMode(SENSOR_ANALOG_PINS[direction], OUTPUT);
                          digitalWrite(SENSOR_ANALOG_PINS[direction], LOW);
                        
                          direction = (direction + 1) % 2; // Make direction alternate between 0 and 1 to reverse polarity which reduces corrosion
                          // Always send moisture information so the controller sees that the node is alive
                        
                          // Send rolling average of 2 samples to get rid of the "ripple" produced by different resistance in the internal pull-up resistors
                          // See http://forum.mysensors.org/topic/2147/office-plant-monitoring/55 for more information
                          if (oldMoistureLevel == -1) { // First reading, save value
                            oldMoistureLevel = moistureLevel;
                          }
                          send(msg.set((moistureLevel + oldMoistureLevel +  0.5) / 2 / 10.23, 1));
                          oldMoistureLevel = moistureLevel;
                          long voltage = readVcc();
                          if (oldvoltage != voltage) { // Only send battery information if voltage has changed, to conserve battery.
                            send(voltage_msg.set(voltage / 1000.0, 3)); // redVcc returns millivolts. Set wants volts and how many decimals (3 in our case)
                            sendBatteryLevel(round((voltage - BATTERY_ZERO) * 100.0 / (BATTERY_FULL - BATTERY_ZERO)));
                            oldvoltage = voltage;
                          }
                          sleep(SLEEP_TIME);
                        }
                        
                        long readVcc() {
                          // From http://provideyourown.com/2012/secret-arduino-voltmeter-measure-battery-voltage/
                          // Read 1.1V reference against AVcc
                          // set the reference to Vcc and the measurement to the internal 1.1V reference
                        #if defined(__AVR_ATmega32U4__) || defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
                          ADMUX = _BV(REFS0) | _BV(MUX4) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1);
                        #elif defined (__AVR_ATtiny24__) || defined(__AVR_ATtiny44__) || defined(__AVR_ATtiny84__)
                          ADMUX = _BV(MUX5) | _BV(MUX0);
                        #elif defined (__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__)
                          ADMUX = _BV(MUX3) | _BV(MUX2);
                        #else
                          ADMUX = _BV(REFS0) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1);
                        #endif
                        
                          delay(2); // Wait for Vref to settle
                          ADCSRA |= _BV(ADSC); // Start conversion
                          while (bit_is_set(ADCSRA, ADSC)); // measuring
                        
                          uint8_t low  = ADCL; // must read ADCL first - it then locks ADCH
                          uint8_t high = ADCH; // unlocks both
                        
                          long result = (high << 8) | low;
                        
                          result = 1125300L / result; // Calculate Vcc (in mV); 1125300 = 1.1*1023*1000
                          return result; // Vcc in millivolts
                        }```
                        J 1 Reply Last reply
                        0
                        • N Nicklas Starkel

                          @joshmosh I use MySensors V2 and took a sample every 30 seconds over a few days simulating almost 28000 transmits.
                          I've come down to have roughly 0.08V decrease for all these transmits which is very close to what @mfalkvidd has.

                          @TON-RIJNAARD , here is my sketch! I think I use signing as well, so if you don't use it just remove :)

                          // Enable debug prints to serial monitor
                          #define MY_DEBUG
                          //The node ID
                          #define MY_NODE_ID 7 //250 is test 
                          // Enable and select radio type attached and also set parent ID
                          #define MY_RADIO_NRF24
                          #define MY_PARENT_NODE_ID 0
                          #define MY_PARENT_NODE_IS_STATIC
                          //Signing, make sure the arduino is prepped for signing before!
                          #define MY_SIGNING_SOFT
                          #define MY_SIGNING_SOFT_RANDOMSEED_PIN 7
                          #define MY_SIGNING_REQUEST_SIGNATURES
                          #include <SPI.h>
                          #include <MySensors.h>
                          
                          #define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5))
                          #define N_ELEMENTS(array) (sizeof(array)/sizeof((array)[0]))
                          
                          #define CHILD_ID_MOISTURE 0
                          #define CHILD_ID_BATTERY 1
                          #define SLEEP_TIME 1800000 // Sleep time between reads (in milliseconds)
                          #define STABILIZATION_TIME 1000 // Let the sensor stabilize before reading
                          #define BATTERY_FULL 3000 // 3,000 millivolts for 2xAA
                          #define BATTERY_ZERO 2800 // 1,900 millivolts (1.9V, limit for nrf24l01 without step-up. 2.8V limit for Atmega328 without BOD disabled))
                          const int SENSOR_ANALOG_PINS[] = {A0, A1}; // Sensor is connected to these two pins. Avoid A3 if using ATSHA204. A6 and A7 cannot be used because they don't have pullups.
                          
                          MyMessage msg(CHILD_ID_MOISTURE, V_HUM);
                          MyMessage voltage_msg(CHILD_ID_BATTERY, V_VOLTAGE);
                          long oldvoltage = 0;
                          byte direction = 0;
                          int oldMoistureLevel = -1;
                          
                          void setup()
                          {
                            sendSketchInfo("Plant moisture w bat", "1.5");
                          
                            present(CHILD_ID_MOISTURE, S_HUM);
                            delay(250);
                            present(CHILD_ID_BATTERY, S_CUSTOM);
                            for (int i = 0; i < N_ELEMENTS(SENSOR_ANALOG_PINS); i++) {
                              pinMode(SENSOR_ANALOG_PINS[i], OUTPUT);
                              digitalWrite(SENSOR_ANALOG_PINS[i], LOW);
                            }
                          }
                          
                          void loop()
                          {
                            pinMode(SENSOR_ANALOG_PINS[direction], INPUT_PULLUP); // Power on the sensor
                            analogRead(SENSOR_ANALOG_PINS[direction]);// Read once to let the ADC capacitor start charging
                            sleep(STABILIZATION_TIME);
                            int moistureLevel = (1023 - analogRead(SENSOR_ANALOG_PINS[direction]));
                          
                            // Turn off the sensor to conserve battery and minimize corrosion
                            pinMode(SENSOR_ANALOG_PINS[direction], OUTPUT);
                            digitalWrite(SENSOR_ANALOG_PINS[direction], LOW);
                          
                            direction = (direction + 1) % 2; // Make direction alternate between 0 and 1 to reverse polarity which reduces corrosion
                            // Always send moisture information so the controller sees that the node is alive
                          
                            // Send rolling average of 2 samples to get rid of the "ripple" produced by different resistance in the internal pull-up resistors
                            // See http://forum.mysensors.org/topic/2147/office-plant-monitoring/55 for more information
                            if (oldMoistureLevel == -1) { // First reading, save value
                              oldMoistureLevel = moistureLevel;
                            }
                            send(msg.set((moistureLevel + oldMoistureLevel +  0.5) / 2 / 10.23, 1));
                            oldMoistureLevel = moistureLevel;
                            long voltage = readVcc();
                            if (oldvoltage != voltage) { // Only send battery information if voltage has changed, to conserve battery.
                              send(voltage_msg.set(voltage / 1000.0, 3)); // redVcc returns millivolts. Set wants volts and how many decimals (3 in our case)
                              sendBatteryLevel(round((voltage - BATTERY_ZERO) * 100.0 / (BATTERY_FULL - BATTERY_ZERO)));
                              oldvoltage = voltage;
                            }
                            sleep(SLEEP_TIME);
                          }
                          
                          long readVcc() {
                            // From http://provideyourown.com/2012/secret-arduino-voltmeter-measure-battery-voltage/
                            // Read 1.1V reference against AVcc
                            // set the reference to Vcc and the measurement to the internal 1.1V reference
                          #if defined(__AVR_ATmega32U4__) || defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
                            ADMUX = _BV(REFS0) | _BV(MUX4) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1);
                          #elif defined (__AVR_ATtiny24__) || defined(__AVR_ATtiny44__) || defined(__AVR_ATtiny84__)
                            ADMUX = _BV(MUX5) | _BV(MUX0);
                          #elif defined (__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__)
                            ADMUX = _BV(MUX3) | _BV(MUX2);
                          #else
                            ADMUX = _BV(REFS0) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1);
                          #endif
                          
                            delay(2); // Wait for Vref to settle
                            ADCSRA |= _BV(ADSC); // Start conversion
                            while (bit_is_set(ADCSRA, ADSC)); // measuring
                          
                            uint8_t low  = ADCL; // must read ADCL first - it then locks ADCH
                            uint8_t high = ADCH; // unlocks both
                          
                            long result = (high << 8) | low;
                          
                            result = 1125300L / result; // Calculate Vcc (in mV); 1125300 = 1.1*1023*1000
                            return result; // Vcc in millivolts
                          }```
                          J Offline
                          J Offline
                          joshmosh
                          wrote on last edited by
                          #186

                          @Nicklas-Starkel
                          Strange ...
                          But since I am not missing / using any of the advanced features offered by V 2.0, I don't see a problem (at least for now) to stick with V 1.5.4
                          In any case it is amazing what you can do with low power battery poweroperated sensors.

                          1 Reply Last reply
                          0
                          • TetnobicT Offline
                            TetnobicT Offline
                            Tetnobic
                            wrote on last edited by
                            #187

                            Hi,
                            in last MySensors lib version 2.1.0, I see a new sensor type : S_MOISTURE
                            It's more logicial to use this new type instead of S_HUM ?

                            and so use V_LEVEL instead of V_HUM ?

                            Thanks for respons

                            meanmrgreenM 1 Reply Last reply
                            0
                            • meanmrgreenM Offline
                              meanmrgreenM Offline
                              meanmrgreen
                              wrote on last edited by
                              #188

                              If I use more than one sensor for this. It still will only monitor one plant right? Or can I say monitor 3-4 plants with one node?

                              1 Reply Last reply
                              0
                              • S Offline
                                S Offline
                                Stric
                                wrote on last edited by
                                #189

                                I have an arduino pro mini, connected to 2-3 flowers using A0+A1, A2+A3, A4+A5.. unfortunately, I'm seeing some weird effects between the plants.. if I water one plant, another can change a bunch at the same time (or not, depending on stuff).. Also if I disconnect one flower, another flower can get way different values too..

                                I haven't figured out yet if I'm getting a capacitor effect in the flowers, sending back power through the output signals or what's happening..
                                0_1483967302526_flower.png

                                Here I added water to the "green" flower, then the values for the gray one dropped. The gray one was physically untouched while watering.

                                Code is based on mfalkvidd, with all Ax being set to output=0 and then input+pullup for one while reading..

                                mfalkviddM 1 Reply Last reply
                                0
                                • S Stric

                                  I have an arduino pro mini, connected to 2-3 flowers using A0+A1, A2+A3, A4+A5.. unfortunately, I'm seeing some weird effects between the plants.. if I water one plant, another can change a bunch at the same time (or not, depending on stuff).. Also if I disconnect one flower, another flower can get way different values too..

                                  I haven't figured out yet if I'm getting a capacitor effect in the flowers, sending back power through the output signals or what's happening..
                                  0_1483967302526_flower.png

                                  Here I added water to the "green" flower, then the values for the gray one dropped. The gray one was physically untouched while watering.

                                  Code is based on mfalkvidd, with all Ax being set to output=0 and then input+pullup for one while reading..

                                  mfalkviddM Online
                                  mfalkviddM Online
                                  mfalkvidd
                                  Mod
                                  wrote on last edited by
                                  #190

                                  @Stric interesting (and strange) effect. I wonder what causes it. Maybe the wait time beween turning on the pin and doing the measurement is too short so the level doesn't settle completely?

                                  S 1 Reply Last reply
                                  0
                                  • TetnobicT Tetnobic

                                    Hi,
                                    in last MySensors lib version 2.1.0, I see a new sensor type : S_MOISTURE
                                    It's more logicial to use this new type instead of S_HUM ?

                                    and so use V_LEVEL instead of V_HUM ?

                                    Thanks for respons

                                    meanmrgreenM Offline
                                    meanmrgreenM Offline
                                    meanmrgreen
                                    wrote on last edited by
                                    #191

                                    @Tetnobic i tried this and Ended up with a soil sensor that didn't display % but something called cb?

                                    But yeah it works.

                                    1 Reply Last reply
                                    0
                                    • meanmrgreenM Offline
                                      meanmrgreenM Offline
                                      meanmrgreen
                                      wrote on last edited by
                                      #192

                                      I made a node with 1 fork and it works great!

                                      Any tips on how i can use more than one fork to monitor say 3-4 plants?

                                      S 1 Reply Last reply
                                      0
                                      • mfalkviddM mfalkvidd

                                        @Stric interesting (and strange) effect. I wonder what causes it. Maybe the wait time beween turning on the pin and doing the measurement is too short so the level doesn't settle completely?

                                        S Offline
                                        S Offline
                                        Stric
                                        wrote on last edited by
                                        #193

                                        @mfalkvidd I'm going to do some tests with changing the sampling time and sleep time, but I'm not so hopeful since the effect is seen hours/days after an "unrelated" change.. I got stuck yesterday playing with ESPEasy, but I'll get back to debugging this..

                                        1 Reply Last reply
                                        0
                                        • meanmrgreenM meanmrgreen

                                          I made a node with 1 fork and it works great!

                                          Any tips on how i can use more than one fork to monitor say 3-4 plants?

                                          S Offline
                                          S Offline
                                          Stric
                                          wrote on last edited by
                                          #194

                                          @meanmrgreen See my post a few up, I'm seeing some weird effects when connecting to more than one plant..

                                          meanmrgreenM 1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          11

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.0k

                                          Posts


                                          Copyright 2019 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • MySensors
                                          • OpenHardware.io
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular