Waivio

Recommended Posts

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

6 comments

flemingfarm16.4 K8 months agoPeakD12 min read

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.

https://files.peakd.com/file/peakd-hive/flemingfarm/23uQvfCeL7f1Sqkb6nd9qt57kxc7vTkAYDnkVqp4hup3qkXzyP4patEGBS6JdBF1DsJST.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.

https://files.peakd.com/file/peakd-hive/flemingfarm/23tbwZjN2XcTb4uYZAJeWeK8pmF6Pcs7vdi7qFEZuNmXmHh2HE33wpGfJfhYpT92PE3mT.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.

https://files.peakd.com/file/peakd-hive/flemingfarm/23swnK5M1NtBGH7q8nVt84jUt8DH4xe9P7E6xZwZ8PhTAhmezKVs9LfG2gafV6qoDz22Y.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.

https://files.peakd.com/file/peakd-hive/flemingfarm/23x1BXVbT3q5RuJSeri3skg1da5GqXm6aKihFd1h23cyoShvffW3xH9yzTpgEB2R4WWPn.jpg

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

https://files.peakd.com/file/peakd-hive/flemingfarm/23yTaZtPjN8HiinPqC35J5HYJx7zSjHFU77iRhxpmGrV75Qd9bXfDo51FiKvUK78eHj8B.jpg

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

https://files.peakd.com/file/peakd-hive/flemingfarm/23wMf8hfu5Faosnmw4utqDddiXQNNYQZhJW3y1rygYqDKjjjCzWkL5xthXKaT1TR9sCpq.jpg
https://files.peakd.com/file/peakd-hive/flemingfarm/23xL16woWFhKwK3r2Fjav3pEGHKNvdFfdL1ab1xsVkhtpXfURXm361wxe4hz13DwKzq3u.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.

https://files.peakd.com/file/peakd-hive/flemingfarm/23x135ixhkFaWVFt6Sd9pCEwwNcayadp9jNnZ7beekZMTK7jHR1yz8f1WAMzkTeGKPSRN.jpg

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

https://files.peakd.com/file/peakd-hive/flemingfarm/23uQp26erZHBzNzVW9dxsAuJnURQ1nf5eB7ho3DBys8sqiXFMhHtitbT6zMHgeSkVLMw2.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.

https://files.peakd.com/file/peakd-hive/flemingfarm/23uFMgfy2i1AQRty7Z94JcXWcXPXsFuhvDXS5E18qWPmmUdB5HPYhGAvzK7ARMebjKGU8.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.

https://files.peakd.com/file/peakd-hive/flemingfarm/23xpAhr5eyt6qQjoaoP7b6KvdbK5QjWdYhG4WMce1aE6Az6A2e6sDfa45mrWopqfqyjrt.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.

https://files.peakd.com/file/peakd-hive/flemingfarm/23wMcMAxme2yiV5mb1SCcaCH7gncMpu11rGN9r996jpB7v1M9rLjREqctRoUPNWSJRQSZ.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.

https://files.peakd.com/file/peakd-hive/flemingfarm/23tmG2BcrBMMXMsor3yxHWJzDCNBpGSFposCfRoize3N924TMyyeSAP9DKYVMNaig73Pp.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.

https://files.peakd.com/file/peakd-hive/flemingfarm/23wBg95zJ8PbNronwQKSzHphUsZW3Cn5SB8v2c2VQsYXsVK2uLcDGtGffLTqdq89jmsz7.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

https://i.imgur.com/jZHRpZ9.png

https://affiliates.harvestright.com/media/banners/Affiliate-300x600-2.png
^Affiliate/Referral Link^

https://i.imgur.com/jZHRpZ9.png

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!

https://i.imgur.com/scQMN2U.jpg

You can Also Find Me On:

https://files.peakd.com/file/peakd-hive/flemingfarm/23vi6AsrUVbg7RsBR8K8og7YDVbBtPrrAwxBFCcQhaMDNU6bbFEAWesMdBx7VEua31qYp.jpg

Donations or Tips



Zap Me ⚡️ https://files.peakd.com/file/peakd-hive/flemingfarm/242hqeKfTBJAAu5kXvtKWEdA86Kq1vjaBhuoim4QcWjheA5vHDxyk286JadqF1VhBiZS4.JPG https://files.peakd.com/file/peakd-hive/flemingfarm/AK81Xng3A1zKkSCd1N7hsxtesHDotz4tWz3YfL8Ebb2zkY4DGaJ2u83ro7VvorB.jpg https://files.peakd.com/file/peakd-hive/flemingfarm/23x1MnQ7WTGxgfaBSBdR1fnn1koSaWn4fpPmFWGPomf4hPs121755XmP4NqTGWaQCYYFt.JPG LBTC https://files.peakd.com/file/peakd-hive/flemingfarm/AJmteDzy12HwjJ3pNRW6kJiN4wSi6shmjBXqdDjQWvMd5xLobfA26NTwwg7PNWp.jpg

https://i.imgur.com/XIX45Gk.png !https://hivebuzz.me/@flemingfarm/postallyear.png

https://files.peakd.com/file/peakd-hive/flemingfarm/243MHaQfRgSZ1Z79NdbaDi8Mb4FgyNzHXGtowSqzHYPp9cSJgu2neQmZ5irGMmGP6VQyN.jpg


https://img.whaleshares.io/wls-img/flemingfarm/18a9d6c14cc7f2e2ca94a2058b6bd2a5e3da2bf3.png

Comments

Sort byBest
AI
Waivio AI Assistant
How can I help you today?