 # NEWBIE here badly needed help

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)

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() {

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);
}

``````

You're welcome

1 Like

I like this better:

``````  if (t < 30)
{
Serial.println("(LOW)");
}
else if (t > 32)
{
Serial.println("(HIGH)");
}
else
{
Serial.println("(NORMAL)");
}
``````
1 Like

Hi @iamerikg,

What do you need help with? You might like to try Blynk too for displaying data.

1 Like

Is that what you wanted help with?

Do you want to have your Arduino to talk directly to the cellular/mobile network or do you want your Arduino to talk to an Internet service that will send you an SMS?

1 Like

will try this one, thanks a lot!

I'm a noob in Arduino but still learning more about this. I will try this one up, thanks a lot!

Will study more about Blynk for this one, but my adviser/professor just told me that SMS will be fine on this final project. Thank you!

The Arduino will just send the sensor values along with its level (ex. (LOW), (NORMAL), (HIGH)) via cellular/mobile network without sending a prompt message (Ex., "STATUS", "STATE" etc.) and it has an interval of 2 hours. Will the for statements will be good? Because I have 4 sensors and 3 level combinations. Thanks for helping I'd tried this one, this more clean and simple. Thank you!!!! so we still don't know what you need help with...