BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Blynkroponics Controller


#1

My project has been in the making for just over a year now, and once I got it as far as I could (pre-Blynk), I hit a brick wall as I wanted so much for this project to be accessible over the web, the current options available were not what I was looking for, until I found Blynk!

Alas, I now have Blynk and have received ample help from the Blynk community to work out all the bugs that were in my code. I slimmed my sketch down so that it deals only with the data collection and conversions, and now my app has but 3 Widgets to receive all that data.

From Home Depot, I purchased a water tight utility box and morphed it into a project box to house my project. On its face is an American style male plug for AC voltage in. I also have 8 duplex AC outlets, each connected to a single channel of my 8 channel Sainsmart relay. As this is a hydroponics controller/greenhouse controller, AC devices can be power cycled in accordance with time kept on the in circuit DS3231 Chronodot RTC, or according to threshold values set against the DHT22 temp/humidity sensor readings.

My MCU is a Freetronics EtherMega (Arduino Mega and Ethernet shield combined). The RTC is an I2C device, and the DHT22 is connected to D13. I also went ahead and cut the RESET-EN trace and soldered some cat5 wire to the pads, and connected the other ends to terminal on a switch so that I can enable or disable this feature of Arduino. When using the serial monitor, the time kept on the RTC would otherwise reset and lose the current time. I also have another switch wired to the EtherMega’s power select header to switch between USB power and DC power. The DC power supply is fed via a Passive POE injector as shown in the pictures. This way, I can locate the project wherever, without needing to be near an AC outlet, plus it looks much cleaner.

I will add the pics, I took some months back, then post the slimmed down version of the code. In another code window, I will also post the other portions of the code that runs the program aside from what Blynk sees. I can later add 8 button widgets to also trigger relays in real time if I ever have need of overriding the programmed times. This is a work in progress and will definitely be getting updated as I accumulate more equipment in need of control, but at this moment, the project can be a stand alone room controller for an indoor garden or greenhouse.




      #include <SPI.h>
      #include <Ethernet.h>
      #include <BlynkSimpleEthernet.h>
      #include <Wire.h>                 
      #include "DHT.h"                    // DHT data wire connected to D13 with a 10k pullup resistor               
      #include <SimpleTimer.h>          
      #include "RTClib.h"                 // RealTimeClock Library for DS1307 and DS3231
      #define BLYNK_PRINT Serial
      #include <SPI.h>
    
//*******Sensor Model********************************    
      #define DHTTYPE DHT22
      #define DHTPIN 13 

      RTC_DS1307 RTC;
      float UTCOffset = -5.0;    // Your timezone relative to UTC (http://en.wikipedia.org/wiki/UTC_offset)

      char auth[] = "YourAuthKey";

      DHT dht(DHTPIN, DHTTYPE);
      byte h;  
      byte f;  
                
      SimpleTimer timer;
    
      WidgetLCD lcdA(V2);  //Set LCD widget Input to PUSH

    void setup() 
    {
      Serial.begin(9600);  
      //Serial2.begin() // For other baud rates
      //Serial3.begin() // For other baud rates          
      Blynk.begin(auth);
      pinMode(DHTPIN, OUTPUT);           
      dht.begin();

      RTC.adjust(DateTime(__DATE__, __TIME__)); 
      RTC.begin();   
     
      while (Blynk.connect() == false) {}

      timer.setInterval(5000L, climateCheck); // 5 second intervals between DHT readings
      timer.setInterval(3000L, RTCdisplay); // 3 second intervals between RTC readings
    }
      
    void loop() 
    {
      Blynk.run();
      timer.run();
    }
    
    void climateCheck()
    {
      h = dht.readHumidity();
      f = dht.readTemperature(true);

      Blynk.virtualWrite(V0, f);    //  Set Virtual Pin 0 frequency to PUSH in Blynk app
      Blynk.virtualWrite(V1, h);      //  Set Virtual Pin 1 frequency to PUSH in Blynk app
      //Serial.print(f);
      //Serial.print(h);
    }
    
    void RTCdisplay()  
    { 
      DateTime now = RTC.now();  // reads time at beginning of loop
  
      byte twelveHour = now.hour() - 12; // Variable used to display 13+ hours in 12 hour format
      byte zeroHour = 12;                // Variable use to convert "0" zero hour to display it as 12:00+
      byte displayHour;
      byte MIN = now.minute();
      byte SEC = now.second();
      char* meridian;
  
      if (now.hour() == 0)  // First we test if the hour reads "0"
    { 
      displayHour = zeroHour;
      meridian = "AM";         
    }
      else if (now.hour() >= 13)  // if no, Second we test if the hour reads "13 or more"
    { 
      displayHour = twelveHour;
      meridian = "PM";      
    }
      else 
    { 
      displayHour = now.hour();
      meridian = "AM"; 
    }
     
      char timeStamp[11];
      char dateStamp[11];
      sprintf(timeStamp, "%02d:%02d:%02d-%02s", displayHour, MIN, SEC, meridian);
      sprintf(dateStamp, "%02d/%02d/%04d", now.month(), now.day(), now.year());
      String ts;
      String ds;
      ts = timeStamp;
      ds = dateStamp;
       
      lcdA.clear();            //Advanced Mode
      lcdA.print(3, 0, ts);    //Advanced Mode
      lcdA.print(3, 1, ds);    //Advanced Mode
    
    }
   

and the redacted out code. Use good judgment when adding the following snippets back into the sketch.

#define TURN_ON 0 // TURN_ON and TURN_OFF are defined to account for Active High relays
#define TURN_OFF 1 // Used to switch relay states for on/off of AC devices

#define Relay_A  30  // relay 1 - Mega Pin 30  //  Lights
#define Relay_B  31  // relay 2 - Mega Pin 31  //  Feed Pump(s)
#define Relay_C  32  // relay 3 - Mega Pin 32  //  ------------
#define Relay_D  33  // relay 4 - Mega Pin 33  //  ------------
#define Relay_E  34  // relay 5 - Mega Pin 34  //  Exhaust Fan
#define Relay_F  35  // relay 6 - Mega Pin 35  //  Heater
#define Relay_G  37  // relay 7 - Mega Pin 36  //  Dehumidifier
#define Relay_H  36  // relay 8 - Mega Pin 37  //  ------------

// Sensor Declaration
#define DHTPIN 13     // DHT22 data - pin D13.  A 10k pullup resistor is used to connect data to +5V
#define DHTTYPE DHT22

//  DHT Reference Values - CHANGE THESE TO MANAGE YOUR ROOM'S CLIMATE - //
byte hiMaxTemp = 90;   // temp that triggers heat removal fan on
byte lowMaxTemp = 75;  // temp that triggers heat removal fan off 
byte hiMinTemp = 70;   // temp that triggers heater on
byte lowMinTemp = 60;  // temp that triggers heater off
byte hiHum = 75;       // High humidity value that triggers dehumidifier on
byte lowHum = 70;      // Low humidity value that triggers dehumidifier off
//=================================//
//---(Set pins 30-37 as outputs )----
  pinMode(Relay_A, OUTPUT);
  pinMode(Relay_B, OUTPUT);
  pinMode(Relay_C, OUTPUT);
  pinMode(Relay_D, OUTPUT);
  pinMode(Relay_E, OUTPUT);
  pinMode(Relay_F, OUTPUT);
  pinMode(Relay_G, OUTPUT);
  pinMode(Relay_H, OUTPUT);
  
  digitalWrite(Relay_A, TURN_OFF);  //  This ensures relays do not actuate until called upon
  digitalWrite(Relay_B, TURN_OFF);
  digitalWrite(Relay_C, TURN_OFF);
  digitalWrite(Relay_D, TURN_OFF);
  digitalWrite(Relay_E, TURN_OFF);
  digitalWrite(Relay_F, TURN_OFF);
  digitalWrite(Relay_G, TURN_OFF);
  digitalWrite(Relay_H, TURN_OFF);

  Wire.begin();
//=============================//
  //******************************************************************************************************//
  //***** Alarms for Relays A-D.  Adjust hours and minutes in accordance with 24 hour time format. *******//
  //***** Create tests where true is ON time and false is OFF time. **************************************//
  //***** 18/6 Light Cycle - RELAY_A *********************************************************************//
  
  boolean relayAstate = false;
  if (now.hour() >= 6) relayAstate = true; //  The test is true from 6-23, and false from 0-5 (18/6)
  if (relayAstate == true)
  { 
    digitalWrite(Relay_A, TURN_ON);
    Serial.print("\t");
    Serial.print(F("Vegetative Lights On"));  //  Text printed to serial monitor
    Serial.print("\t");
    Serial.println();
  }
  else
  {                                              
    digitalWrite(Relay_A, TURN_OFF);
    Serial.print("\t");
    Serial.println(F("Vegitative Lights OFf"));  //  Text printed to serial monitor
    Serial.print("\t");
    Serial.println();
  }
  //*********************************** FEED TIMEs - RELAY_B ******************************************//
  // By testing hour once and minute twice, we isolate the "on" time and the duration it is "on". *****//
  // If the Boolean becomes true, D31 is HIGH until Boolean becomes false again. **********************//
  boolean relayBstate = false;
  if (now.hour() == 9 && now.minute() >= 0 && now.minute() < 10) relayBstate = true;    //9:00 am - 10mins
  if (now.hour() == 15 && now.minute() >= 30 && now.minute() < 40) relayBstate = true;  //3:30 pm - 10mins
  if (now.hour() == 22 && now.minute() >= 30 && now.minute() < 33) relayBstate = true;  //10:30pm - 03mins
  if (relayBstate == true)
  {  
    digitalWrite(Relay_B, TURN_ON);
    Serial.print("\t");
    Serial.println(F("Feeding Plants"));  //  Text printed to serial monitor
    Serial.print("\t");
    Serial.println();  
}
  else
  {  
    digitalWrite(Relay_B, TURN_OFF);
  }
  //********************** Unassigned - RELAY_C *******************************//
  
  //********************** Unassigned - RELAY_D *******************************//

  //******************************** RELAYS E^F^G^H ****************************************//
  //******* Testing the DHT22 sensor temperature in Fahrenheit and humidity in Percent and *// 
  //******* actuating Relays based upon those values ***************************************//
  //****************************************************************************************//
delay (1500);

  h = dht.readHumidity();  // assigns humidity reading as "h"
  f = dht.readTemperature(true);  // assigns fahrenheit reading as "f"
  if (isnan(f) || isnan(h)) 
  {
    Serial.println("Failed to read from DHT");
  }
  else
  {
    float hi = dht.computeHeatIndex(f, h);
    Serial.print(F("Fahrenheit: "));
    Serial.print(f);
    Serial.println("*\t");
    Serial.print(F("Humidity: "));
    Serial.print(h);
    Serial.println("%\t");

  }
  delay(500);

  //   Tests temp & humidity to see if preset values are exceed.
  //   If exceeded, a relay is trigger high to power an exhaust fan or heater.
//**************************** REMOVING HEAT *************************************//
  if (f >= hiMaxTemp)  //if "f" is greater than or equal to hiMaxTemp,
  {
    digitalWrite(Relay_E, TURN_ON);  // TURN_ON relayE (fan).
    Serial.print("\t");
    Serial.println(F("Exhausting the heat!")); //  Text printed to serial monitor
    Serial.print("\t");
    Serial.println();
  }
  else if (f <= lowMaxTemp)  //  or else if "f" is less than or equal to lowMaxTemp
  {
    digitalWrite(Relay_E, TURN_OFF); //  TURN_OFF relay E.
  }
//****************************** ADDING HEAT *******************************//
  if (f <= lowMinTemp)   
  {
    digitalWrite(Relay_F, TURN_ON);  // (heater)
    Serial.print("\t");
    Serial.println(F("Warming the room!"));  
    Serial.print("\t");
    Serial.println();
  }
  else if(f >= hiMinTemp);
  {
    digitalWrite(Relay_F, TURN_OFF); 
  }
//**************************** REMOVING HUMIDITY *******************//
  if (h >= hiHum) 
  {
    digitalWrite(Relay_G, TURN_ON);  // (dehumidifier)
    Serial.print("\t");
    Serial.println(F("Drying the air!"));  
    Serial.print("\t");
    Serial.println();
  }
  else if (h <= lowHum)
  {
    digitalWrite(Relay_G, TURN_OFF);  
  }
}

Initially, my sketch was written to display text to the serial monitor. As I am yet to graft these snippets back in, I myself need to change the code to forward those texts over to Blynk to display as I had always intended to use my cell phone as my projects LCD, I just had no idea how that was going to happen, until I found Blynk.

Thanks to Pavel and team for bringing such a powerful tool to the Maker community!


How to make Blynk override programmed functions?
#2

looks great!

what’s your Blynk screen look like?

BTW - is that panel mount Ethernet port easy to find? i cant find them on eBay?


#3

Panel mount plates

They customize the plates to whatever you want. In hindsight, I wish I would have opted away from USB Type B and got Micro USB as those data cables are way more common. Inside the box, the Type B converts back to female USB, and the Ethermega’s data cable connects to it.

Edit - The upload option for some reason isn’t working right now so I am unable to upload the screenshot at this time. I will try again very soon, or tomorrow if I continue to fail.

Edit 2 - The bug was in my phone, fixed now.


#4

Hello, this is a really cool project. I am curious though, how (rather where), one would place the redacted snippets back into the code? Is that a simple copy and paste of various sections of code, back up into the original?


#5

My apologies, it’s been a few months since I played around with this or anything Arduino, and being a newb myself, it’s not second nature. Can you refine your question some and fill me in which snippets you refer to?


#6

I’ve added another DHT22 to the project and also included the lot of the project functionality code back into the sketch. Initially I ran into some problems with a conflict between the new library (0.4.4) and an older Blynk library. I had to erase the older Blynk library and downloaded and installed the blynk-library-master, and the app connected to the device quicker there after.


#7

Edit - Still trying to remember how to use the code brackets on this site.


#8
/*
 * This code is a functional hydroponics controller.  Sensors are measured, preset values are
 * executed and devices are turned on and off, but also some devices are on with modulated voltage 
 * for speed control.  The sensors are an internal clock (RTC), atmospheric temperature and humidity
 * sensors (DHT22) and the users smartphone (w/Blynk).  Water quality sensors are also on the wishlist,
 * but this will be added in later.  The example code is already written for these other circuits.  
 * For more info see; https://www.atlas-scientific.com/
 * The devices consist of lights, fans, dehumidifiers, water pumps, water valves and 
 * nutrient dosing pumps.  All of the sensors dictate the usage of each device and the program combined
 * with Blynk extends the gardener's capability in the garden exponentially!
 * */
#include <SPI.h>                    // Used by Blynk
#include <Ethernet.h>               // Used by Blynk
#include <BlynkSimpleEthernet.h>    // Used by Blynk
#include <Wire.h>                   // I2c
#include "DHT.h"                    // DHT data wire connected to I/O pin with a 10k pullup resistor to 5V               
#include <SimpleTimer.h>            // used to run functions at preset intervals
#include "RTClib.h"                 // RealTimeClock Library for DS1307 and DS3231

//  DHT Reference Values - CHANGE THESE TO MANAGE YOUR ROOM'S CLIMATE - //
byte hiMaxTemp = 90;   // temp that triggers heat removal fan on
byte lowMaxTemp = 75;  // temp that triggers heat removal fan off
byte hiMinTemp = 70;   // temp that triggers heater on
byte lowMinTemp = 60;  // temp that triggers heater off
byte hiHum = 75;       // High humidity value that triggers dehumidifier on
byte lowHum = 70;      // Low humidity value that triggers dehumidifier off

//Digital Pin Peristaltic Pump Dosing Heads - 00 Series Pins - PWM/12v motors
#define GHfloraGro 2          //Pump 1 - Primary Nutrient               -  nutePumps[0]
#define GHfloraMicro 3        //Pump 2 - Primary Nutrient               -  nutePumps[1]
#define GHfloraBloom 4        //Pump 3 - Primary Nutrient               -  nutePumps[2]
#define GHfloraBlend 5        //Pump 4 - Metabolic Supplement           -  nutePumps[3]
#define GHarmorSi 6           //Pump 5 - Silica Supplement (raises pH)  -  nutePumps[4]
#define GHcaliMagic 7         //Pump 6 - Calcium/Magnesium Supplement   -  nutePumps[5]
#define GHkoolBloom 8         //Pump 7 - Bloom Supplement               -  nutePumps[6]
#define GHphDown 9            //Pump 8 - pH Lowering Agent              -  nutePumps[7]
int nutePumps[8] {GHfloraGro, GHfloraMicro, GHfloraBloom, GHfloraBlend, GHarmorSi, GHcaliMagic, GHkoolBloom, GHphDown};

//Analong Pin Sensor Assignments - Analog Pins
//#define pH A0
//#define PPM A1
//#define waterTemp A2


#define lightA 22             //Relay 1/a  -  Relays[0]
#define lightB 23             //Relay 2/b  -  Relays[1]
#define pumpA 24              //Relay 3/c  -  Relays[2]
#define pumpB 25              //Relay 4/d  -  Relays[3]
#define ROpump 26             //Relay 5/e  -  Relays[4]
#define scrubberFan 27        //Relay 6/f  -  Relays[5]
#define heatVentA 28          //Relay 7/g  -  Relays[6]
#define heatVentB 29          //Relay 8/h  -  Relays[7]
int Relays[8] {lightA, lightB, pumpA, pumpB, ROpump, scrubberFan, heatVentA, heatVentB};
//Digital Pin Relay Assignments - 30 Series Pins - 120VAC~ switching
//#define 30                  //2nd bank of 8 relays
//#define 31
//#define 32
//#define 33
//#define 34
//#define 35
//#define 36
//#define 37
//int Relays2[8] {30, 31, 32, 33, 34, 35, 36, 37};

//Digital Pin Valves[] array elements - 40 Series Pins - Hi/Lo Solenoid Valves
#define source 40             //waterValve[0]
#define upperProbes 41        //waterValve[1]
#define upperNuteRail 42      //waterValve[2]
#define siteReturnA 43        //waterValve[3]
#define siteReturnB 44        //waterValve[4]
#define lowerProbes 45        //waterValve[5]
#define lowerNuteRail 46      //waterValve[6]
#define betweenRails 47       //waterValve[7]
#define waste 48              //waterValve[8]
#define mainAccessA 49        //waterValve[9]
#define feedPlantA 50         //waterValve[10]
#define mainAccessB 51        //waterValve[11]
#define feedPlantB 52         //waterValve[12]
int Valves[13] {source, upperProbes, upperNuteRail, siteReturnA, siteReturnB, lowerProbes, lowerNuteRail, betweenRails, waste, mainAccessA, feedPlantA, mainAccessB, feedPlantB};

#define TURN_ON LOW // TURN_ON and TURN_OFF are defined to account for Active High relays
#define TURN_OFF HIGH // Used to switch relay states for on/off of AC devices   

RTC_DS1307 RTC;
float UTCOffset = -5.0;    // Your timezone relative to UTC (http://en.wikipedia.org/wiki/UTC_offset)

#define BLYNK_PRINT Serial
char auth[] = "Your Auth Token Here";
WidgetLCD lcdA(V2);  //Set LCD widget to Advanced Mode - Widget to display project clock

DHT dhtA(A0, DHT22);     // DHT instance named dhtA, I/O pin and sensor type
DHT dhtB(A1, DHT22);     // DHT instance named dhtB, I/O pin and sensor type

SimpleTimer timer;       // SimpleTimer instance named timer

void setup()
{
  Serial.begin(9600);
  //Serial2.begin() // For other baud rates
  //Serial3.begin() // For other baud rates
  Blynk.begin(auth);
  dhtA.begin();
  dhtB.begin();
  Wire.begin(); 
  RTC.begin();
  RTC.adjust(DateTime(__DATE__, __TIME__));

  //pinMode(nutePumps[8], INPUT_PULLUP);
  //pinMode(Valves[13], INPUT_PULLUP);
  pinMode(Relays[8], INPUT_PULLUP);           // 
  pinMode(Relays[8], OUTPUT);
  pinMode(nutePumps[8], OUTPUT);
  pinMode(Valves[13], OUTPUT);
 
  while (Blynk.connect() == false) {}

  timer.setInterval(10000L, timeRoutine); // 10 second intervals between timed routiness
  timer.setInterval(11100L, climateRoutine); // 11.1 second intervals between climate routines
  //timer.setInterval(xxxxL, testResB);
  //timer.setInterval(xxxxL, testResA);
  //timer.setInterval(xxxxL, testResB);

  delay(2500);
}

void loop()
{
  Blynk.run();
  timer.run();
}

//Functions

void climateRoutine()
{
  byte h1 = dhtA.readHumidity();          // f1 and h1 are fahrenheit and humidity readings
  byte f1 = dhtA.readTemperature(true);   // from DHT/A
  byte h2 = dhtB.readHumidity();          // f2 and h2 are fahrenheit and humidity readings 
  byte f2 = dhtB.readTemperature(true);   // from DHT/B

  Blynk.virtualWrite(V0, f1);      //  Set Virtual Pin 0 frequency to PUSH in Blynk app
  Blynk.virtualWrite(V1, h1);      //  Set Virtual Pin 1 frequency to PUSH in Blynk app
  Blynk.virtualWrite(V3, f2);      //  Set Virtual Pin 2 frequency to PUSH in Blynk app
  Blynk.virtualWrite(V4, h2);      //  Set Virtual Pin 3 frequency to PUSH in Blynk app
  Serial.println(f1);
  Serial.println(h1);
  Serial.println(f2);
  Serial.println(h2);
  //   Tests temp & humidity to see if preset values are exceed.
  //   If exceeded, a relay is trigger high to power an exhaust fan or heater.
  //**************************** REMOVING HEAT *************************************//
  if (f1 >= hiMaxTemp)  //if "f1" is greater than or equal to hiMaxTemp,
  {
    digitalWrite(heatVentA, TURN_ON);  // TURN_ON heatVentA (fan).
    Serial.print("\t");
    Serial.println(F("Exhausting the heat from A")); //  Text printed to serial monitor
    Serial.print("\t");
    Serial.println();
  }
  else if (f1 <= lowMaxTemp)  //  or else if "f1" is less than or equal to lowMaxTemp
  {
    digitalWrite(heatVentA, TURN_OFF); //  TURN_OFF relay E.
  }
}

void timeRoutine()
{
  DateTime now = RTC.now();  // reads time at beginning of loop

  byte twelveHour = now.hour() - 12; // Variable used to display 13+ hours in 12 hour format
  byte zeroHour = 12;                // Variable use to convert "0" zero hour to display it as 12:00+
  byte displayHour;
  byte MIN = now.minute();
  byte SEC = now.second();
  char* meridian;

  if (now.hour() == 0)  // First we test if the hour reads "0"
  {
    displayHour = zeroHour;
    meridian = "AM";
  }
  else if (now.hour() >= 13)  // if no, Second we test if the hour reads "13 or more"
  {
    displayHour = twelveHour;
    meridian = "PM";
  }
  else
  {
    displayHour = now.hour();
    meridian = "AM";
  }

  char timeStamp[11];
  char dateStamp[11];
  sprintf(timeStamp, "%02d:%02d:%02d-%02s", displayHour, MIN, SEC, meridian);
  sprintf(dateStamp, "%02d/%02d/%04d", now.month(), now.day(), now.year());
  String ts;
  String ds;
  ts = timeStamp;
  ds = dateStamp;

  lcdA.clear();            //Advanced Mode
  lcdA.print(3, 0, ts);    //Advanced Mode
  lcdA.print(3, 1, ds);    //Advanced Mode
  Serial.println(ts);
  Serial.print(ds);

  //*************** 12/12 BloomA Light - 6AM-6PM**********************************//
  //***** Adjust hours and minutes in accordance with 24 hour time format. *******//
  //***** Create tests where true is ON time and false is OFF time. *************//
  boolean lightAstate = false;
  if (now.hour() >= 6 && now.hour() <= 17) lightAstate = true;
  if (lightAstate == true)
  {
    digitalWrite(lightA, TURN_ON);
    Serial.print("\t");
    Serial.print(F("Bloom A Light On"));  //  Text printed to serial monitor
    Serial.print("\t");
    Serial.println();
  }
  else
  {
    digitalWrite(lightA, TURN_OFF);
    Serial.print("\t");
    Serial.println(F("Bloom A Light OFf"));  //  Text printed to serial monitor
    Serial.print("\t");
    Serial.println();
  }
  //*************** 12/12 BloomB Light - 6PM-6AM**********************************//
  //***** Adjust hours and minutes in accordance with 24 hour time format. *******//
  //***** lightB is lit during the opposing 12 hours to lightA. *****************//
  boolean lightBstate = false;
  if (lightAstate == false) lightBstate = true;
  if (lightBstate == true)
  {
    digitalWrite(lightB, TURN_ON);
    Serial.print("\t");
    Serial.print(F("Bloom B Light On"));  //  Text printed to serial monitor
    Serial.print("\t");
    Serial.println();
  }
  else
  {
    digitalWrite(lightB, TURN_OFF);
    Serial.print("\t");
    Serial.println(F("Bloom B Light OFf"));  //  Text printed to serial monitor
    Serial.print("\t");
    Serial.println();
  }
  //*********************************** FEED TIMEs - pumpA ******************************************//
  // By testing hour once and minute twice, we isolate the "on" time and the duration it is "on". *****//
  // If the Boolean becomes true, D32 is HIGH until Boolean becomes false again. **********************//
  boolean pumpAstate = false;
  if (now.hour() == 9 && now.minute() >= 0 && now.minute() < 10) pumpAstate = true;    //9:00 am - 10mins
  if (now.hour() == 15 && now.minute() >= 30 && now.minute() < 40) pumpAstate = true;  //3:30 pm - 10mins
  if (now.hour() == 22 && now.minute() >= 30 && now.minute() < 33) pumpAstate = true;  //10:30pm - 03mins
  if (pumpAstate == true)
  {
    digitalWrite(pumpA, TURN_ON);
    Serial.print("\t");
    Serial.println(F("Feeding PlantA"));  //  Text printed to serial monitor
    Serial.print("\t");
    Serial.println();
  }
  else
  {
    digitalWrite(pumpA, TURN_OFF);
  }
  //*******************************Feed Times - pumpB *******************************************//
  boolean pumpBstate = false;
  if (now.hour() == 9 && now.minute() >= 0 && now.minute() < 10) pumpBstate = true;    //9:00 am - 10mins
  if (now.hour() == 15 && now.minute() >= 30 && now.minute() < 40) pumpBstate = true;  //3:30 pm - 10mins
  if (now.hour() == 22 && now.minute() >= 30 && now.minute() < 33) pumpBstate = true;  //10:30pm - 03mins
  if (pumpBstate == true)
  {
    digitalWrite(pumpB, TURN_ON);
    Serial.print("\t");
    Serial.println(F("Feeding PlantB"));  //  Text printed to serial monitor
    Serial.print("\t");
    Serial.println();
  }
  else
  {
    digitalWrite(pumpB, TURN_OFF);
  }
}

#9

Hi, How is it going?
I want to make similar project, can I copy and modify this project ?
Thanks in advance


#10

@beewee Hello. This is your 2nd post opening older topics and asking for info that you can deduce by simply looking at the provided code.

Go ahead and copy/paste whatever you see here in the forum… but if you do not have the know-how to break the code down for your needs and/or determine connections etc, then be prepared to do a lot of reading, searching and learning.

Be aware… we will assist as best able in teaching you about Blynk, but NOT teach you programming or do you modifications for you.

Once you gather your code and start building your project, please create a NEW topic of your own if you need assistance learning how Blynk works.