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.7k 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.
  • L Offline
    L Offline
    Lars65
    wrote on last edited by
    #5

    Is it possible to use more than one sensor? And if it is, how would the sketch look like?

    1 Reply Last reply
    0
    • mfalkviddM Offline
      mfalkviddM Offline
      mfalkvidd
      Mod
      wrote on last edited by
      #6

      @Lars65 Something like this should work with up to 4 sensors: https://codebender.cc/sketch:166639
      Note: I have not tested this sketch. Feedback is welcome.

      Connect the power for all sensors to pin 8 (note: if your sensors draw too much power, you might exceed the maximum rating of 40mA, measure how much current your sensors use before you connect too many)

      Connect the analog pin for the each of the sensors to A0, A1, A3 and A3 respectively.

      1 Reply Last reply
      0
      • L Offline
        L Offline
        Lars65
        wrote on last edited by
        #7

        Thanx!
        I will test this.
        :)

        1 Reply Last reply
        0
        • mfalkviddM Offline
          mfalkviddM Offline
          mfalkvidd
          Mod
          wrote on last edited by
          #8

          Great.
          Arduino Pro Mini has 6 analog pins, so you can use a maximum of 6 sensors. The Nano has 8 and the Micro 12.

          1 Reply Last reply
          0
          • mfalkviddM Offline
            mfalkviddM Offline
            mfalkvidd
            Mod
            wrote on last edited by
            #9

            btw, I had a bug in the code.

            for (int sensor = 0; sensor <= NUMBER_OF_SENSORS; sensor++) {
            

            needs to be changed to

            for (int sensor = 0; sensor < NUMBER_OF_SENSORS; sensor++) {
            

            I have updated the sketch, but if you copied the code before I did the change you'll need to update your code for the two for-loops.

            1 Reply Last reply
            0
            • L Offline
              L Offline
              Lars65
              wrote on last edited by
              #10

              Could it be possible to use different power pins? So if you have more than one senor you measure in a sequence?

              mfalkviddM 1 Reply Last reply
              0
              • L Lars65

                Could it be possible to use different power pins? So if you have more than one senor you measure in a sequence?

                mfalkviddM Offline
                mfalkviddM Offline
                mfalkvidd
                Mod
                wrote on last edited by
                #11

                @Lars65 Yes, absolutely.

                1 Reply Last reply
                0
                • L Offline
                  L Offline
                  Lars65
                  wrote on last edited by
                  #12

                  I know that I am a pain in the *ss. But I have tried to change this code to accept more than one power pin.
                  But I don't know how. I know how to mill a PCB, and lot of other stuff, but programming is not my cup of thee.
                  I really need to try to study how.
                  Bot for now, is it anybody who could help me?

                  1 Reply Last reply
                  0
                  • mfalkviddM Offline
                    mfalkviddM Offline
                    mfalkvidd
                    Mod
                    wrote on last edited by
                    #13

                    How much power do your sensors need? (How many sensors can use the same pin?)

                    1 Reply Last reply
                    0
                    • mfalkviddM Offline
                      mfalkviddM Offline
                      mfalkvidd
                      Mod
                      wrote on last edited by mfalkvidd
                      #14

                      This is a VERY quick and dirty solution. I'm off to the movies now. Let me know if it works :-)
                      https://codebender.cc/sketch:170297

                      Edit: have updated the sketch

                      1 Reply Last reply
                      0
                      • mfalkviddM Offline
                        mfalkviddM Offline
                        mfalkvidd
                        Mod
                        wrote on last edited by mfalkvidd
                        #15

                        @Lars65 Just a question before things get too crazy: Will you be running your node on battery power? If you will be using wall power you can just power all sensors continuously from Vcc and get rid of the code for turning on and off the sensors, and get rid of all the battery reporting code.

                        D 1 Reply Last reply
                        0
                        • L Offline
                          L Offline
                          Lars65
                          wrote on last edited by
                          #16

                          Hi!
                          At the moment do I only have three sensors, and I will be using them on the same arduino. Those will be powered by wall power.
                          But I have ordered some more sensors, and some of them will be battery powered.
                          Though both me and my wife often forget to water our plants, do I really like this.
                          I use Domoticz, and it's easy to get a notification when it's time to water.
                          You have been really helpfull. Tomorrow will I mill a new PCB, to test this code.
                          :)

                          1 Reply Last reply
                          0
                          • mfalkviddM mfalkvidd

                            @Lars65 Just a question before things get too crazy: Will you be running your node on battery power? If you will be using wall power you can just power all sensors continuously from Vcc and get rid of the code for turning on and off the sensors, and get rid of all the battery reporting code.

                            D Offline
                            D Offline
                            damien
                            wrote on last edited by damien
                            #17

                            Hi @mfalkvidd and thank you for your nice work and sketch.
                            I just have one question about the power pin, I saw on datasheet that the adruino pro mini can handle 40mA max per powerpin. I Have four of these soil moisture sensors but cant find how much current they need... they use a LM393, and the datasheet say 0.4mA..
                            Did you think than i coul plug all of them on the same powerpin or i need to use your second sketch ?
                            Thanks in advance !

                            1 Reply Last reply
                            0
                            • mfalkviddM Offline
                              mfalkviddM Offline
                              mfalkvidd
                              Mod
                              wrote on last edited by
                              #18

                              @damien: I don't know, unfortunately. Maybe @Lars65 can do a measurement on his moisture sensors?

                              D 1 Reply Last reply
                              0
                              • mfalkviddM mfalkvidd

                                @damien: I don't know, unfortunately. Maybe @Lars65 can do a measurement on his moisture sensors?

                                D Offline
                                D Offline
                                damien
                                wrote on last edited by
                                #19

                                @mfalkvidd Ok thanks for your reply, i will wait for @Lars65 to see if he has done the measurement, else i will do it by myself on mine when i receive them.
                                Thx

                                1 Reply Last reply
                                0
                                • L Offline
                                  L Offline
                                  Lars65
                                  wrote on last edited by
                                  #20

                                  Hi Guys!
                                  No I haven't made any measurements.

                                  { 4, 0, 1, // This assumes 2 sensors per pin. First two sensors are powered through pin 4, using analog pins 0 and 1
                                  **5, 2, 3, **// Second two sensors get power from pin 5 and are connected to analog pins 2 and 3
                                  6, 4, 5 // Third set of sensors get power from pin 6 and are connected to analog pins 4 and 5
                                  }
                                  So I did change 4,0,1, to 4,0,. What I saw with this was that I use power pin 4, to the analog input A0. So now have I made it so A0, has powerpin 4, A1 has powerpin 5, and A2 has powerpin 6.

                                  1 Reply Last reply
                                  0
                                  • mfalkviddM Offline
                                    mfalkviddM Offline
                                    mfalkvidd
                                    Mod
                                    wrote on last edited by mfalkvidd
                                    #21

                                    How did thinks go @Lars65 ?

                                    I thought a bit more about this problem and I think I have come up with a pretty neat solution:
                                    Throw away the chip on the moisture sensor and connect the "pitchfork" directly to the Arduino. Connect one prong to GND and one prong to an analog pin. No power pins are required.
                                    https://codebender.cc/sketch:177182
                                    The chip on the moisture sensor is basically a voltage divider. We get the same thing if we use the internal pull-up resistor on the Atmega processor.
                                    EDIT: This means you can buy just the "pitchforks" really cheap: http://www.aliexpress.com/item/10pcs-Soil-Hygrometer-Detection-Module-Soil-Moisture-Sensor-Probes/2051713873.html

                                    D Fat FlyF 2 Replies Last reply
                                    0
                                    • N Offline
                                      N Offline
                                      Nicklas Starkel
                                      wrote on last edited by
                                      #22

                                      @mfalkvidd , I think there has been many discussions on how these sensors corrodes over time.
                                      I can see that this node sleeps between the readings and thus reduces corrosion as it only is powered during reading.
                                      However, some threads I've read suggests that you alternate the power, as well, between readings.
                                      Something you might implement in the code?
                                      Also, do you have an estimate on the duration usage on the batteries for one of your plants?
                                      Cheers!

                                      1 Reply Last reply
                                      0
                                      • mfalkviddM Offline
                                        mfalkviddM Offline
                                        mfalkvidd
                                        Mod
                                        wrote on last edited by mfalkvidd
                                        #23

                                        @Nicklas-Starkel If a measurement is taken once per hour, the sensor will only have power 0,008% of the time.
                                        If corrosion still is a problem, and if the corrosion can be avoided by reversing polarity for every second measurement, I might add it. It would add complexity to the sketch though, and complexity is often the enemy of reliability.

                                        Also, for people wanting to use multiple sensors on the same mcu, reversing polarity would cut the possible number of connected moisture sensors in half since it would require two analog pins per sensor.

                                        My estimated battery time on 2xAA for a Mini Pro with removed power led and voltage regulator is 1-2 years.

                                        1 Reply Last reply
                                        0
                                        • mfalkviddM mfalkvidd

                                          How did thinks go @Lars65 ?

                                          I thought a bit more about this problem and I think I have come up with a pretty neat solution:
                                          Throw away the chip on the moisture sensor and connect the "pitchfork" directly to the Arduino. Connect one prong to GND and one prong to an analog pin. No power pins are required.
                                          https://codebender.cc/sketch:177182
                                          The chip on the moisture sensor is basically a voltage divider. We get the same thing if we use the internal pull-up resistor on the Atmega processor.
                                          EDIT: This means you can buy just the "pitchforks" really cheap: http://www.aliexpress.com/item/10pcs-Soil-Hygrometer-Detection-Module-Soil-Moisture-Sensor-Probes/2051713873.html

                                          D Offline
                                          D Offline
                                          damien
                                          wrote on last edited by
                                          #24

                                          @mfalkvidd said:

                                          How did thinks go @Lars65 ?

                                          I thought a bit more about this problem and I think I have come up with a pretty neat solution:
                                          Throw away the chip on the moisture sensor and connect the "pitchfork" directly to the Arduino. Connect one prong to GND and one prong to an analog pin. No power pins are required.
                                          https://codebender.cc/sketch:177182
                                          The chip on the moisture sensor is basically a voltage divider. We get the same thing if we use the internal pull-up resistor on the Atmega processor.

                                          Hi @mfalkvidd and thank you very very much for your new version of the skecth for moisture sensors, its very clever ! i will test it as soon as possible

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


                                          21

                                          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