Bird Repellent Project Report

Embed Size (px)

Citation preview

  • 7/27/2019 Bird Repellent Project Report

    1/24

    Mark O'Sullivan Cork Institute of Technology

    The Bird Repellent

    Mark OSullivan

    Department of Electronic Engineering,Cork Institute of Technology,

    Bishopstown,Cork.

    Supervisor: Mr. Pat Cogan

    Date: 08/05/09

    Mark OSullivan, May 2009 Page 1

  • 7/27/2019 Bird Repellent Project Report

    2/24

    Mark O'Sullivan Cork Institute of Technology

    Table of Contents

    TABLE OF CONTENTS ..................................................................................................... ........ 2

    ABSTRACT ............................................................................................................................... ... 3

    ACKNOWLEDGMENT ............................................................................................................ .. 4

    CANDIDATE'S DECLARATION ........ ......... ......... ......... ......... ......... ......... ......... ..... ..... ..... ..... ... 5

    INTRODUCTION .............................................................................................................. .......... 6

    RESEARCH .................................................................................................................................. 7

    Concept ............................................................................................................................ 7 Solar Power ...................................................................................................................... 8 Simple Wind Generator ................................................................................................... 9 Motion Detector ............................................................................................................. 10 PIC Device ..................................................................................................................... 11 Warning Speaker ............................................................................................................ 12

    DESIGNING THE CIRCUIT ......... ......... ......... ......... ........ ......... ......... ......... ......... ...... ..... ..... .... 13

    Basic Circuit Design ...................................................................................................... 13 Proteus Isis Design ......................................................................................................... 14 PCB Design ................................................................................................................... 16 Designing PCB using ARES .......................................................................................... 19

    BUILDING THE CIRCUIT ........ ......... ......... ......... ......... ......... ......... ......... ......... ........ ......... .... .. 20

    The PIR Sensor .............................................................................................................. 20 Building on Breadboard ................................................................................................. 21

    DESIGNING THE CODE ......... ......... ......... ......... ......... ......... ......... ......... ........ ......... ......... .... .... 22

    The Flowchart ................................................................................................................ 22 The Assembly Code ....................................................................................................... 23

    CONCLUSION .......................................................................................................................... . 24

    Mark OSullivan, May 2009 Page 2

  • 7/27/2019 Bird Repellent Project Report

    3/24

    Mark O'Sullivan Cork Institute of Technology

    AbstractThe device discussed in this project report is the Bird Repellent, a device intended to

    keep its surrounding area free from various types of Birds.

    The system is made up of a motion detector which will detect the presence of a bird andthen sound an alarm to scare away the bird. The system is powered by a small solar panel

    taken from a common solar garden lamp. A simple wind generator supplies backup power. The system is controlled by a PIC microcontroller. The aim is to have all the

    circuitry fit within the casing of the solar garden lamp. Therefore all components should be small and everything should be built on a small circuit board. The finish product

    should be small, portable and easy to use. Some of the main components involved are; aSolar Panel, a D.C. Motor, 5 PIR sensors and a Piezoelectric Sounder. The components

    will be operated by a PIC16F74 Microcontroller.

    Mark OSullivan, May 2009 Page 3

  • 7/27/2019 Bird Repellent Project Report

    4/24

    Mark O'Sullivan Cork Institute of Technology

    Acknowledgment

    I would like to thank my Supervisor Pat Cogan for his guidance during the developmentduring the project. Also I would like to thank the other project supervisors who provideda helping hand when no one else was available. My fellow students also provided support

    and encouragement when I felt lost.

    Mark OSullivan, May 2009 Page 4

  • 7/27/2019 Bird Repellent Project Report

    5/24

    Mark O'Sullivan Cork Institute of Technology

    Candidate's Declaration

    I hereby declare that this project report titled The Bird Repellent submitted towards thecompletion of third year in Cork Institute of Technology is an authentic record of my

    work carried out under the supervision and guidance of Mr. Pat Cogan.Date: May 8th, 2009

    Mark OSullivan, May 2009 Page 5

  • 7/27/2019 Bird Repellent Project Report

    6/24

    Mark O'Sullivan Cork Institute of Technology

    Introduction

    Today it is common to have electronic consumer products mass produced in factories andthen sold at affordable prices to the consumer. The question and task set out in this

    project was could an electronic product (the Bird Repellent) be built in the college usingthe facilities available to electronic engineering students. Using the basic tools in thelaboratories and at a students disposal, by ordering in affordable components fromcompanies like Farnell could an accurate product be produced within an allocated time.

    The product in question in my case was the Bird Repellent, a device that should repelBirds from an area using a loud noise. A list of potential projects and their supervisorswas handed out at the start of the year. All projects were assigned to the class randomly.My project supervisor, Pat Cogan, came up with the project idea of the Bird Repellent.He first asked me was this the project I wished to do and if not which other project fromthe list did I want assigned to me. I explained to him that I had an interest in renewableenergy and therefore the two renewable energy projects (Solar Power and Wind Power)were the two I was most interested. He therefore added a renewable energy factor to theBird Repellent project and the final specifications of the project were set out, the mostimportant factors being listed first;

    Siren used to repel Birds Motion Sensors used to detect Birds Operated using a PIC microcontroller Incased within a solar powered garden lamp Powered by the solar panel Powered by a simple DC motor converted to a wind generator

    Mark OSullivan, May 2009 Page 6

  • 7/27/2019 Bird Repellent Project Report

    7/24

    Mark O'Sullivan Cork Institute of Technology

    Research

    After the assignment of the project in semester 1, the class were told to research thedifferent aspects of their project as well as setting a plan for how the project would bemade and the specifications for the project. The following are the results of my researchinto each component as well as the concept of my project.

    Concept

    The first element I researched was the different types of bird repellents already availableon the market. These varied from sprays, visual scare devices and electronic devices likethe one I was creating. The electronic devices consisted mainly of two types; sonic andultrasonic devices. The sonic devices used sounds similar to that of the birds themselves.The ultrasonic device used noises that only the birds could hear themselves. One

    particular product I came across also had a similar idea as my project, power the deviceusing a solar panel. This was an add-on and was designed to save costs on replacing

    batteries, an idea that I was also keen on.

    The next step I took was on answering the question Why would you want to repel Birdsin the first place? There are many answers to this question but the ones I took as beingmy own personal motivation to build this device were;

    1. To prevent birds from destroying crops on a small farm2. To keep birds away from airport runways so as to prevent them from causing any

    risk to any aircrafts engines3. To keep areas such as playgrounds, back gardens and general areas where Birds

    are not desired.

    I discarded my device from being effective in the first two areas above and to be moreuseful in a small surrounding such as the ones discussed in the third point.

    After I was satisfied that I had researched the objective of such a device I proceeded toresearch the components I would need to build the device.

    Mark OSullivan, May 2009 Page 7

  • 7/27/2019 Bird Repellent Project Report

    8/24

    Mark O'Sullivan Cork Institute of Technology

    Solar Power

    Next I researched the solar panel which would generate enough power to operate thecircuit and all its components. The reason I wanted the device to run on renewable energywas my interest in the area of solar and wind generators; my free choice elective wasSustainable and renewable energy, my uncle was an ESB employee for many years and

    planned on building a wind farm before he passed away and finally my brother also hasan interest in the area and is currently building a wind generator which should be capableof running the majority of appliances in a common house.

    The idea first put to me by my project supervisor (Pat Cogan) was to power the deviceusing a simple solar panel, like those used in garden solar lamps. This type of solar panelwould supply enough power while still being cheap. And to keep things simple it was

    also suggested that the solar lamp act as the housing of the device in order to keepeverything small, compacted and simple. Also this housing is very resistant to weather conditions and is therefore perfect to sustain the circuitry, water resistance and moreimportantly being water proof is a huge factor as water leaking onto the circuitry couldresult in disaster.

    Parameter Name Value

    Product Size 150 by 550cm

    Power Production 0.45-0.6 watts

    Battery Type 2 by Ni-cd 600mAH

    Operating Time 8 hours

    Typical Cost 19.99 for 3

    Table 1.1 Typical Values for Solar Device

    Fig1.1 A typical garden solar lamp

    Mark OSullivan, May 2009 Page 8

  • 7/27/2019 Bird Repellent Project Report

    9/24

    Mark O'Sullivan Cork Institute of Technology

    Simple Wind Generator

    Continuing on with the theme of renewable energy the second item I researched was the possibility of a second generator, this one being operated by wind power. I have someexperience in the area of wind generators with my brother currently working on agenerator which could be attached to the mains of a house. His generator however wasobviously too big in scale for my bird repellent. After discussing this with my supervisor he suggested a simple motor would suffice in powering my device. Like a dynamo on a

    bike a simple DC motor put in reverse would generate some current for the circuitry. Amotor like this could easily be obtained from broken unused items found in the attic suchas an old tape recorder or walkman.

    This simple wind generator would involve a simple set of blades attached to the sprocketof the dc motor and inclined in a way to generate an anti-clockwise rotation when left in astrong breeze.

    Fig1.2 Simple Wind Generator using DC Motor

    Mark OSullivan, May 2009 Page 9

  • 7/27/2019 Bird Repellent Project Report

    10/24

    Mark O'Sullivan Cork Institute of Technology

    Motion Detector

    An element of the project which I had overlooked for quite a while was the ability todetect the motion of the bird or whatever creature was to be warned off. My next task wastherefore to find a cheap yet efficient way to do this. After some searching on google andmaplin.co.uk I returned to my supervisor with many different types of motion detector alarm systems which are often found in classrooms in schools, storage rooms in shopsetc. The problem with these devices is their size, much too big for my small and compact

    bird repellent. Also it was likely I would need 3 or 4 of these sensors as a 360 degreeangle would have to be covered.

    My supervisor therefore showed me what was in a stripped down version of one of thesesensors, a very small component called a PIR sensor (Pyroelectric Infrared sensor) which

    works on the bases of heat or more specifically infrared waves; a surface electric chargeis generated when infrared radiation hits the PIR sensor, and a change in electric chargewill occur with change in infrared radiation. This change is analyzed by a FET device

    built into the sensor. A Fresnel lens is placed in front of the PIR sensor in order toincrease the range of the device, Fresnel lenses were originally invented so lighthouseswould be more visible from greater distances.

    The angle of detection of the PIR sensor is 95 degrees. Therefore at least four of themwould be needed in order to effectively detect the bird. Another issue was the output of the PIR sensor. If it was an analogue output, an analogue to digital converter would berequired in order for the sensor to communicate with the PIC. Thankfully the sensors I

    found had a TTL output meaning the sensor would give a low output when nothing wasdetected and a high output when the sensor had been triggered.

    Fig1.2 Operation of a PIR sensor

    Mark OSullivan, May 2009 Page 10

  • 7/27/2019 Bird Repellent Project Report

    11/24

    Mark O'Sullivan Cork Institute of Technology

    PIC Device

    The most important and central part of the project is, if you like, the brain of the device;

    the PIC. Having only minor experience with the PIC family from second year and twomodules this year which focus on the PIC (Microcontroller Applications and FirmwareDevelopment) it is the obvious choice when choosing an operating chip. I knew I had twochoices of PIC; in Microcontroller Applications we work with the PIC16 family and inFirmware Development we work with the PIC18F452. Seeing as Pat Cogan is my projectsupervisor and also the lecturer in Firmware Development I presumed he proposed this

    project on the basis that it would run on a PIC18 chip. I therefore researched this familyof PIC chips and discovered the following;

    The PIC18 chip set is described as high end core devices. They were introduced to themarket in 2002 by the Microchip Company. They are very popular when it comes to

    projects such as our student projects; one factor which may have popularized them is howthey are programmed. Previous PIC devices such as the 17 series used assembly languageas their programming code. Assembly is a very crude form of programming; it is a low-level language for programming computers and is not very user friendly, mainly becauseit is dated. The 18 series however uses C programming which is probably the mostcommon form of programming at the moment.

    I therefore began planning my project around the PIC18F452 and the C programminglanguage but was soon told by my supervisor that in fact the PIC16 family would be moresuitable to what I was doing. The best PIC16 chip to work with was the PIC16F74 due toits amount of ports (five) and its availability within the college.

    Fig1.3 PIC16F74

    Mark OSullivan, May 2009 Page 11

  • 7/27/2019 Bird Repellent Project Report

    12/24

    Mark O'Sullivan Cork Institute of Technology

    Warning Speaker

    The final component of the bird repellent is the speaker or tweeter used to repel the bird.The most effective way to repel a bird would be to mimic them so they believe that theterritory theyre on is already taken. To do this we need a speaker that can replicate the

    birds call. A tweeter is perfect for this task as it is designed to produce high frequencies.

    The alternative to the tweeter is a siren which could be configured to play actualrecordings of birds. Both of these devices are cheap and more importantly effective andshould not require much current.

    Technical Specification

    Fig 1.5

    Mark OSullivan, May 2009 Page 12

  • 7/27/2019 Bird Repellent Project Report

    13/24

    Mark O'Sullivan Cork Institute of Technology

    Designing the Circuit

    Building the Bird repellent required several steps. Before any building could be done of course the circuitry had to be designed. Firstly a basic block diagram, then using designsoftware and finally on a PCB design maker.

    Basic Circuit Design

    Fig2.1 Basic Circuit

    The basic circuit was conceived from analysing the layout of the PIC16F74 which had been chosen to control the device. The PIR sensor needed to be connected to power andground and its third connection to one of the ports of the PIC, PortA was chosen simplyfor its location. The PIC itself had to be connected to power and ground using theappropriate pins. Also the master clear pin had to be connected to power using a pull upresistor and finally PortB was chosen as the output to the speaker. There are elementsmissing from the above diagram as it was the first I designed. The missing elements wereintroduced using the Proteus Isis software.

    Mark OSullivan, May 2009 Page 13

  • 7/27/2019 Bird Repellent Project Report

    14/24

    Mark O'Sullivan Cork Institute of Technology

    Proteus Isis DesignOne of the first elements introduced when circuit designing began on the ISIS software

    package was the FET. It was connected to the output of PortB and was designed so thatthe output of the device could drive a motor, in other words if the user of the BirdRepellent didnt want loud noises to repel the birds, they could attach some sort of motor driven device such as an imitation bird with flapping wings.

    Fig2.2 FET for driving a Motor

    The circuit in fig2.2 above was sent to me via e-mail by my supervisor. He advised me toadd this element to my design as it would increase the functions of the device.

    Mark OSullivan, May 2009 Page 14

  • 7/27/2019 Bird Repellent Project Report

    15/24

    Mark O'Sullivan Cork Institute of Technology

    Fig2.3 Proteus Isis Circuit

    Fig2.3 above shows the finished ISIS design. J3 acts as the input for the PIR sensor withline 2 being the TTL input from the sensor. This goes to pin2 of the PIC, PortA. J1 allowsfor connection of power (+5V) and ground. Pin19 of the PIC is PortD and in this caseusing an LED acts as an indicator to whether the circuit is operational or not. Pin33 is theoutput of the PIC (PortB) and is used to drive the FET. The diode D2 allows for a motor

    to rotate if a high output results at PortB. J2 is the connector for the device to be used i.e.a motor or a sounder.

    Mark OSullivan, May 2009 Page 15

  • 7/27/2019 Bird Repellent Project Report

    16/24

    Mark O'Sullivan Cork Institute of Technology

    PCB Design

    Fig2.4 Basic PCB Design

    The biggest struggle I found during this project was designing the PCB. I had tried to

    download various PCB design software packages but all of them were not user friendlyand were taking too much time and too much of my patience. I considered, at one point,drawing out the PCB design myself but this too would have taken time and would nothave been accurate.

    Fig2.4 above shows the first PCB design I came up with. I made it using the simpletemplates below which could be copied and pasted onto a grid (also below). It was a verycrude way of designing a PCB and I soon found out from my supervisor that it wasnt theright path. One problem was the IC package for the PIC16F74 was too narrow and themajor problem was if anything needed to be added (like the FET) the PCB would have to

    be redesigned from scratch.

    Mark OSullivan, May 2009 Page 16

  • 7/27/2019 Bird Repellent Project Report

    17/24

    Mark O'Sullivan Cork Institute of Technology

    Fig2.41 Template 1

    Fig2.42 Template 2

    Fig2.43 Grid

    Mark OSullivan, May 2009 Page 17

  • 7/27/2019 Bird Repellent Project Report

    18/24

  • 7/27/2019 Bird Repellent Project Report

    19/24

    Mark O'Sullivan Cork Institute of Technology

    Designing PCB using ARES

    After a lot of time wasted on previous PCB design attempts my supervisor showed methe easiest and most effective way of designing a PCB. The program I had previouslyused to design the circuit (ISIS) had another program called ARES which used the circuitand all its components designed using ISIS and allowed the user to drop thecomponents anywhere they wanted on the PCB and then link the appropriate componentconnections to each other. Another element was auto-route which automatically drewthe tracks between components. However this element was designed for double sidedPCBs, a luxury I didnt have. Therefore drawing the tracks so they would not cross over any other tracks while still keeping the PCB compact was a challenge and took severalattempts and some time. However I was very pleased with the results and that I wouldhave no trouble with PCBs in the future.

    Fig2.9 Final PCB Design

    Mark OSullivan, May 2009 Page 19

  • 7/27/2019 Bird Repellent Project Report

    20/24

    Mark O'Sullivan Cork Institute of Technology

    Building the Circuit

    The PIR Sensor

    Seeing as almost all of the components could be found in the store room of theEngineering Department the only component I had to worry about was the PIR sensor.Fig3.1 below is one of two sensors I ordered over the internet. The PIR sensor is thecircular part in the middle of the IC. The IC itself controls the operation of the sensor,making sure a high output is made only when an object is detected. The plastic shell tothe right is the Fresnel lens. It increases the range of the sensor and can be clipped over the PIR sensor. There are three wires coming from the IC. The red wire connects to +5volts, the black wire to ground and the yellow wire is the output, which will be either high (+5 volts) when something is detected or low (0 volts) when nothing is detected.This is a TTL output and works perfectly with the PIC16F74.

    Fig3.1 the PIR Sensor

    When I received the sensor the first thing I did was test it. By using a power supply andan oscilloscope I connected the appropriate wires to power and ground and the output(yellow) wire to the oscilloscope. I was very pleased to see the sensor work to someeffect. The range of sensitivity was small but if someones hand was placed in front of the sensor, the output went high for roughly 10 seconds before returning to zero. Thiswould be a perfect amount of time for the alarm to sound and scare off a bird.

    Mark OSullivan, May 2009 Page 20

  • 7/27/2019 Bird Repellent Project Report

    21/24

    Mark O'Sullivan Cork Institute of Technology

    Building on Breadboard

    Fig3.2 Circuit Built on Breadboard

    In fig3.2 above I have built the circuit on breadboard. I decided to test the circuit by thismeans before making the PCB and soldering components onto the PCB. Also I could usethe breadboards power supply and ground for the circuit. The components were wired upthe same as my circuit design and the circuit was ready for simulation.

    Mark OSullivan, May 2009 Page 21

  • 7/27/2019 Bird Repellent Project Report

    22/24

    Mark O'Sullivan Cork Institute of Technology

    Designing the Code

    I had chosen to use assembly language as the programming language for my project. Myother choice was C programming but I had heard that some of my classmates wereexperiencing difficulty with this language. Before any code could be written I needed tomake it clear to myself and others what I required my code to achieve. I therefore drewout a flowchart.

    The Flowchart

    Fig4.1 Flowchart

    The flowchart is very simple; firstly the ports must be set up for either input or output.PortA should be set up for input and PortB and PortD should be set up for output. NextPortA should be checked to see if it is high or low, or in other words has something been

    detected or not. If something hasnt been detected (a low output) the program should loop back to check PortA again. If something is detected, PortB and PortD are set high for 15seconds. This should be sufficient time for the sounder to scare away a bird. PortB andPortD are then reset (or turned off) for a further 15 seconds. This is to prevent thesounder from constantly being on. The program then jumps back and checks PortA again.This is repeated indefinitely or until the user turns off the power to the device.

    Mark OSullivan, May 2009 Page 22

  • 7/27/2019 Bird Repellent Project Report

    23/24

    Mark O'Sullivan Cork Institute of Technology

    The Assembly Code

    Below is the final assembly language code. Each line is explained by followingcomments.

    ;select PIC device 16f74list p=16f74

    ;include file to let MPLAB know about the registers in the 16f74

    include

    ;create extra variables for use in the program DlyCount equ 0x20

    org 0x0000 ;reset vector goto Start ;jump to start of program

    org 0x0010 ;start of program code hereStart: bsf STATUS,RP0 ;select register bank 1

    movlw 0xFF movwf TRISA ;set port A for all inputsclrf TRISD ;set port D for all outputsclrf TRISB ;set port B for all outputsbcf STATUS,RP0 ;go back to bank 0

    Check: movlw 0x01andlw PORTA ;if sensor is triggered btfss STATUS,F movlw 0x01movwf PORTB ;set PORTB and...movlw 0x01movwf PORTD ;...PORTD highcall Delay ; delay for 10 seconds

    clrf PORTB ; reset PORTBclrf PORTD ; and PORTDcall Delay ; & keep them off for 15 secs

    goto Check ; check if sensor is triggered

    Delay: movlw 0x0F ;set length of delaymovwf DlyCount ;...and store in memory

    OuterLoop: decfsz DlyCount,F ;decrement count1 each time ExitDelay: return ;return to main program

    END

    Mark OSullivan, May 2009 Page 23

  • 7/27/2019 Bird Repellent Project Report

    24/24

    Mark O'Sullivan Cork Institute of Technology

    Conclusion

    By the deadline date for the project demonstration very little had been completed.Making a PCB had been abandoned in favour of demonstrating on a breadboard, thereason for this was I wanted to have a working circuit on breadboard before I had aworking circuit on a PCB. The renewable energy aspect of the project was not included inthe final circuit. Again I felt time spent on this aspect would be time taken away from themain goal, making a device that could repel birds. The circuit did work to a degree in thatif the motion sensor was triggered, it did set off a sounder, or lit an LED. This wasachieved however by bypassing the PIC altogether. The assembly code did compile butthere was a problem with the simulator board and with so little time left before thedemonstration this problem could not be overcome.

    However I can say that I did learn a lot from this project. Although the time spent on theProteus software seemed pointless by the end (seeing as no PCB was required) I did learna lot about the ISIS and ARES programs. I could now confidently design a circuit and itsPCB without any trouble. Also the circuit I built on the breadboard worked, it was justthe simulator that was at fault. Also the code I wrote compiled, showing that it had noerrors. But the main lesson I learned from my third year project was time managementand its importance. The main element of the project that failed was my inability to allowsufficient time between college work and project work.

    M k OS lli M 2009 P g 24