Office plant monitoring
-
I work as development team lead at a software company. We do server and network monitoring. Yesterday we hosted a customer event, and I presented my houseplant monitoring project based on MySensors and Domoticz. The presentation was a hit, and it has been decided that we'll use MySensors to monitor all plants at the office.
There is not that much to tell from a technical perspective. I hooked up everything according to the MySensor build page and created a simple sketch.
Thanks to everyone from the MySensors community for a great library, clear instructions and great suggestions for projects. And thanks for making me look like a hero :-D Let's continue conquering the world.
@mfalkvidd Great project. Had few questions...Is it OK to provide 6V to Arduio Mini ? Can you show /explain how you have provided power supply to Mini and Moisture Controller ? In the set up you have , how long does the battery last ?
Thanks
-
@mfalkvidd Great project. Had few questions...Is it OK to provide 6V to Arduio Mini ? Can you show /explain how you have provided power supply to Mini and Moisture Controller ? In the set up you have , how long does the battery last ?
Thanks
6V is OK if you connect power on the "raw" pin. 6V is NOT OK if you connect power to the Vcc pin.
I use 2xAA batteries. - on the battery holder is connected to GND on the Arduino and + on the battery holder to Vcc. Power led and voltage regulator have been removed.
My sensors report every two hours and I expect to get 1-2 years battery life.
-
Just built this sensor and it is working great. However I am seeing different results with every run. It seems as if the value is always higher with one polarity than with the other one. Is this normal?

-
Just built this sensor and it is working great. However I am seeing different results with every run. It seems as if the value is always higher with one polarity than with the other one. Is this normal?

@Jan-Gatzke yes I'm seeing that as well. The built-in pullup resistors are not 100% accurate, which yields slightly different result when polarity is reversed.
The easiest way is probably to let the Arduino report a rolling average of the last 2 readings instead of reporting the latest reading.


-
@mfalkvidd I was looking to your sketch and could not quite understand this piece of line
result = 1125300L / result; // Calculate Vcc (in mV); 1125300 = 1.110231000
How will this above line change if I use 4 AA battery ?.
Thanks in advance
-
If you use 4xAA and wire power to Vcc you will break the nrf and the mcu. They are not rated for that high voltage.
If you wire power to Raw you can not use readVcc, you'll have to use a voltage divider to one of the pins.
Is there a reason you want to use 4xAA?
-
If you use 4xAA and wire power to Vcc you will break the nrf and the mcu. They are not rated for that high voltage.
If you wire power to Raw you can not use readVcc, you'll have to use a voltage divider to one of the pins.
Is there a reason you want to use 4xAA?
@mfalkvidd Yes I am connecting to RAW input. My 4 battery holder for some reason does not work with 2 or 3 batteries so connecting 6V to RAW.
"...you'll have to use a voltage divider to one of the pins..." Can you elaborate this part ? Can you share a link which wherein Arduino Pro Mini is powered through RAW input and battery percentage is calculated. I very new to hardware but loving the mysensors projects. Kindly bear with my stupid questions.
Appreciate your patience..
-
@mfalkvidd Yes I am connecting to RAW input. My 4 battery holder for some reason does not work with 2 or 3 batteries so connecting 6V to RAW.
"...you'll have to use a voltage divider to one of the pins..." Can you elaborate this part ? Can you share a link which wherein Arduino Pro Mini is powered through RAW input and battery percentage is calculated. I very new to hardware but loving the mysensors projects. Kindly bear with my stupid questions.
Appreciate your patience..
-
That's correct. The Arduino cannot measure voltages above it's Vcc level.
Great that you found information on voltage dividers.
Powering on Raw will keep the voltage regulator active all the time, so you might get worse batttery life than when using 2xAA on Vcc. Therefore I suggest you order a 2xAA battery holder for later use. In the meanwhile, you can make your 4xAA holder work by putting two wires instead of batteries in the unused slots.
If you still want to use 4 batteries, http://www.mysensors.org/build/battery#measuring-and-reporting-battery-level has more details and code to use for battery measurement.
-
Just built this sensor and it is working great. However I am seeing different results with every run. It seems as if the value is always higher with one polarity than with the other one. Is this normal?

@Jan-Gatzke I have updated my skech on codebender to report rolling average. I have not tested it yet though.
The change is available at https://github.com/mfalkvidd/arduino-plantmoisture/commit/5e98c5e625075d62ae27956ab8dc3ea9dec4a29e -
@Jan-Gatzke I have updated my skech on codebender to report rolling average. I have not tested it yet though.
The change is available at https://github.com/mfalkvidd/arduino-plantmoisture/commit/5e98c5e625075d62ae27956ab8dc3ea9dec4a29e@mfalkvidd At the moment I am testing a modified version of the sketch which always does two readings. I don't think this will have a big impact on the battery life because most power is consumend by the nrf and not by the sensor. Or am I wrong? The pullups are rated at 10k Ohm. The sensors resistance will be about the same in average. So we talk about 20k at 3V which is 0.15 mA. The nrf uses abot 15 mA when sending.
-
Hi.
I have been trying to connect two sensors to the same arduino nano using this code and i have add sensor 1 pin to A0 and GND, and sensor 2 pin A1 and GND.
But i only get the reads from sensor 1 sensor 2 doesn't appear...
Can anyone help me with this on how to get more than one moisture sensor working.Thanks.
-
Hi.
I have been trying to connect two sensors to the same arduino nano using this code and i have add sensor 1 pin to A0 and GND, and sensor 2 pin A1 and GND.
But i only get the reads from sensor 1 sensor 2 doesn't appear...
Can anyone help me with this on how to get more than one moisture sensor working.Thanks.
@mrc-core there have been quite a few revisions of the sketch. The latest version (which can be found at github) only support one sensor, which is connected to A0 and A1 in the default configuration. Both pins are required to enable alternating the direction of the current when measuring, to try to minimize corrosion.
Adding support for up to three sensors is technically possible (using A0-A5), but would make the code harder to read and since I have no use for multiple sensor I haven't spent the time required to program and test a sketch with multiple sensors.
-
An update on battery life: The sensor in my bonsai tree has been reporting every 11,5 minutes since 2015-11-07, so over the last ~four months it has done 24,504 measurements. The battery level has gone from 3.187V to 3.142V, which means a drop of 0.01125V per month. Assuming I let it go down to 2.34V (limit for 8MHz according to the datasheet) and that the voltage drop is linear, I should get (3.187-2.34)/0.01125 = 75 months = ~6 years. There are several error sources in this calculation, but it looks like battery life will be quite good, even though the sensor reports much more often than necessary.

-
@mrc-core there have been quite a few revisions of the sketch. The latest version (which can be found at github) only support one sensor, which is connected to A0 and A1 in the default configuration. Both pins are required to enable alternating the direction of the current when measuring, to try to minimize corrosion.
Adding support for up to three sensors is technically possible (using A0-A5), but would make the code harder to read and since I have no use for multiple sensor I haven't spent the time required to program and test a sketch with multiple sensors.
@mfalkvidd Thanks for the replay.
Will use only one sensor per arduino.Once again thanks
-
An update on battery life: The sensor in my bonsai tree has been reporting every 11,5 minutes since 2015-11-07, so over the last ~four months it has done 24,504 measurements. The battery level has gone from 3.187V to 3.142V, which means a drop of 0.01125V per month. Assuming I let it go down to 2.34V (limit for 8MHz according to the datasheet) and that the voltage drop is linear, I should get (3.187-2.34)/0.01125 = 75 months = ~6 years. There are several error sources in this calculation, but it looks like battery life will be quite good, even though the sensor reports much more often than necessary.

@mfalkvidd since you are using 2 AA battery(3V max) with a sensor , how are you powering the sensors ? What sensors are you using ?.Most of the sensors need 5V right ? how are you providing the required voltage for sensor ?. If possible can you share a circuit diagram or close up picture for your sensor node with connection to NRF , Sensor and battery ?
Appreciate it .
-
@mfalkvidd since you are using 2 AA battery(3V max) with a sensor , how are you powering the sensors ? What sensors are you using ?.Most of the sensors need 5V right ? how are you providing the required voltage for sensor ?. If possible can you share a circuit diagram or close up picture for your sensor node with connection to NRF , Sensor and battery ?
Appreciate it .