I have bought different seeds for the autumn, to be able to profit then in the winter time from delicious peppermint taste in the tea. In addition, still seeds of a fig tree, of which I can probably not be reaped so quickly.
The guide said that the earth was always to be kept moist: one more reason to subject the two plants to the electronic monitoring.
SchematicThe Particle Photon is plugged onto a mini-breadboard, the two humidity sensors from Asia are connected to A0 and A1 via SIGNAL and the OLE display shows the percentages converted in the display connected to:
// I2C wiring
#define BME_MOSI D0 // = SDA
#define BME_SCK D1 // = SCL
In addition, there is still an estimation whether the earth is completely ok or just need action in case of dryness. This is indicated by Blynk prima on the smartphone.
If you like, you can add a buzzer for an acoustic signaling or IFTTT as a signaling service in case of dryness.
Definitions#include <Adafruit_SSD1306.h> // This #include statement was automatically added by the Particle IDE.
#include <blynk.h> // This #include statement was automatically added by the Particle IDE.
#define soilMoisturePlant1 A0 // SIGNAL from Soil Moisture Sensor to INPUT A0 - Plant1: "Minze"
#define soilMoisturePlant2 A1 // SIGNAL from Soil Moisture Sensor to INPUT A1 - Plant2: "Feigenbaum"
String namePlant1 = "Minze"; // your name of the plants
String namePlant2 = "Feige";
const int threshold_plant1 = 80; // define when its DRY for Plant1
const int threshold_plant2 = 75; // define when its DRY for Plant2
int baudrate = 9600; // Serial Monitor
const int dry = 4095; // presents 100% in case of Spark Core or Particle Photon at A0/A1 if sensor is full dry and also 0 = full wet
int water1, water2; // set to global var
int value_water_Plant1, value_water_Plant2; // set to global var
unsigned long lastmillis = 0; // time for interation the loop
// I2C wiring
#define BME_MOSI D0 // = SDA
#define BME_SCK D1 // = SCL
Blynk PreparationThe integration of Blynk services is not explained.
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "<< your blynk code here >>";
// *********
WidgetLED led1(V5);
// *********
WidgetLED led2(V6);
Ths loop() is short: calls 2 functions to read and display the data.
void loop() {
Blynk.run();
// !!! http://docs.blynk.cc/#troubleshooting-flood-error
// no delays in loop - DO NEVER in LOOP!
if ((millis() - lastmillis) > 1000) {
lastmillis = millis();
readData();
displayData();
}
}
Read the dataConvert Raw value to percentage. This is a generic calculation, depending on raw values from 0 to 4095.
// step 1 - read the soil moisture Plant1
value_water_Plant1 = analogRead(soilMoisturePlant1);
water1 = ((int)((((double)value_water_Plant1/dry)*100.0)));
Display and interpret the dataI have no green thumb and so I have set thresholds quite according to my gut feeling in the definitions. These are checked here using IF/THEN/ELSE IF and corresponding indications are displayed on the display.
Interpretation-Table - Range 5V: 0 - 4095Example readings:
- 100 = 2% = wet
- 400 = 10% = wet
- 800 = 20% = OK
- 1000 = 24% = OK
- 1800 = 44% = OK
- 3000 = 73% = OK
- 4000 = 98% = dry
- 4095 = 100% = dry
Regarding the evaluation, I have been stalled briefly and turned to the Particle community: a short time later it was clear that I was a thought mistake. Important at this point is the use of AND and not OR to check the values.
// OLE Display init
display.setTextSize(2); // 1 = mini
display.setTextColor(WHITE);
display.setCursor(0,0);
display.clearDisplay();
// Plant1
if (water1 <= 30)
{
display.print(namePlant1);
display.print(": ");
display.print(water1);
display.print("%");
display.println(" > SWIM");
led1.on(); // on/off
led1.setValue(255); // brightness
Blynk.setProperty(V5, "color", "#12a3c7"); // blue
}
else if ((water1 > 30) && (water1 <= 80)) // && = AND
{
display.print(namePlant1);
display.print(": ");
display.print(water1);
display.print("%");
display.println(" > OK");
led1.on(); // on/off
led1.setValue(255); // brightness
Blynk.setProperty(V5, "color", "#12c727"); // green
}
else if ((water1 > threshold_plant1) && (water1 <= 100)) // && = AND
{
display.print(namePlant1);
display.print(": ");
display.print(water1);
display.print("%");
display.println(" > DRY");
led1.on(); // on/off
led1.setValue(255); // brightness
Blynk.setProperty(V5, "color", "#d3345c"); // red
}
else
{
display.println("cant read sensor A0!");
}
ConclusionsAs soon as the seed has risen, I will keep you informed of the development. I do not expect to come up so quickly with a development: I have only sown until 04.09.17.
Similar projects are recommended unter my account: also with Arduino and more comfortable with a Relay and water pump.
Like my description? You will find more under my account.
Follow me to be notified when I publish new projects!
Here is my Paypal link.
Update 15.09.2017Since the publication of the article several things have happened, in which I would like to let you participate:
a.) the good news: the first minz seedlings are already visible in the photo
b) the bad news: the sensors, only a few days old, have only detected unusable values > the sensors are simply corroded. What do we do as a hobbyist? We think of a solution of what ends with point c).
c) another good news: by using stainless steel wire I get no more corrosion
This stainless steel wire can not be soldered: therefore I use screw clamps to connect these with the standard jumper. I am ready to fit your order and send you a few. Please tell me the desired quantity and the desired length and your address together with a proof of payment at paypal.
d.) the last good news: I have provided an update that takes into account the threshold limits within the IF / ELSE query. Check version 1.1 out!
e.) Bonus: I have also installed a lower limit for the threshold and the IFTTT service in version 1.2 integrated.
With the bool value "firstfire" I can influence, in which case the IFTTT trigger triggered by the Particle Cloud via Particle. Publish and I would like to be informed. If you forget to install a check, IFTTT fires until the water has actually been watered. In my case I do not work with a time check, eg. after x minutes, but set the trigger by changing the sliders inside the Blynk app and, of course, also in the case of after-watering.
The thresholds can now be set using the slider to give the Blynk App more dynamics to the requirements of your plants. The OLE display I have thus made obsolete.
Comments