Good day! I am working on my final year project on a chicken coop monitoring whereas it monitors the temperature, humidity, ammonia levels and the chicken feeder weight. I set a threshold values for it which I read from the studies. For example, for a tropical country, 30C-32C is only the recommended values for temp and 50%-60% for humidity. For ammonia, it must be not higher than 11ppm. Lastly for chicken feeder weight, I just put <100 = empty, >=100 && >= 250 is normal and >250 is full. I am sending this values every 2 hours via SMS automatically without sending a prompt message to the system whatever the UNO sensed its temp, humidity, ammonia and weight on a given time manner.
For example
as of 01/09/2021 10:00
temp = 31.2 *C (NORMAL)
humidity = 62% (HIGH)
NH3 = 5.2 ppm (NORMAL)
Chicken feeder weight = 80 g (EMPTY)
as of 01/09/2021 12:00
temp = 33.2 *C (HIGH)
humidity = 45% (LOW)
NH3 = 0.9 (LOW)
Chicken feeder weight = 300 g (FULL)
Please help me, thanks!
here is my entire code
#include <Adafruit_Sensor.h>
#include <DHT.h>
#include "HX711.h"
#define DHTPIN 7
#define DHTTYPE DHT22
#define RL 47 //The value of resistor RL is 47K
#define m -0.263 //Enter calculated Slope
#define b 0.42 //Enter calculated intercept
#define Ro 24 //Enter found Ro value
#define MQ_sensor A5 //Sensor is connected to A4
#define DOUT 8
#define CLK 9
DHT dht(DHTPIN, DHTTYPE);
HX711 scale(DOUT, CLK);
void setup() {
Serial.begin(9600);
Serial.println("DHT22 and MQ137 test!");
scale.set_scale(208.06);
delay(1000);
dht.begin();
scale.tare();
}
void loop() {
float h = dht.readHumidity();
float t = dht.readTemperature();
Serial.print("Temperature: ");
Serial.print(t);
Serial.print("*C");
if (t < 30) {
Serial.println("(LOW)");
}
if (t > 32) {
Serial.println("(HIGH)");
}
if (t >= 30 && t <= 32) {
Serial.println("(NORMAL)");
}
Serial.print("Humidity: ");
Serial.print(h);
Serial.print("%");
if (h < 50) {
Serial.println("(LOW)");
}
if (h > 60) {
Serial.println("(HIGH)");
}
if (h >= 50 && h <= 60) {
Serial.println("(NORMAL)");
}
float VRL; //Voltage drop across the MQ sensor
float Rs; //Sensor resistance at gas concentration
float ratio; //Define variable for ratio
VRL = analogRead(MQ_sensor) * (5.0 / 1023.0); //Measure the voltage drop and convert to 0-5V
Rs = ((5.0 * RL) / VRL) - RL; //Use formula to get Rs value
ratio = Rs / Ro; // find ratio Rs/Ro
float ppm = pow(10, ((log10(ratio) - b) / m));
Serial.print("NH₃: "); //Display a ammonia in ppm
Serial.print(ppm);
Serial.print(" ppm");
if (ppm < 5) {
Serial.println("(LOW)");
}
if (ppm >= 5 && ppm <= 11) {
Serial.println("(MODERATE)");
}
if (ppm >= 11 && ppm <= 25) {
Serial.println("(HIGH!)");
}
if (ppm >= 25 && ppm <= 35) {
Serial.println("(VERY HIGH!)");
}
if (ppm >= 35 && ppm <= 50) {
Serial.println("(SEVERE!)");
}
if (ppm > 50) {
Serial.println("(EXTREME!)");
}
float calibration_factor = 208.06;
float cfw = (scale.get_units());
Serial.print("Chicken Feeder Weight: ");
Serial.print(scale.get_units(10), 2);
Serial.print(" g");
if(cfw < 100){
Serial.println("(EMPTY)");
}
if(cfw >= 100 && cfw <= 250){
Serial.println("(NORMAL)");
}
if(cfw > 250){
Serial.println("(FULL)");
}
delay(2000);
}