• Move to ESP8266

    BelgianTinker10/20/2020 at 20:14 0 comments

    Lights and Pump

    Nothing fancy here. The ESP is 3.3V logic and I had some issue using 5V relais, npn transistors and the digital outputs of the nodemcu. Probably my (lack of) soldering skillz are the issue but sometimes the connections were working, sometimes not. Next best thing: using two solid state relais, as you can see on the figure below.

    Hydroponics circuit
    Fig.1 - Nodemcu v2 with solid state relais.

    Software controlling the lamp and the pump is nothing fancy. The lamp is on for 9 hours and then off for 15. The pump is on for 10 minutes and off for 4 hours. No pump when the light is off. Since the ESP has not Real Time Clock, the micros() function is used and each minute I update a parameter to keep track of the time pased during each cycle.

    Web interface

    Wanting to be able to update the settings of the pump and the light remotely, and the reason why I am trying the ESP is for finding out what the Wifi module can do.
    The easiest way I found was using the ESP8266WebServer and the GET method. Programming the Web-page, of which the first version looks like this:

    Web layout
    Fig.2 - Web layout.

    Getting the information afterward is then easy, checking the content of the parameters attached to the html forms.

    if (server.arg("newLightOn") != "") {    String ipt1 = server.arg("newLightOn");    LightCycle_on = ipt1.toInt();    LightCycletime = (((LightStatus + 1) % 2) * LightCycle_off) + (((LightStatus) % 2) * LightCycle_on);  }

    The one thing I don't like the way the html page is built, writing it as one long string, which is not really clear and cumbersome to add css styling.

    Coming up next

    As you might already see in the first image I connected a BME sensor as well, and in the future I want to monitor the temperature and moister, so that I can update pump and light timings for instance.

    Remarks

    When resetting the ESP module I need to decouple one of the digital outputs for it to boot up correctly. Uh, if you have any idea why, please let me know.

    Not convinced about my settings for the Wifi. I am only able to connect to the module when I am close, and even then it is not consistent. Even though I want the ESP to connect to the avaiable Wifi another hotspot is still created that I can sometimes more easily connect to "esp8266". Could this be something lingering in the flash from a previous build?

    The code

    Below the full code of the project so far, feel free reach out if you have comments or remarks:

    #include <ESP8266WiFi.h>
    #include <WiFiClient.h>
    #include <ESP8266WiFiMulti.h>
    #include <ESP8266mDNS.h>
    #include <ESP8266WebServer.h>
    
    ESP8266WiFiMulti wifiMulti;   // Create an instance of the ESP8266WiFiMulti class, called 'wifiMulti'
    ESP8266WebServer server(80);  // Create a webserver object that listens for HTTP request on port 80
    void handleRoot();            // Function for HTTP handlers
    void handleNotFound();        // Function for HTTP handlers
    
    // Parameters for UV light controls
    int LightOutputPin = 0;                  // Pin on the ESP controlling the light
    int LightManual = 0;                     // Manually control state of the light
    int LightStatus = 0;                     // Current status of the light  int LightCycle_on  = 8 * 60;             // Minutes.
    int LightCycle_off = 16 * 60;            // Minutes.
    int LightCycletime = LightCycle_off;     // Cycle to start with
    int Light_minutes = 0;                   // Timer to keep track of the current cycle
    // Parameters for the nutrient pump
    int PumpOutputPin = 14;                  // Pin on the ESP controlling the pump
    int PumpManual = 0;                      // manually control state of the light
    int PumpStatus = 0;                      // Current status of the pump
    int PumpCycle_on = 10;                   // Minutes.
    int PumpCycle_off = 5 * 60;              // Minutes.
    int PumpCycletime = PumpCycle_off;       // Cycle to start with
    int Pump_minutes = 0;                    // Timer to keep track of the current cycle
    // Manual control active yes or no?
    int manualCtrl_active = 0;
    // timer for the micros() to keep track of the minutes
    unsigned long timer;
    // Visualizations for the site
    String ControlType[2] = {"automatic", "manual"};
    String activeState[2] = {"OFF", "ON"};
    
    void setup(void) { // Setting the initial...
    Read more »

  • Setting up a set-up

    BelgianTinker10/20/2020 at 20:11 0 comments

    Parts parts parts

    Starting things simple I wanted to try the concept and get a feel for the feasibility. This setup consists of one T-junction of 10mm diameter plastic piping, normally used for plumbing.
    Holding the plant (cauliflower) is a 3D printed part, partly filled with perlite. The plant itself is seeted in a little bit of earth. I first tried to germinate the seeds in continuously moist earth, in the setup, but that was not a success. Germinating in a little more dry earth worked much better.

    The figure below shows the small setup I have right now (yes I did say I wasn't going to use an Arduino, but I am still waiting on my nodemcu V2 esp8266 board). The lamp is a 25 W UV light used for terrariums and has the right spectral properties for growing plants (In the future I might move to LED's though). Everything is placed on a plastic container that holds the nutrient.

    Test setup hydroponics
    Fig.1 - Single plant setup for hydroponics tryout.

    Not the intended ebb and flow method either. The valve I bought needs a delta pressure of 0.8 bars so nothing dripped trough on this very small usecase. So now, the pump is activated every thirty minutes for 5 seconds. When moving to the esp module I want to be able to remotely change the timings for both the pump and the light. More on that next time.

    'Hydraulics'

    As mentioned before, the part I used has been 3D printed. The part has been printed in two pieces (so it is 2 parts?) in PLA. Not the ideal material, but it is what was available, we'll see how long it lasts.

    3D printed plant holder
    Fig.2 - 3D printed plant holder.

    I started out with a 6 V pump, which could then easily be actuated from the same supply as the controller. In the top of the plant holder I placed a ring of tubing with holes to evenly distribute the nutrient arount the plant base.

    However, the holes were too small, or not enough of them, causing too much resistance of the pump and after three days I had to say goodbye.

    Killer of pumps
    Fig.3 - Deathring, killer of pumps.

    With my sights set on the future, I removed the ring, and replaced the pump with a more powerfull aquarium pump. This seems to be a better fit and should be able to stay with me when upgrading to a bigger 'farm'.

  • Project introduction

    BelgianTinker10/20/2020 at 20:11 0 comments

    Intro

    Groing plants hydroponically is basically without using soil. The roots of the plants are being exposed to a nutrient, which is a water based fluid that contains all the food the plant is going to need.
    The benefit is that this way plants can be grown in more severe environents and even indoors. Another benfit is a drastic decrease in the amount of water needed for cultivating a plant and 'faster' groing times, since the plant does not need to invest as much energy to cultivating the root system.

    There are a lot of different types of hydroponic farming, and the type that speaks to me the most is the ebb and flood type. A crude sketch of what I am imagining:

    Mechanism bell
    Fig.1 - Crude sketch of a possible hydroponic system.

    What I think I need

    • 10 cm tube: To keep the plants and pass through the nutrient. The plan is to start with a single T-junction to use as a setup for my proof of concept.
    • pump: To flush the nutrient through the tube.
    • Hose tail: One or two to drain and fill the pipe with nutrient.
    • Hoses: To connect everything.
    • UV light: Shall provide natural light, in case I want to grow the plants in my basement or winter times.
    • Controller: For controlling the pump, valve and the light cycle. Looking forward to try something else than an Arduino, I'll opt to use an ESP8266 controller board.
    • Relais: 1-3 pending on the type of pump, valve and lights.
    • Net cup: for growing the medium in, still thinking about what would be the better medium.
    • Ph tester: For optimal intake of nutrients, the fluid should have a Ph between 5.5 and 6.5.
    • Vent: To provide a breeze, removing the moisture from the leaves to avoid fungi. Thinking about it, this shall only be a lesser priority.