Coop Door Code, Tortillas, Mud Sanding, Cleaning, PDC, Man Utd Suck, Potato Garden - Thursday

in #hive-1143089 months ago

I was out at the coop again yesterday morning to watch the door open. I stood and took video while it turned over to 8am and I watched it just sit there. Then when the time hit 8:01 the latch unlocked and the door opened. It turned out that one of the lines of code had caused it to wait the extra minute. I had it checking if the open time was NOT the close hour and minute but the open minute is the same as the close, zero. So it was waiting past that first minute. I removed that line and it works correct now.

IMG_20240404_075847.jpg

J made a batch of tortillas while I was working on the coop door. He got these SUPER thick and really soft. He doesn't use the pea protein powder so they are the plain original recipe but super tasty.

IMG_20240404_101150.jpg

I have the coop Arduino serving a local webpage that I can pull up in the house. I have a few more things added in that I need to upload to the Arduino which will add to the webpage. My goal is to have my Pi zero with e-ink hat displaying this page for me. I may try to build something like a light set as well that will be on the wall and be an open/closed display for the door. Ideas for the future. The code is at the end of the post if you have any care at all about it.

I have another R4 WiFi on the way as I have a bunch of other projects in mind for around the farm. Also getting more sensor shields and 20x4 LCD displays. I've been wanting to build a setup for the greenhouse and now with the coop experience feel a lot better about diving into it. Just need some parts.

Screenshot 2024-04-04 at 10-22-21 Screenshot.png

Mid morning I was out in the studio working on the mud. It was all dry and I took the blocks to the wall and got the mud all smoothed out and looking much better.

IMG_20240404_105028.jpg

I vacuumed up all the powder from the floor and gave the wall a good once over.

IMG_20240404_105751.jpg

Quite the difference from the porous brick fireplace that had been there.

IMG_20240404_105815.jpg
IMG_20240404_105822.jpg

I moved the stand back in front of the wall and then worked to clean more in the room. It ended up giving a nice amount of space for the rower. I also organized in the other room to make room to get the treadmill in.

IMG_20240404_111048.jpg

Before noon the PDC night 10 came on which had a number of good matches and a 9 darter thrown by Price.

IMG_20240404_114137.jpg

At noon Man Utd came on so I put both on together. It was such a shit game and Utd are done fore the season at this point. They don't have the talent to get them into the Champions league next year and they are very likely to lose ETH despite his begging to be kept aboard. They pulled the standard card and blew the game in extra time. It's like they are doing it on purpose. Luke Littler ended up winning his 2nd night in a row and is nearly in the lead.

IMG_20240404_122023.jpg

The potato garden needed to be finished so I dug through all the plastic I had piled by it and managed to come up with the right amount to cover. First I had to shorten the end leg of the irrigation so that the line would fit the spacing of the holes in the plastic.

IMG_20240404_150730.jpg

Then all the various pieces got laid down then weighted down with rocks. One of the things about the farm is that we are NEVER at a loss for rocks.

IMG_20240404_152354.jpg

The fence went up after the posts got pounded in. The potatoes in the basement have some rather long tendrils on them and we still have a good amount so this spot will get packed full in the next days. I'm also looking to probably put a bunch in the upper garden at the neighbor's where I normally grow squash. I want less work this year and to grow things that I am only picking once, like potatoes.

IMG_20240404_153919.jpg

I put on the Capital's game and Ovi got another goal. They lost bad but he still is plugging away at the goal of surpassing Gretzky. I made dinner, threw darts, then we headed out to soak.

IMG_20240404_202926.jpg

Today it is raining but mostly to the south of us so shouldn't be a problem and tx fees are rock bottom so move your sats people. I have to fiddle with the pin on the coop door latch to try and get it to seat fully on close, gardens need tilling, seeds need planting, potatoes need planting, code needs uploading, fire needs starting, burgers need grilling, and sats need stacking.

Here is the code for the door if anyone cares.

// Fleming Family Farm Chicken Coop Door opener. 
//April to October the door opens at 7am and closes after 8pm based on light level
//October to April the door opens at 8am and closes after 5pm based on light level
// TESTING CODE LABELED WITH: <---------------
//-------------------------------------------------------------------//

//Libraries included
#include <Servo.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <DHT.h>
#include "AccelStepper.h"
#include <RTClib.h>
#include "WiFiS3.h"
#include "arduino_secrets.h" 

//Definitions
#define DHT11_PIN 7
#define DHTTYPE DHT11
#define motorInterfaceType 1
#define dirPin 4
#define stepPin 3
#define enPin 2
#define BUTTON_PIN 10

//Pins used: 2,3,4,7,9,10,A0,SDA/SCL

//Constants/Variables
const int pResistor = A0;     // Photoresistor at Arduino analog pin A0
int DOOR_OPEN_HH = 7;   // event start time: hour
const int DOOR_OPEN_MM = 00;  // event start time: minute
int DOOR_CLOSE_HH = 20;  // event start time: hour 20
const int DOOR_CLOSE_MM = 00;  // event start time: minute 00
const int stepsPerRevolution = 200;

//Object creation
RTC_DS3231 rtc;
DHT DHT11_Sensor(DHT11_PIN, DHTTYPE);
LiquidCrystal_I2C MyLCD(0x3F, 20, 4);  // Creates I2C LCD Object With (Address=0x3F, Cols=20, Rows=4)
AccelStepper stepper = AccelStepper(motorInterfaceType, stepPin, dirPin, enPin);
Servo myservo;  // create servo object to control a servo
WiFiServer server(80);

//Variables
int light;       // Store value from photoresistor (0-1023)
int servo1;      // servo
int pos;         // Servo position
int door_state;  // Door open or closed
float DHT11_TempF; //Declaration needed to display on webpage
float DHT11_Humidity; //Same as above
int status = WL_IDLE_STATUS;
char ssid[] = SECRET_SSID;        // network SSID (name)
char pass[] = SECRET_PASS;    // network password 


void setup() {
// Object initiation  
  Serial.begin(115200);
  rtc.begin();
  DHT11_Sensor.begin();
  MyLCD.init();

// Set stepper motor speed
  stepper.setMaxSpeed(3000);
  stepper.setAcceleration(500);

// Declare pins as output:
  pinMode(BUTTON_PIN, INPUT_PULLUP);  // bypass button
  pinMode(stepPin, OUTPUT);           // motor driver
  pinMode(dirPin, OUTPUT);            // motor driver
  pinMode(enPin, OUTPUT);             // motor driver
  pinMode(pResistor, INPUT);          // Set pResistor - A0 pin as an input

// Connect to WPA/WPA2 WIFI network.
  status = WiFi.begin(ssid, pass);
  // wait 5 seconds for connection:
  delay(5000);
  server.begin();

// RTC TIME SECTION - use this if the RTC battery dies and power dies

  //automatically sets the RTC to the date & time on PC this sketch was compiled
   //rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));

  // manually sets the RTC with an explicit date & time, for example to set
  // January 21, 2021 at 3am you would call:
 // rtc.adjust(DateTime(2024, 3, 27, 7, 59, 50));  // For testing <---------------
}

void loop() {
  DateTime now = rtc.now();
  light = analogRead(pResistor);
   
//Temp & Humidity section
  float DHT11_Humidity = DHT11_Sensor.readHumidity();
  float DHT11_TempC = DHT11_Sensor.readTemperature();      // Read Temperature(°C)
  float DHT11_TempF = DHT11_Sensor.readTemperature(true);  // Read Temperature(°F)
 
// Webpage Server Section  
  WiFiClient client = server.available();   // listen for incoming clients

  if (client) {                             // if you get a client,
    Serial.println("new client");           // print a message out the serial port
    String currentLine = "";                // make a String to hold incoming data from the client
    while (client.connected()) {            // loop while the client's connected
      if (client.available()) {             // if there's bytes to read from the client,
        char c = client.read();             // read a byte, then
        Serial.write(c);                    // print it out to the serial monitor
        if (c == '\n') {                    // if the byte is a newline character

          // if the current line is blank, you got two newline characters in a row.
          // that's the end of the client HTTP request, so send a response:
          if (currentLine.length() == 0) {
            // HTTP headers always start with a response code (e.g. HTTP/1.1 200 OK)
            // and a content-type so the client knows what's coming, then a blank line:
            client.println("HTTP/1.1 200 OK");
            client.println("Content-type:text/html");
            client.println();
            client.println("<!DOCTYPE HTML>");
            client.println("<html>");
            client.println();
            client.print("<div style=\"font-size:4em; text-align: center\">Fleming Family Farm Chicken Coop");
            client.println("<br />");
            client.print(now.month(), DEC);
            client.print('/');
            client.print(now.day(), DEC);
            client.print('/');
            client.print(now.year(), DEC);
            client.print(" ");
            client.print(now.hour(), DEC);
            client.print(':');
            client.print(now.minute(), DEC);
            client.println("<br />");
            client.print("THE DOOR OPENING TIME IS: ");
            client.print(DOOR_OPEN_HH);
            client.print(':');
            client.print(DOOR_OPEN_MM);
            client.println("<br />");
            client.print("THE DOOR CLOSING TIME IS: ");
            client.print(DOOR_CLOSE_HH);
            client.print(':');
            client.print(DOOR_CLOSE_MM);
            client.println("<br />");
            client.println("<br />");
            // output the state of the door
          if (door_state == 0) {
            client.print("THE DOOR IS CLOSED");
            } 
          else if (door_state == 1) {
            client.print("THE DOOR IS OPEN & UNLOCKED");
            }
          else if(door_state == 2){
            client.print("THE DOOR IS CLOSED & LOCKED");
            } 
            client.println("<br />");
            client.println("<br />");
            client.print("The Temperature is:  ");
            client.print(DHT11_TempF);
            client.print(" F");
            client.println("<br />");
            client.print("The Humidity is:  ");
            client.print(DHT11_Humidity);
            client.print(" %");
            client.println("<br />");
            client.print("The Light Level is:  ");
            client.print(light);
            client.print("   (0 = Light to 1023 = Dark)");
            client.println("<br />");
            IPAddress ip = WiFi.localIP();
            client.print("IP Address: ");
            client.println(ip);    

            client.println("</div></html>");
          break;
            } else {    // if you got a newline, then clear currentLine:
            currentLine = "";
          }
        } else if (c != '\r') {  // if you got anything else but a carriage return character,
          currentLine += c;      // add it to the end of the currentLine
        }
      }
    }
    // close the connection:
    client.stop();
    }

//COOP DOOR OPENING SECTION

  // The door opens at the DOOR_OPEN_HR and MM when the light is brighter than the 600 reading and not closing time
  if (now.hour() >= DOOR_OPEN_HH && 
       now.minute() >= DOOR_OPEN_MM &&
        now.hour() != DOOR_CLOSE_HH && //comment for testing <---------------
         light <= 600) {
    //This unlocks latch to allow door to open and holds it open until after the door closes at night
    myservo.attach(9);
    myservo.write(180);  // tell servo to go to position 180
    delay(2000);
    servo1 = 1;
    myservo.detach();

  //This opens the door and holds it open until close time
    digitalWrite(dirPin, LOW);  // Set the target position:
    stepper.moveTo(-51000); // = 8 rotations of shaft - Final position for open door <---------------
    //stepper.moveTo(2000);     // Test - comment for normal operation <---------------
    stepper.runToPosition();  // Run to target position with set speed and acceleration/deceleration:
    door_state = 1;           //Sets door_state to 1 which = open
  }

// COOP DOOR CLOSING SECTION

  // the door closes when the time reaches the DOOR_CLOSE_HR and MM and the light is above the 600 reading
  if (  now.hour() >= DOOR_CLOSE_HH && //<---------------
         now.minute() >= DOOR_CLOSE_MM && //<---------------
          light >= 600) {
    digitalWrite(dirPin, HIGH); // Sets motor direction
    stepper.moveTo(0);        // Set the target position:
    stepper.runToPosition();  // Run to target position with set speed and acceleration/deceleration:
    door_state = 0;           //Sets door_state to 0 which = closed
    myservo.attach(9);        // attaches the servo on pin 9 to the servo object so servo resets after closing each night
    delay(1000);

  //This returns latch to closed position after door has closed
    myservo.write(90);  // Tell servo to go to position 90
    door_state = 2;     // Door Closed and Locked
    delay(15);  
    myservo.detach();
     
  }

// BYPASS BUTTON SECTION

  byte buttonState = digitalRead(BUTTON_PIN);

  if (buttonState == LOW)  // if button is pressed open latch
  {
    //This unlocks latch for 2 seconds to allow door to open manually
    myservo.attach(9);
    myservo.write(180);  // tell servo to go to position 180
    delay(2000);
    myservo.detach();
    }

// LCD DISPLAY SECTION

  MyLCD.backlight();
  MyLCD.setCursor(0, 0);
  MyLCD.print(now.month(), DEC);
  MyLCD.print('/');
  MyLCD.print(now.day(), DEC);
  MyLCD.print('/');
  MyLCD.print(now.year(), DEC);
  MyLCD.print(" ");
  MyLCD.print(now.hour(), DEC);
  MyLCD.print(':');
  MyLCD.print(now.minute(), DEC);
  MyLCD.print(':');
  MyLCD.println(now.second(), DEC);
  MyLCD.print(" ");
  MyLCD.setCursor(0, 1);
  MyLCD.print(DHT11_TempF);
  MyLCD.print(" F   ");
  MyLCD.print(DHT11_Humidity);
  MyLCD.print(" %");
  MyLCD.setCursor(0, 2);
  MyLCD.print("Light ");
  MyLCD.print(light);
  MyLCD.print("  (0-1023)");

  if (door_state == 0) {
    MyLCD.setCursor(0, 3);
    MyLCD.print("DOOR CLOSED");
  } 
  if (door_state == 1) {
    MyLCD.setCursor(0, 3);
    MyLCD.print("DOOR OPEN & UNLOCKED");
    }
  if (door_state == 2){
  MyLCD.setCursor(0, 3);
    MyLCD.print("DOOR CLOSED & LOCKED");
}

//Automatically set the door open and close time based on the month of the year
//April to October the door opens at 7am and closes after 8pm based on light level
//October to April the door opens at 8am and closes after 5pm based on light level
if (now.month(), DEC >= 4 &&
     now.month(), DEC <= 10){
  int DOOR_OPEN_HH = 7; 
}
else if (now.month() <= 4 && 
          now.month() >= 10) {
  int DOOR_OPEN_HH = 8; 
}
if (now.month(), DEC >= 4 &&
     now.month(), DEC <= 10){
  int DOOR_CLOSE_HH = 20; 
}
else if (now.month() <= 4 && 
          now.month() >= 10) {
  int DOOR_CLOSE_HH = 17; 
}
}





2024 Y/E Hive GoalsGoalCurrent+/- Goal+/Week
HP30,00025,036+259112
HBD Savings4,0302,722/18
Hive Posting Streak Days16811411/6


300x600-2
^Affiliate/Referral Link^


For more information about our farm:
Fleming Family Farm
FLEMING FAMILY FARM, LLC
Sustainable & Organic Methods | Heirloom Produce
All images are original works of Fleming Family Farm unless otherwise notated and credited.

If you find this post useful or entertaining, your support is greatly appreciated by upvoting, following, and sharing!

You can Also Find Me On:

nostr icon.jpg

Donations or Tips



Zap Me ⚡️ Alby Addy.JPG btc.jpg Sparrow.JPG LBTC LBTC.jpg

!

Veteran.jpg


FFF Runic.png

Sort:  

PIZZA!

$PIZZA slices delivered:
@generikat(1/15) tipped @flemingfarm

I absolutely adore things that I only have to harvest once! There's a bunch of potatoes sitting in my laundry room that I gotta get planted here soon, and I am most curious what your yields are planting them in the plastic? I've grown potatoes in a myriad of different ways but as of yet haven't plunked them into the ground covered with plastic so I am super curious about your method?!

!PIZZA

Last year I got 488 pounds from six 50ft rows all under plastic. They do quite well and seem to produce good. It's just automatic for me to plant under plastic anymore so never thought to do anything else. I probably still have well over 150 pounds left in the basement which I only need to take the tendrils off to plant if I want.

https://inleo.io/threads/flemingfarm/re-leothreads-dem7kk2s
The rewards earned on this comment will go directly to the people ( flemingfarm ) sharing the post on LeoThreads,LikeTu,dBuzz.

Your pancakes are really fresh
I love how you made them