Вы находитесь на странице: 1из 19

UNIVERSITI TEKNOLOGI MARA

FACULTY OF MECHANICAL ENGINEERING

Program : Bachelor of Engineering (Hons.) Mechanical


Course : Applied Electronics and Microprocessor
Course Code : MEC 523
Lecturer/Tutor Name : Abdul Malek Abdul Wahab (Dr.)
Group : EMD6M10

Mini Project:

Automatic Animal Feeder

Bil Student Name Student ID


1. Danish Aiman Bin Zulkifli 2016218568
2. Muhammad Haziq Bin Mohd Pazli 2016229324
3. Muhammad Imran Bin Hashim 2016218382
4. Ahmad Haziq Danial Bin Yusaini 2016218526
TABLE OF CONTENT

TABLE OF CONTENT .............................................................................................................. i

PROBLEM STATEMENT ........................................................................................................ 1

OBJECTIVE .............................................................................................................................. 1

PRODUCT DESIGN ................................................................................................................. 1

How it works? ........................................................................................................................ 1

User Interface ......................................................................................................................... 2

Design Concept ...................................................................................................................... 2

Schematic / Wiring Diagram ................................................................................................. 4

Program Flowchart................................................................................................................. 5

MATERIAL LIST ..................................................................................................................... 7

Materials And Components ................................................................................................... 7

Cost Listing ............................................................................................................................ 8

DISCUSSION ............................................................................................................................ 9

CONCLUSION .......................................................................................................................... 9

APPENDIX .............................................................................................................................. 10

Coding .................................................................................................................................. 11

i
PROBLEM STATEMENT

Managing food intake for livestock such as chicken usually is a meticulous process.
Farmer need to feed them daily at specific time with certain amount of fodder to keep them
healthy while need to maintain fodder stock. A product that can ease the farmer’s job to
maintain fodder amount and distribute fodder would be very beneficial to them.

OBJECTIVE

The objectives of this project are to develop a prototype of Automatic Animal Feeder that
can:

 Automatically dispense animal feeds.


 Reduce farmer's work from manually feed the animal.
 To apply arduino programming on agriculture system.

PRODUCT DESIGN

How it works?
A DS3231 RTC (Real Time Clock) Module is used which capable to store time and
date. The module comes with its own battery so, the time will always be updated even if the
device is powered off. The time read from this module is compared with the timer so that the
feeder can be activated on time.

Besides, in this circuit, we are using a LCD with 12C to display the user interface. We
use 3x4 Membrane keypad to act as input. Each button is registered into the algorithm thus,
allowing us to control the system.

Also, we also used the 3x4 Membrane keypad that positioned on side of the food
container. The LCD will display the menu which can set time to 4 feed time. A Cylinder
Container is installed at the top of base that is connected to a servo motor. When the feeder
is activated, the motor rotate as well as Cylinder Container. The tank is connected to a
channel that lead the fodder outside.

1
User Interface
The Animal Feeder can be operated in two ways. There is one timer in the system that
can be set by the user as well as a clock that is displayed on the LCD panel. The fodder will
be dispensed at the set time.

The system is controlled using via keypad. Using the keypad, user can operate the
system to set the clock, set the timer and dispense food. The button associated is as below:

BUTTON FUNCTION
Numerical ‘*’ Main Menu
Numerical ‘5’ Accept / Enter
Numerical ‘4’ Move cursor to the left
Numerical ‘6’ Move cursor to the right
Numerical ‘2’ Up button
Numerical ‘8’ Down button

Design Concept
1) First View

Servo Motor Cylinder Container

LCD with 12C


Plastic
Container

Boxes Hollow cylinder

USB Cable Keypad membrane


(4x3)

2
2) Second View ( inside control panel)

Breadboard
LCD I2C
sheet

Maker UNO

DS3231
Timer module

3
Schematic / Wiring Diagram

Figure 1 : Schematic Diagram

Figure 2 : Wiring Diagram

4
Program Flowchart

5
6
MATERIAL LIST

Materials And Components


NO MATERIAL / FEATURES
COMPONENTS
1. LCD with 12C
Act as a display screen. It is using a 12C communication
interface.
2. Servo Motor
It is a rotary actuator and also an electric drive with a
feedback mechanism.

3. Cables
It is a cable with a connector or pin at each end which is
normally used to interconnect the components.

4. Maker UNO
Arduino is an open-source electronics platform based on
easy-to -use hardware and software which able to read
inputs.
5. DS3231 Timer Module
It is a highly accurate Real Time Clock which can
maintain hours, minutes and seconds as well as day,
month and year information.
6. Cylinder Container
It been used as a container to keep the animal food.

7. Boxes
It is been used as a base and as a place to keep the control
panel components of this project.

8. Hollow cylinder
Act as a slider for the food to pass through to the bowl.

7
9. Plastic Container
Been uses as a servor holder to connect with the cylinder
container.

10. Keypad ( 4 x 3 )
To insert/set the input.

Cost Listing
No Part Qty Price Available
Electronic Component
1 Maker Uno 1 RM 30.00 Yes
2 LCD with I2C 1 RM 12.20 No
3 DS3231 Timer Module 1 RM 6.10 No
4 Servo Motor 1 RM 7.10 Yes
7 Keypad (4x3) 1 RM 13.00 Yes
8 Male-Male Jumper Wire 1 set RM 3.70 Yes
9 Male-Female Jumper Wire 1 set RM 3.70 No
Item
11 Mechanism (Hollow cylinder, Plastic - RM 10.00 No
container)
12 Stationary (Glue, Knife, etc) - RM 10.00 Yes
Miscellanious
13 Shipping - RM 4.00 -
Total Cost (Excluding available item) RM 99.80

8
DISCUSSION

Due to the limitations of the scope of this project, there were a number of aspects of
the design and realization of the prototype that we believe could be improved if be given
additional time and resources. Firstly, our system is not fully waterproof, to fulfill this
requirement, the Arduino port openings would need to be sealed and the covers on the front
and top would need to be more robust. Next, our tank capacity is quite small so more work
had to be done by the farmer to top up the pallets if it empty. To solve this problem, we can
increase the size of the tank or also can make extra tank as backup. Also, we can improve our
system and make it refill the tank automatically. We also can include a battery backup. The
primary concern for an automated animal feeding system is to reliably dispense the proper
amount of food to the animal based on the set time. Our device is powered by a wall outlet,
meaning that the animal wouldn’t be fed if there were to be a power outage. We recommend
a battery backup that would activate if the device stops receiving power, thus adding an
additional layer of security for the farm owner.

CONCLUSION

This automatic animal feeding system was planned to ensure the time to time feeding
of animal daily and to ease the farmer to control the feeding of their animal. Automatic
Animal Feeding System has attractive design and aesthetic model. The report showcased the
basic design of the system to be made. Based on the result, we had successfully used the
Arduino as the microcontroller to create this system. This system not only benefits the farmer
by reduce his work from manually feed the animal, it also gives better efficiency in fodder
amount control and can notify farmer when the tank needed to be refill.

9
REFERENCES

10
APPENDIX
Coding

#include <Servo.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <DS3231.h>
#include <Keypad.h>

//Servo-Parameter initialize
int gateSpeed=5; //Servo speed
int gateDuration=1000; //Duration gate opened in miliseconds
int gateClose=0; //Servo angle when gate closed
int gateOpen=180; //Servo angle when gate opened

//Timer-Parameter initialize
int timerNo=0; //timer iD, 0-3
int selTimer=0; //Selected timer for next feeding
String timer[4]; //Store feeding time
String sortTimer[4]; //timer sorted in ascending order
String currTime=""; //Store current time
boolean setMode=false; //Store current operation, running/set
boolean timeMode=false; //timer setting mode
boolean clockMode=false; //clock setting mode

//LCD-Parameter initialize
int curRow=0; //Cursor row position
int curCol=0; //Cursor col position

//Keypad-Parameter initialize
char key;
const byte ROWS = 4;
const byte COLS = 3;
char hexaKeys[ROWS][COLS] = {
{'1', '2', '3'},
{'4', '5', '6'},
{'7', '8', '9'},
{'*', '0', '#'}
};

//system-parameter initialize
int page=1;

//Servo Pinout
const int servoPin=5;

//Keypad Pinout
byte rowPins[ROWS] = {13, 12, 11, 10};
byte colPins[COLS] = {9, 8, 7};

//Object initialize
LiquidCrystal_I2C lcd(0x27, 16, 2);
Servo gate;
DS3231 rtc(SDA,SCL);
Keypad customKeypad = Keypad(makeKeymap(hexaKeys), rowPins, colPins, ROWS,
COLS);

void setup() {

11
// put your setup code here, to run once:

//Startup all device


Serial.begin(9600); //Serial, for debug
lcd.begin(); //LCD
lcd.backlight(); //LCD backglight on
gate.attach(servoPin); //Servo
rtc.begin(); //DS3231

//startup routine
gate.write(gateClose);
timer[0]="00:00:00";
timer[1]="00:00:00";
timer[2]="00:00:00";
timer[3]="00:00:00";
}

void loop() {
// display main menu/interface
if(setMode==false && timeMode==false && clockMode==false )
main_menu();

//read keypad input


key = customKeypad.getKey();

//decide action when certain key is pressed


if(key){
Serial.println(key);

switch (key){
//menu button
case '*':
if(setMode==false)
setMode=true;
else
setMode=false;
sett_menu1();
break;

//down button
case '8':
//in setting
if(setMode==true){
if(curRow==0)
curRow=curRow+1;
else if(curRow==1 && page==1){
curRow=curRow-1;
sett_menu2();
}
lcd.setCursor(0,curRow);
}
//in set timer
else if(setMode==false && timeMode==true){

char toChar;
int toIntg=timer[timerNo].charAt(curCol);

lcd.setCursor(curCol,1);
if(toIntg>48){
toIntg--;

12
toChar=toIntg;
lcd.print(toChar);
lcd.setCursor(curCol,1);
timer[timerNo][curCol]=toChar;
}
}
//in set clock
else if(setMode==false && clockMode==true){

char toChar;
int toIntg=currTime.charAt(curCol);

lcd.setCursor(curCol,1);
if(toIntg>48){
toIntg--;
toChar=toIntg;
lcd.print(toChar);
lcd.setCursor(curCol,1);
currTime[curCol]=toChar;
}
}
break;

//up button
case '2':
//in setting
if(setMode==true){
if(curRow==1)
curRow=curRow-1;
else if(curRow==0 && page==2){
sett_menu1();
}
lcd.setCursor(0,curRow);
}
//in set timer
else if(setMode==false && timeMode==true){

char toChar;
int toIntg=timer[timerNo].charAt(curCol);

lcd.setCursor(curCol,1);
if(toIntg<58){
toIntg++;
toChar=toIntg;
lcd.print(toChar);
lcd.setCursor(curCol,1);
timer[timerNo][curCol]=toChar;
}
}
//in set clock
else if(setMode==false && clockMode==true){

char toChar;
int toIntg=currTime.charAt(curCol);

lcd.setCursor(curCol,1);
if(toIntg<58){
toIntg++;
toChar=toIntg;
lcd.print(toChar);
lcd.setCursor(curCol,1);

13
currTime[curCol]=toChar;
}
}
break;

//ok button
case '5':
//if in setting
if(setMode==true && timeMode==false){
if(page==1 && curRow==0){
operGate(gateSpeed,gateDuration);
main_menu();
}
else if(page==1 && curRow==1)
operTimer(timerNo);
else if(page==2 && curRow==0)
operClock();
else if(page==2 && curRow==1)
main_menu();
}
//if in setting timer
else if(setMode==false && timeMode==true){
timerNo=timerNo+1;
curCol=0;
if(timerNo<=3)
operTimer(timerNo);
else{
main_menu();
timerNo=0;
}
}
//if in set clock mode
else if(setMode==false && clockMode==true){
toTime(currTime);
curCol=0;
main_menu();
}

break;

//right button
case '6':
if(setMode==false && (timeMode==true && curCol<8 ||
clockMode==true)){
if(curCol<7)
curCol++;
lcd.setCursor(curCol,1);
}
break;

//left button
case '4':
if(setMode==false && (timeMode==true || clockMode==true)){
if(curCol>=0)
curCol--;
lcd.setCursor(curCol,1);
}
break;
}
}

14
}

//display main menu


void main_menu(){
setMode=false;
timeMode=false;
clockMode=false;
lcd.clear();
lcd.noBlink();
lcd.setCursor(0,0);
lcd.print("Next Feed: ");
currTime=rtc.getTimeStr();
Serial.println(selTimer);
lcd.print(sortTimer[selTimer]);
lcd.setCursor(0,1);
lcd.print("Hour: ");
lcd.print(currTime);
delay(900);

if(currTime==sortTimer[selTimer])
operGate(gateSpeed,gateDuration);
findTimer();

//setting page 1
void sett_menu1(){
setMode=true;
timeMode=false;
clockMode=false;
page=1;
lcd.clear();
curRow=0;
lcd.setCursor(0,0);
lcd.print("1) Serve treat");
lcd.setCursor(0,1);
lcd.print("2) Set Timer");
lcd.setCursor(0,0);
lcd.blink();
}

//setting page 2
void sett_menu2(){
page=2;
lcd.clear();
curRow=0;
lcd.setCursor(0,0);
lcd.print("3) Set Time");
lcd.setCursor(0,1);
lcd.print("4) Exit Menu");
lcd.setCursor(0,0);
lcd.blink();
}

//control gate
void operGate(int gateSpeed, int gateDuration){
int angle;

lcd.clear();
lcd.noBlink();

15
lcd.print("Happy Meal");

//open gate
for(angle=gateClose; angle<gateOpen; angle+=gateSpeed){
gate.write(angle);
delay(gateSpeed*7);
}

//period of gate stayed open


delay(gateDuration);

//close gate
for(angle=gateOpen; angle>gateClose; angle-=gateSpeed){
gate.write(angle);
delay(gateSpeed*7);
}
}

//set timer
void operTimer(int timerNo){
setMode=false;
timeMode=true;
clockMode=false;

lcd.clear();
lcd.setCursor(0,0);
lcd.print("Timer ");
lcd.print(timerNo+1);
lcd.setCursor(0,1);
lcd.print(timer[timerNo]);
lcd.setCursor(0,1);
}

//find timer that should be on


void findTimer(){

String buff;

//transfer timer to new array


for(int l=0;l<4;l++)
sortTimer[l]=timer[l];

//sort timer in ascending order


for(int i=0;i<4;i++)
for(int j=0;j<3;j++){
if(sortTimer[j]>sortTimer[j+1]){
buff=sortTimer[j];
sortTimer[j]=sortTimer[j+1];
sortTimer[j+1]=buff;
}
}

//select timer that is later and closest to current time


for(int k=0;k<4;k++){
if(sortTimer[k]>currTime){
selTimer=k;
break;
}
}
}

16
//set clock
void operClock(){
setMode=false;
timeMode=false;
clockMode=true;

lcd.clear();
lcd.print("set Clock");
lcd.setCursor(0,1);
lcd.print(currTime);
lcd.setCursor(0,1);
lcd.blink();
}

//conver time from string type to second, hour and minute


void toTime(String currTime){
int getHour;
int getMinute;
int getSecond;

getHour=((currTime[0]-48)*10)+(currTime[1]-48);
getMinute=((currTime[3]-48)*10)+(currTime[4]-48);
getSecond=((currTime[6]-48)*10)+(currTime[7]-48);

rtc.setTime(getHour,getMinute,getSecond);
}

17

Вам также может понравиться