SlideShare a Scribd company logo
1
Automation
Of
Pheromone Traps
2
Acknowledgement
I express my sincere gratitude towards Mr. Lokesh Makam &
Mr. Chaco Muller, my project coordinators, for giving me
precious information about Barrix and about the work to
being carried out by the organisation in Integrated Pest
Management (IPM) and Organic Agriculture.
I also take this opportunity to thank all the employees of
Barrix fortheirsupport, encouragementandalsofor providing
friendly environment, which was very vital during my
internship period.
Finally, I’m thankful to all the individualswhose names are
not includedhere for theirsupport. Allof them have made my
project a success.
K V Y K Sarvan
3
Index
Project Profile 04
Introduction 05
Hardware 05
First Version 06
Establishing Ad-Hoc
Network
08
Test Results 16
Sending captured images
through mail
20
Trail Tests with Version 1 23
Learning from Version 1 24
Image studying using
better edge detection
25
References 27
4
Project Profile
 Project Title: Automationof Pheromone Traps
 Project Duration: 4 months
 Submitted To: Dr. Ranendu Ghosh & Dr. Rahul
Dubey
 Submitted By: K V Y K Sarvan
5
Introduction:
The pheromone traps are used for attracting agent to trap the
pest which cause damage to fields. These are also act as
monitoring purpose and best suitable for organic kind of
farming. Barrix fruit trap or vegetable fly trap are the
conventional trapswhich are presently using by the farmers in
India. These conventional traps are located in far fields and it
is difficult to farmer to find of which kind of pest actually
attacking the field and maintaining those traps is labour
intensive.
In order to reduce the problem the suggested idea for
improving the traps is using Automation in Pheromone Trap.
The automationpart is divided into four versions. As a part of
internship, the execution of first version is taken as task.
Hardware
In order to provide less power consuming and effective
utilization of monitoring system the selected board for this
purpose is “Raspberry Pi”.
 Raspberry Pi board and Pi-camera
 Network cable with router or switch
 Power bank 10000mAh/1A
6
 Desktop with Wireless PCI adapter
 Nano Wifi adapter(802.11n)
 Power Source and 16GB SD Card
The operating systems and programming:
 Linux-Raspbian(O.S)
 Python-2.7
 Eclipse software
 Opencv
 SSH 3.2.9
 Putty and WinSCP
First version
The steps which are includedfor the first version are
described as fallows-
Step 1:- To integrate camera and Raspberry pi model B with
power bank
Step2: To conduct lab tests and send images captured by
raspberry pi to desired person mail id in desired time period.
Step3: Establish Ad-hoc network with desktop/lap top to
Raspberry pi for remotely accessing.
Step4: To conduct the prototype test along with whole setup
in DA-IICT campus
7
The pheromone traps which are used need to be installed in
any branch of trees, so initially for the project purpose we
used NoIR camera for capturing the images during night time
also after for the real time testing used ordinary pi camera.
The full integration of kit can be seen in below images.
Figure 1: NoIR mounted on the Trap Cap along with
pheromone
Figure 2: Set up with Raspberry pi-model B with Trap
8
In order to send the images directlyto desired mail id we used
the python coding for the purpose as .py file along with the
Ad-Hoc, the available methodologies are also tested for
remotely accessing the images.
**************************************************
Establishing Ad-hoc Network:
The executionof the establishingthe network using Raspberry
pi as server and any desktop/lap top as client.
Hardware SetUp- For both Ad-hoc and Remotely Accessing using
Lan cable:
Figure 1: The Setup with Raspberry Pi-model B
9
Figure2: The Kit connected with Camera and Raspberry board
A. Configuring Ad-HOC
The fallowing commands are used to establish ad-hoc using
LxTerminal window:
Sudo ifconfig wlan0 down; sudo iwconfig wlan0 mode ad-hoc
Sudo ifconfig wlan0 up
Sudo iwconfig wlan0 essid raspi
Sudo ifconfig wlan0 192.168.22.22 netmask 255.255.255.0
Sudo ifup wlan0
B. Check wlan0 status
Sudo ifconfig
Sudo iwlist wlan0 scan
10
Troubleshotting
1. Writing the wireless interface file which set statically
Auto lo
iface lo inet loopback
iface eth0 inet dhcp
iface wlan0 inet static
address 192.168.22.22
netmask 255.255.255.0
2. Type sudo su root and ifdown wlan0; ifup wlan0 to restart
wireless interface.
3. Sudolsusb and sudo lsmod used to verify about USB devices
and wifi devices modules loaded or not.
Figure3: The status of Ethernet cable and wifi adapter
11
Figure4: The status of Ad-hoc(signal strength)
By troubleshooting and after repeating A and B steps in
configuring ad-hoc. The establishment of Ad-hoc network can be
seen in below screen shots.
Figure5: The signal strength of ad-hoc of ‘raspi’
12
Figure6: The screen shots of SSH in Laptop as client
Using LAN Cable Capturing desiredimages:
The software’s used for capturing the images in desired time are
‘WinSCP and Putty. After plug-in lan cable to raspberry pi we can
know the IP address of the Lan-system this can be read by using
“raspi config” in client system. The below screenshot show the
mentioning of host name and port number. For most of the
networking port number is selected as 22.
Figure7: The screenshot of PuTTY with IP configuration
13
After selecting session and entering into the Putty setup. The login
and password of the raspberry pi need to be mention. In this
prototype version we used login: pi and password: pi
Then the connection of the raspberry pi with kit can be seen in
below screenshot of window. The controlling of the board and
accessing of the files and data that stored in the pi board can be
done by using any laptop or desktop as client. This type of
connection using Lan cable or Wifi adopter (SSH) function same
way. Initiallyin order to access the server remotely the connection
of both Wifi adopter and Lan cable is used for the better
performance of the prototype.Laterthe entire setupandoperation
are carried by wifi adopter.
Figure8: The screen shot of the client side command prompt.
The visualization of server(raspi board)sidecontentremotely:
14
The data or content of the raspberry pi can also be accessed
by using WinSCP software. The configurationand setup of the
network using WinSCP is same as PuTTy setup. After
configuring the setup using IP address, port and login and
password, the software looks as below screen shot. Based on
kindof function doneby clientside the protocolsare selected.
Figure9: Screenshot of WinSCP Login wizard
15
Figure10: The visualisation of all files and folders in client
Advantages of WinSCP
The desired files and images stored in the raspberry pi can be
accessed by the downloadplug-in availablein WinSCP
Figure11: Screenshot of downloading the “Bactrocera-Dorsals image”
16
The above mentioned softwares of PuTTY and WinSCP are used for
configuration for the remotely accessing of Raspberry pi by desired
client using LAN cable. The client desktop which located in far
distance from trap can access the data of the memory card using
SSH. Later the same operation are carried using the WiFi-adopter as
part of Ad-Hoc network establishment for remotely controlling by
commands. For capturing the images at desired time is explained as
fallows.
Test Results
For Capturing and downloading the images of pest at desired
time is carried by both softwares.
Step1: The PuTTY is configured for accessing the pi which
were connected with Pi-camera.
Step2: After the login and password the preview of the cmd
in client looks as below
17
Step3: The function used below capture the images (flies) by
pi-camera. Before going to capturing part the below
functions are need to be check for proper functioning of
camera.
sudoapt-getupdate
sudoraspi-config(Select enable camera from the list by
‘Enable’)
By the below the command we can capture images for
desired time and can save with unique number in jpg format.
Raspistill –o image_%4d.jpg –t1 1000 –t 20500
18
Figure12: The commands are passed for execution in client side
Figure13: Screenshot of Captured images are stored in /home/pi
19
Figure14: The desired image can be downloaded
Figure15: The pests in trap is marked after capturing by pi-camera
20
Figure16: The images of shaken Pi-camera
Sending captured images through mail
Step by step execution of the images sending through mail is carried
easily by command line but for long we also used open CV library files
for future processing of images in Version 2. In order to carry out the
task of sending images to desired person the below sequences need
to be fallow after entering into client side command line prompt:
To Install SSMTP:-
$sudo apt-get update
$sudo apt-get install ssmtp mailtutils
To configure SMTP:-
$sudo nano /etc/ssmtp/ssmtp.conf
The below commands are added to file
root=postmaster
mailhub=smtp.gmail.com:587
hostname=raspberrypi
AuthUser = Email@gmail.com
AuthPass=*********
21
UseSTARTTLS=YES
UseTLS=YES
To sent images to desired person mail Id we have to install few library
files.
Install mpack:-
$sudo apt-get install mpack
To sent a file with an attachment:-
$mpack –s subject 0001.jpg Email@gmail.com
The above mentioned way of sending images to desired persons mail
Id only satisfy the version 1 objectives for remotely accessing the data
of raspberry pi by client, but for analysing the images and to detect
the desired pest by understanding morphological features of pest the
above commands do not support long run. This involve real time
recognising and classification we have to use different library files. So
to meet this interest we approached “OpenCV”. It is an open source,
real-time computer vision library files. The below python program
sends the images desired mail Id with better quality.
Sending image to desired person by Python programme:
------------------------------------------------------------------------
# Send an HTML email with an embedded image and a plain text message for
# email clients that don't want to display the HTML.
import cv2
import time
import datetime
from email.MIMEMultipart import MIMEMultipart
from email.MIMEText import MIMEText
from email.MIMEImage import MIMEImage
ts=time.time()
st = datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d %H:%M:%S')
camera_port = 0
ramp_frames = 30
camera = cv2.VideoCapture(camera_port)
retval, im = camera.read()
22
file = st+'.png'
cv2.imwrite(file, im)
# capture object until your script exits
del(camera)
# Define these once; use them twice!
strFrom = 'sarvank20@gmail.com'
strTo = 'Email@gmail.com'
# Create the root message and fill in the from, to, and subject headers
msgRoot = MIMEMultipart('related')
msgRoot['Subject'] = st
msgRoot['From'] = strFrom
msgRoot['To'] = strTo
msgRoot.preamble = 'This is a multi-part message in MIME format.'
# Encapsulate the plain and HTML versions of the message body in an
# 'alternative' part, so message agents can decide which they want to
display.
msgAlternative = MIMEMultipart('alternative')
msgRoot.attach(msgAlternative)
msgText = MIMEText('This is the alternative plain text message.')
msgAlternative.attach(msgText)
# We reference the image in the IMG SRC attribute by the ID we give it below
msgText = MIMEText('<b>Here is the <i>new</i> image taken by the camera. The flies
canbe seen.</b> <br><img
src="cid:image1"><br>Success!!', 'html')
msgAlternative.attach(msgText)
# This example assumes the image is in the current directory
fp = open(file, 'rb')
msgImage = MIMEImage(fp.read())
fp.close()
# Define the image's ID as referenced above
msgImage.add_header('Content-ID', '<image1>')
msgRoot.attach(msgImage)
# Send the email (this example assumes SMTP authentication is required)
import smtplib
smtp = smtplib.SMTP()
smtp.connect('smtp.gmail.com:587')
smtp.starttls()
smtp.login(‘indisarvan@gmail.com', '**********')
smtp.sendmail(strFrom, strTo, msgRoot.as_string())
smtp.quit()
------------------------------------------------------------------------
Note: In order to carry out the above .py file, the open CV and python need to
be install on Raspberry pi.
23
Trail Tests with Version 1 Kit:
The trails tests are done
in DAIICT campus for validating and establishing the network with
client. The Power bank is providing power to kit with WiFi adopter in
below figure.
Figure17: The Version:1 kit with power bank without LAN cable
After the trail test of Kit with Power bank in controlled environment
the raspi-camera module-Lan cable the capturing of images are
succeeded up to passing commands and capturing images but the
raspberry pi went blank during storing in memory and actually
corrupted the entire raspbian Operating systems. Which again the
formatting of the O.S need to be carried out. When the trail teat again
conducted with wiFi adapter with general power source for
establishing Ad-Hoc network, the SSH get connected at one moment
and get disconnected at other moment. This shows that the
hypothesis of using Raspberry pi for automation is fully succeed in lab
trails but partial executed in real time environment. In order to carry
out the Version 1 Kit the Connection of LAN cable with uninterrupted
power source is must needed for fully functioning of Version 1.
24
Figure18: The Testing of kit for capturing images
Learnings from version 1:
1) Using Pi-camera in conventional traps for image capturing only
satisfy some portion of View. The mounting of camera on cap of
trap do not cover entire container.
2) The client side or base station have effective communication
with Raspberry pi by using LAN cable more than WiFi Adapter.
3) Initially for studying the images and detection for classification
the conventional pheromone trap design need to be change to
controlled environment.
4) The Operating system of Raspberry pi got corrupted due to
power limitations and when commands are passed continuously
for remotely accessing of pi from client get disconnected (LAN
and Ad-Hoc network).
25
Image studying using better edge detection:
The captured images in traps are tested with image detection
algorithms for better studying of pest data which helps in other in
versions. These below tests are carried by Matlab programs.
Figure19: The identification of Fly by different algorithms
26
Figure20: The identification of pest in trap by edge detection
The above edge detection algorithms specify the better identification
of the pest based on their size and shapes in traps. For classification
and effectively identification based on colour there is need of data set
of several thousand images of any single pest at different orientation.
These data sets are labelled and taken as reference for image tracking,
detection and classification in other versions.
27
References:
1) https://www.raspberrypi.org/learning/python-
picamera-setup/worksheet.md
2)http://opencvpython.blogspot.in/p/list-of-articles-in-
this-blog.html
3)http://stackoverflow.com/questions/13070038/attac
hment
4) http://geekgurldiaries.blogspot.co.uk/2014/03/get-
arty-with-raspberry-pi-camera.html
5)https://www.linode.com/docs/toolsreference/tools/
schedule-tasks-with-cron
6) http://code.activestate.com/recipes/473810-send-
an-html-email-with-embedded-image-and-plain-t/

More Related Content

What's hot

Tola.leng mail server (sq_mail &amp; rcmail)_q5_
Tola.leng mail server (sq_mail &amp; rcmail)_q5_Tola.leng mail server (sq_mail &amp; rcmail)_q5_
Tola.leng mail server (sq_mail &amp; rcmail)_q5_
Tola LENG
 
Feb. 22, 2005 EuroIMSA 2005
Feb. 22, 2005 EuroIMSA 2005 Feb. 22, 2005 EuroIMSA 2005
Feb. 22, 2005 EuroIMSA 2005
Videoguy
 
Chapter5_PlatformUsersGuide
Chapter5_PlatformUsersGuideChapter5_PlatformUsersGuide
Chapter5_PlatformUsersGuide
James D. Howes
 
Configure Proxy and Firewall (Iptables)
Configure Proxy and Firewall (Iptables)Configure Proxy and Firewall (Iptables)
Configure Proxy and Firewall (Iptables)
Tola LENG
 
TCPdump-Wireshark
TCPdump-WiresharkTCPdump-Wireshark
TCPdump-Wireshark
Harsh Singh
 
Sharing your-internet-connection-on-linux
Sharing your-internet-connection-on-linuxSharing your-internet-connection-on-linux
Sharing your-internet-connection-on-linux
jasembo
 
How to configure IPA-Server & Client-Centos 7
How to configure IPA-Server & Client-Centos 7How to configure IPA-Server & Client-Centos 7
How to configure IPA-Server & Client-Centos 7
Tola LENG
 

What's hot (20)

234821765 ccna-virtual-lab
234821765 ccna-virtual-lab234821765 ccna-virtual-lab
234821765 ccna-virtual-lab
 
Iperf Suite
Iperf SuiteIperf Suite
Iperf Suite
 
Tola.leng mail server (sq_mail &amp; rcmail)_q5_
Tola.leng mail server (sq_mail &amp; rcmail)_q5_Tola.leng mail server (sq_mail &amp; rcmail)_q5_
Tola.leng mail server (sq_mail &amp; rcmail)_q5_
 
EE4414 Multimedia Communication Systems II
EE4414 Multimedia Communication Systems IIEE4414 Multimedia Communication Systems II
EE4414 Multimedia Communication Systems II
 
Ad, dns, dhcp, file server
Ad, dns, dhcp, file serverAd, dns, dhcp, file server
Ad, dns, dhcp, file server
 
Feb. 22, 2005 EuroIMSA 2005
Feb. 22, 2005 EuroIMSA 2005 Feb. 22, 2005 EuroIMSA 2005
Feb. 22, 2005 EuroIMSA 2005
 
DNS windows server(2008R2) & linux(SLES 11)
DNS windows server(2008R2) & linux(SLES 11)DNS windows server(2008R2) & linux(SLES 11)
DNS windows server(2008R2) & linux(SLES 11)
 
Chapter5_PlatformUsersGuide
Chapter5_PlatformUsersGuideChapter5_PlatformUsersGuide
Chapter5_PlatformUsersGuide
 
Bootstrapping with bootp and dhcp
Bootstrapping with bootp and dhcpBootstrapping with bootp and dhcp
Bootstrapping with bootp and dhcp
 
Configure Proxy and Firewall (Iptables)
Configure Proxy and Firewall (Iptables)Configure Proxy and Firewall (Iptables)
Configure Proxy and Firewall (Iptables)
 
Computer Networking
Computer NetworkingComputer Networking
Computer Networking
 
Open vpn server_linux
Open vpn server_linuxOpen vpn server_linux
Open vpn server_linux
 
EMEA Airheads- Switch stacking_ ArubaOS Switch
EMEA Airheads- Switch stacking_ ArubaOS SwitchEMEA Airheads- Switch stacking_ ArubaOS Switch
EMEA Airheads- Switch stacking_ ArubaOS Switch
 
How deep is your buffer – Demystifying buffers and application performance
How deep is your buffer – Demystifying buffers and application performanceHow deep is your buffer – Demystifying buffers and application performance
How deep is your buffer – Demystifying buffers and application performance
 
Ccna icnd2-labs exercices
Ccna icnd2-labs exercicesCcna icnd2-labs exercices
Ccna icnd2-labs exercices
 
XPDDS18: Real Time in XEN on ARM - Andrii Anisov, EPAM Systems Inc.
XPDDS18: Real Time in XEN on ARM - Andrii Anisov, EPAM Systems Inc.XPDDS18: Real Time in XEN on ARM - Andrii Anisov, EPAM Systems Inc.
XPDDS18: Real Time in XEN on ARM - Andrii Anisov, EPAM Systems Inc.
 
TCPdump-Wireshark
TCPdump-WiresharkTCPdump-Wireshark
TCPdump-Wireshark
 
Sharing your-internet-connection-on-linux
Sharing your-internet-connection-on-linuxSharing your-internet-connection-on-linux
Sharing your-internet-connection-on-linux
 
Ex.no1
Ex.no1Ex.no1
Ex.no1
 
How to configure IPA-Server & Client-Centos 7
How to configure IPA-Server & Client-Centos 7How to configure IPA-Server & Client-Centos 7
How to configure IPA-Server & Client-Centos 7
 

Similar to Automation of pheromone traps

Raspi_TOR_Access_Point_BenMoore
Raspi_TOR_Access_Point_BenMooreRaspi_TOR_Access_Point_BenMoore
Raspi_TOR_Access_Point_BenMoore
Benjamin Moore
 
How to WRAPS like Snoop Dogg
How to WRAPS like Snoop DoggHow to WRAPS like Snoop Dogg
How to WRAPS like Snoop Dogg
Alex Kim
 
26.1.7 lab snort and firewall rules
26.1.7 lab   snort and firewall rules26.1.7 lab   snort and firewall rules
26.1.7 lab snort and firewall rules
Freddy Buenaño
 

Similar to Automation of pheromone traps (20)

Raspi_TOR_Access_Point_BenMoore
Raspi_TOR_Access_Point_BenMooreRaspi_TOR_Access_Point_BenMoore
Raspi_TOR_Access_Point_BenMoore
 
K1102026669
K1102026669K1102026669
K1102026669
 
Howto Pxeboot
Howto PxebootHowto Pxeboot
Howto Pxeboot
 
Capstone_Project.ppt
Capstone_Project.pptCapstone_Project.ppt
Capstone_Project.ppt
 
Video conferincing
Video conferincingVideo conferincing
Video conferincing
 
Develop Smart Solutions with Raspberry Pi and EnableX Live Video API
Develop Smart Solutions with Raspberry Pi and EnableX Live Video APIDevelop Smart Solutions with Raspberry Pi and EnableX Live Video API
Develop Smart Solutions with Raspberry Pi and EnableX Live Video API
 
Speech & Web based appliance control
Speech & Web based appliance controlSpeech & Web based appliance control
Speech & Web based appliance control
 
Ijaems apr-2016-17 Raspberry PI Based Artificial Vision Assisting System for ...
Ijaems apr-2016-17 Raspberry PI Based Artificial Vision Assisting System for ...Ijaems apr-2016-17 Raspberry PI Based Artificial Vision Assisting System for ...
Ijaems apr-2016-17 Raspberry PI Based Artificial Vision Assisting System for ...
 
Raspberry Pi Based GPS Tracking System and Face Recognition System.
Raspberry Pi Based GPS Tracking System and Face Recognition System.Raspberry Pi Based GPS Tracking System and Face Recognition System.
Raspberry Pi Based GPS Tracking System and Face Recognition System.
 
Raspberry with laptop
Raspberry with laptopRaspberry with laptop
Raspberry with laptop
 
New Microsoft PowerPoint Presentation (2).pptx
New Microsoft PowerPoint Presentation (2).pptxNew Microsoft PowerPoint Presentation (2).pptx
New Microsoft PowerPoint Presentation (2).pptx
 
Smart Wireless Surveillance Monitoring using RASPBERRY PI
Smart Wireless Surveillance Monitoring using RASPBERRY PISmart Wireless Surveillance Monitoring using RASPBERRY PI
Smart Wireless Surveillance Monitoring using RASPBERRY PI
 
Raspberry pi Board Hardware & Software Setup
Raspberry pi Board Hardware & Software SetupRaspberry pi Board Hardware & Software Setup
Raspberry pi Board Hardware & Software Setup
 
Installation And Configuration Of DNS, Web And FTP Servers On Virtual Machine...
Installation And Configuration Of DNS, Web And FTP Servers On Virtual Machine...Installation And Configuration Of DNS, Web And FTP Servers On Virtual Machine...
Installation And Configuration Of DNS, Web And FTP Servers On Virtual Machine...
 
Netw190 final project_joshua_brown
Netw190 final project_joshua_brownNetw190 final project_joshua_brown
Netw190 final project_joshua_brown
 
Backtrack Manual Part4
Backtrack Manual Part4Backtrack Manual Part4
Backtrack Manual Part4
 
Bulb Control using Web App with Raspberry Pi
Bulb Control using Web App with Raspberry Pi Bulb Control using Web App with Raspberry Pi
Bulb Control using Web App with Raspberry Pi
 
Chef arista devops days a'dam 2015
Chef arista devops days a'dam 2015Chef arista devops days a'dam 2015
Chef arista devops days a'dam 2015
 
How to WRAPS like Snoop Dogg
How to WRAPS like Snoop DoggHow to WRAPS like Snoop Dogg
How to WRAPS like Snoop Dogg
 
26.1.7 lab snort and firewall rules
26.1.7 lab   snort and firewall rules26.1.7 lab   snort and firewall rules
26.1.7 lab snort and firewall rules
 

More from sarvan k (7)

Installation of Sensors and Data loggers at project site
Installation of Sensors and Data loggers at project site Installation of Sensors and Data loggers at project site
Installation of Sensors and Data loggers at project site
 
Revamping clics using clic youth clubs
Revamping clics using clic youth clubsRevamping clics using clic youth clubs
Revamping clics using clic youth clubs
 
Ed x
Ed xEd x
Ed x
 
Kaizen 5s
Kaizen 5sKaizen 5s
Kaizen 5s
 
Documentaion of datalogger and arduino
Documentaion of datalogger and arduinoDocumentaion of datalogger and arduino
Documentaion of datalogger and arduino
 
Rajnikantslaptop sarvan
Rajnikantslaptop sarvanRajnikantslaptop sarvan
Rajnikantslaptop sarvan
 
Slide 1
Slide 1Slide 1
Slide 1
 

Recently uploaded

The Future of Autonomous Vehicles | civilthings.com | Detailed information
The Future of Autonomous Vehicles | civilthings.com |  Detailed informationThe Future of Autonomous Vehicles | civilthings.com |  Detailed information
The Future of Autonomous Vehicles | civilthings.com | Detailed information
gettygaming1
 
一比一原版BC毕业证波士顿学院毕业证成绩单如何办理
一比一原版BC毕业证波士顿学院毕业证成绩单如何办理一比一原版BC毕业证波士顿学院毕业证成绩单如何办理
一比一原版BC毕业证波士顿学院毕业证成绩单如何办理
amvovau
 
一比一原版SDSU毕业证圣地亚哥州立大学毕业证成绩单如何办理
一比一原版SDSU毕业证圣地亚哥州立大学毕业证成绩单如何办理一比一原版SDSU毕业证圣地亚哥州立大学毕业证成绩单如何办理
一比一原版SDSU毕业证圣地亚哥州立大学毕业证成绩单如何办理
psavhef
 

Recently uploaded (10)

The Future of Autonomous Vehicles | civilthings.com | Detailed information
The Future of Autonomous Vehicles | civilthings.com |  Detailed informationThe Future of Autonomous Vehicles | civilthings.com |  Detailed information
The Future of Autonomous Vehicles | civilthings.com | Detailed information
 
一比一原版BC毕业证波士顿学院毕业证成绩单如何办理
一比一原版BC毕业证波士顿学院毕业证成绩单如何办理一比一原版BC毕业证波士顿学院毕业证成绩单如何办理
一比一原版BC毕业证波士顿学院毕业证成绩单如何办理
 
Antique Plastic Traders Company Profile
Antique Plastic Traders Company ProfileAntique Plastic Traders Company Profile
Antique Plastic Traders Company Profile
 
Core technology of Hyundai Motor Group's EV platform 'E-GMP'
Core technology of Hyundai Motor Group's EV platform 'E-GMP'Core technology of Hyundai Motor Group's EV platform 'E-GMP'
Core technology of Hyundai Motor Group's EV platform 'E-GMP'
 
一比一原版SDSU毕业证圣地亚哥州立大学毕业证成绩单如何办理
一比一原版SDSU毕业证圣地亚哥州立大学毕业证成绩单如何办理一比一原版SDSU毕业证圣地亚哥州立大学毕业证成绩单如何办理
一比一原版SDSU毕业证圣地亚哥州立大学毕业证成绩单如何办理
 
Tyre Industrymarket overview with examples of CEAT
Tyre Industrymarket overview with examples of CEATTyre Industrymarket overview with examples of CEAT
Tyre Industrymarket overview with examples of CEAT
 
What Does the PARKTRONIC Inoperative, See Owner's Manual Message Mean for You...
What Does the PARKTRONIC Inoperative, See Owner's Manual Message Mean for You...What Does the PARKTRONIC Inoperative, See Owner's Manual Message Mean for You...
What Does the PARKTRONIC Inoperative, See Owner's Manual Message Mean for You...
 
Why Isn't Your BMW X5's Comfort Access Functioning Properly Find Out Here
Why Isn't Your BMW X5's Comfort Access Functioning Properly Find Out HereWhy Isn't Your BMW X5's Comfort Access Functioning Properly Find Out Here
Why Isn't Your BMW X5's Comfort Access Functioning Properly Find Out Here
 
Wondering if Your Mercedes EIS is at Fault Here’s How to Tell
Wondering if Your Mercedes EIS is at Fault Here’s How to TellWondering if Your Mercedes EIS is at Fault Here’s How to Tell
Wondering if Your Mercedes EIS is at Fault Here’s How to Tell
 
gtyccccccccccccccccccccccccccccccccccccccccccccccccccccccc
gtycccccccccccccccccccccccccccccccccccccccccccccccccccccccgtyccccccccccccccccccccccccccccccccccccccccccccccccccccccc
gtyccccccccccccccccccccccccccccccccccccccccccccccccccccccc
 

Automation of pheromone traps

  • 2. 2 Acknowledgement I express my sincere gratitude towards Mr. Lokesh Makam & Mr. Chaco Muller, my project coordinators, for giving me precious information about Barrix and about the work to being carried out by the organisation in Integrated Pest Management (IPM) and Organic Agriculture. I also take this opportunity to thank all the employees of Barrix fortheirsupport, encouragementandalsofor providing friendly environment, which was very vital during my internship period. Finally, I’m thankful to all the individualswhose names are not includedhere for theirsupport. Allof them have made my project a success. K V Y K Sarvan
  • 3. 3 Index Project Profile 04 Introduction 05 Hardware 05 First Version 06 Establishing Ad-Hoc Network 08 Test Results 16 Sending captured images through mail 20 Trail Tests with Version 1 23 Learning from Version 1 24 Image studying using better edge detection 25 References 27
  • 4. 4 Project Profile  Project Title: Automationof Pheromone Traps  Project Duration: 4 months  Submitted To: Dr. Ranendu Ghosh & Dr. Rahul Dubey  Submitted By: K V Y K Sarvan
  • 5. 5 Introduction: The pheromone traps are used for attracting agent to trap the pest which cause damage to fields. These are also act as monitoring purpose and best suitable for organic kind of farming. Barrix fruit trap or vegetable fly trap are the conventional trapswhich are presently using by the farmers in India. These conventional traps are located in far fields and it is difficult to farmer to find of which kind of pest actually attacking the field and maintaining those traps is labour intensive. In order to reduce the problem the suggested idea for improving the traps is using Automation in Pheromone Trap. The automationpart is divided into four versions. As a part of internship, the execution of first version is taken as task. Hardware In order to provide less power consuming and effective utilization of monitoring system the selected board for this purpose is “Raspberry Pi”.  Raspberry Pi board and Pi-camera  Network cable with router or switch  Power bank 10000mAh/1A
  • 6. 6  Desktop with Wireless PCI adapter  Nano Wifi adapter(802.11n)  Power Source and 16GB SD Card The operating systems and programming:  Linux-Raspbian(O.S)  Python-2.7  Eclipse software  Opencv  SSH 3.2.9  Putty and WinSCP First version The steps which are includedfor the first version are described as fallows- Step 1:- To integrate camera and Raspberry pi model B with power bank Step2: To conduct lab tests and send images captured by raspberry pi to desired person mail id in desired time period. Step3: Establish Ad-hoc network with desktop/lap top to Raspberry pi for remotely accessing. Step4: To conduct the prototype test along with whole setup in DA-IICT campus
  • 7. 7 The pheromone traps which are used need to be installed in any branch of trees, so initially for the project purpose we used NoIR camera for capturing the images during night time also after for the real time testing used ordinary pi camera. The full integration of kit can be seen in below images. Figure 1: NoIR mounted on the Trap Cap along with pheromone Figure 2: Set up with Raspberry pi-model B with Trap
  • 8. 8 In order to send the images directlyto desired mail id we used the python coding for the purpose as .py file along with the Ad-Hoc, the available methodologies are also tested for remotely accessing the images. ************************************************** Establishing Ad-hoc Network: The executionof the establishingthe network using Raspberry pi as server and any desktop/lap top as client. Hardware SetUp- For both Ad-hoc and Remotely Accessing using Lan cable: Figure 1: The Setup with Raspberry Pi-model B
  • 9. 9 Figure2: The Kit connected with Camera and Raspberry board A. Configuring Ad-HOC The fallowing commands are used to establish ad-hoc using LxTerminal window: Sudo ifconfig wlan0 down; sudo iwconfig wlan0 mode ad-hoc Sudo ifconfig wlan0 up Sudo iwconfig wlan0 essid raspi Sudo ifconfig wlan0 192.168.22.22 netmask 255.255.255.0 Sudo ifup wlan0 B. Check wlan0 status Sudo ifconfig Sudo iwlist wlan0 scan
  • 10. 10 Troubleshotting 1. Writing the wireless interface file which set statically Auto lo iface lo inet loopback iface eth0 inet dhcp iface wlan0 inet static address 192.168.22.22 netmask 255.255.255.0 2. Type sudo su root and ifdown wlan0; ifup wlan0 to restart wireless interface. 3. Sudolsusb and sudo lsmod used to verify about USB devices and wifi devices modules loaded or not. Figure3: The status of Ethernet cable and wifi adapter
  • 11. 11 Figure4: The status of Ad-hoc(signal strength) By troubleshooting and after repeating A and B steps in configuring ad-hoc. The establishment of Ad-hoc network can be seen in below screen shots. Figure5: The signal strength of ad-hoc of ‘raspi’
  • 12. 12 Figure6: The screen shots of SSH in Laptop as client Using LAN Cable Capturing desiredimages: The software’s used for capturing the images in desired time are ‘WinSCP and Putty. After plug-in lan cable to raspberry pi we can know the IP address of the Lan-system this can be read by using “raspi config” in client system. The below screenshot show the mentioning of host name and port number. For most of the networking port number is selected as 22. Figure7: The screenshot of PuTTY with IP configuration
  • 13. 13 After selecting session and entering into the Putty setup. The login and password of the raspberry pi need to be mention. In this prototype version we used login: pi and password: pi Then the connection of the raspberry pi with kit can be seen in below screenshot of window. The controlling of the board and accessing of the files and data that stored in the pi board can be done by using any laptop or desktop as client. This type of connection using Lan cable or Wifi adopter (SSH) function same way. Initiallyin order to access the server remotely the connection of both Wifi adopter and Lan cable is used for the better performance of the prototype.Laterthe entire setupandoperation are carried by wifi adopter. Figure8: The screen shot of the client side command prompt. The visualization of server(raspi board)sidecontentremotely:
  • 14. 14 The data or content of the raspberry pi can also be accessed by using WinSCP software. The configurationand setup of the network using WinSCP is same as PuTTy setup. After configuring the setup using IP address, port and login and password, the software looks as below screen shot. Based on kindof function doneby clientside the protocolsare selected. Figure9: Screenshot of WinSCP Login wizard
  • 15. 15 Figure10: The visualisation of all files and folders in client Advantages of WinSCP The desired files and images stored in the raspberry pi can be accessed by the downloadplug-in availablein WinSCP Figure11: Screenshot of downloading the “Bactrocera-Dorsals image”
  • 16. 16 The above mentioned softwares of PuTTY and WinSCP are used for configuration for the remotely accessing of Raspberry pi by desired client using LAN cable. The client desktop which located in far distance from trap can access the data of the memory card using SSH. Later the same operation are carried using the WiFi-adopter as part of Ad-Hoc network establishment for remotely controlling by commands. For capturing the images at desired time is explained as fallows. Test Results For Capturing and downloading the images of pest at desired time is carried by both softwares. Step1: The PuTTY is configured for accessing the pi which were connected with Pi-camera. Step2: After the login and password the preview of the cmd in client looks as below
  • 17. 17 Step3: The function used below capture the images (flies) by pi-camera. Before going to capturing part the below functions are need to be check for proper functioning of camera. sudoapt-getupdate sudoraspi-config(Select enable camera from the list by ‘Enable’) By the below the command we can capture images for desired time and can save with unique number in jpg format. Raspistill –o image_%4d.jpg –t1 1000 –t 20500
  • 18. 18 Figure12: The commands are passed for execution in client side Figure13: Screenshot of Captured images are stored in /home/pi
  • 19. 19 Figure14: The desired image can be downloaded Figure15: The pests in trap is marked after capturing by pi-camera
  • 20. 20 Figure16: The images of shaken Pi-camera Sending captured images through mail Step by step execution of the images sending through mail is carried easily by command line but for long we also used open CV library files for future processing of images in Version 2. In order to carry out the task of sending images to desired person the below sequences need to be fallow after entering into client side command line prompt: To Install SSMTP:- $sudo apt-get update $sudo apt-get install ssmtp mailtutils To configure SMTP:- $sudo nano /etc/ssmtp/ssmtp.conf The below commands are added to file root=postmaster mailhub=smtp.gmail.com:587 hostname=raspberrypi AuthUser = Email@gmail.com AuthPass=*********
  • 21. 21 UseSTARTTLS=YES UseTLS=YES To sent images to desired person mail Id we have to install few library files. Install mpack:- $sudo apt-get install mpack To sent a file with an attachment:- $mpack –s subject 0001.jpg Email@gmail.com The above mentioned way of sending images to desired persons mail Id only satisfy the version 1 objectives for remotely accessing the data of raspberry pi by client, but for analysing the images and to detect the desired pest by understanding morphological features of pest the above commands do not support long run. This involve real time recognising and classification we have to use different library files. So to meet this interest we approached “OpenCV”. It is an open source, real-time computer vision library files. The below python program sends the images desired mail Id with better quality. Sending image to desired person by Python programme: ------------------------------------------------------------------------ # Send an HTML email with an embedded image and a plain text message for # email clients that don't want to display the HTML. import cv2 import time import datetime from email.MIMEMultipart import MIMEMultipart from email.MIMEText import MIMEText from email.MIMEImage import MIMEImage ts=time.time() st = datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d %H:%M:%S') camera_port = 0 ramp_frames = 30 camera = cv2.VideoCapture(camera_port) retval, im = camera.read()
  • 22. 22 file = st+'.png' cv2.imwrite(file, im) # capture object until your script exits del(camera) # Define these once; use them twice! strFrom = 'sarvank20@gmail.com' strTo = 'Email@gmail.com' # Create the root message and fill in the from, to, and subject headers msgRoot = MIMEMultipart('related') msgRoot['Subject'] = st msgRoot['From'] = strFrom msgRoot['To'] = strTo msgRoot.preamble = 'This is a multi-part message in MIME format.' # Encapsulate the plain and HTML versions of the message body in an # 'alternative' part, so message agents can decide which they want to display. msgAlternative = MIMEMultipart('alternative') msgRoot.attach(msgAlternative) msgText = MIMEText('This is the alternative plain text message.') msgAlternative.attach(msgText) # We reference the image in the IMG SRC attribute by the ID we give it below msgText = MIMEText('<b>Here is the <i>new</i> image taken by the camera. The flies canbe seen.</b> <br><img src="cid:image1"><br>Success!!', 'html') msgAlternative.attach(msgText) # This example assumes the image is in the current directory fp = open(file, 'rb') msgImage = MIMEImage(fp.read()) fp.close() # Define the image's ID as referenced above msgImage.add_header('Content-ID', '<image1>') msgRoot.attach(msgImage) # Send the email (this example assumes SMTP authentication is required) import smtplib smtp = smtplib.SMTP() smtp.connect('smtp.gmail.com:587') smtp.starttls() smtp.login(‘indisarvan@gmail.com', '**********') smtp.sendmail(strFrom, strTo, msgRoot.as_string()) smtp.quit() ------------------------------------------------------------------------ Note: In order to carry out the above .py file, the open CV and python need to be install on Raspberry pi.
  • 23. 23 Trail Tests with Version 1 Kit: The trails tests are done in DAIICT campus for validating and establishing the network with client. The Power bank is providing power to kit with WiFi adopter in below figure. Figure17: The Version:1 kit with power bank without LAN cable After the trail test of Kit with Power bank in controlled environment the raspi-camera module-Lan cable the capturing of images are succeeded up to passing commands and capturing images but the raspberry pi went blank during storing in memory and actually corrupted the entire raspbian Operating systems. Which again the formatting of the O.S need to be carried out. When the trail teat again conducted with wiFi adapter with general power source for establishing Ad-Hoc network, the SSH get connected at one moment and get disconnected at other moment. This shows that the hypothesis of using Raspberry pi for automation is fully succeed in lab trails but partial executed in real time environment. In order to carry out the Version 1 Kit the Connection of LAN cable with uninterrupted power source is must needed for fully functioning of Version 1.
  • 24. 24 Figure18: The Testing of kit for capturing images Learnings from version 1: 1) Using Pi-camera in conventional traps for image capturing only satisfy some portion of View. The mounting of camera on cap of trap do not cover entire container. 2) The client side or base station have effective communication with Raspberry pi by using LAN cable more than WiFi Adapter. 3) Initially for studying the images and detection for classification the conventional pheromone trap design need to be change to controlled environment. 4) The Operating system of Raspberry pi got corrupted due to power limitations and when commands are passed continuously for remotely accessing of pi from client get disconnected (LAN and Ad-Hoc network).
  • 25. 25 Image studying using better edge detection: The captured images in traps are tested with image detection algorithms for better studying of pest data which helps in other in versions. These below tests are carried by Matlab programs. Figure19: The identification of Fly by different algorithms
  • 26. 26 Figure20: The identification of pest in trap by edge detection The above edge detection algorithms specify the better identification of the pest based on their size and shapes in traps. For classification and effectively identification based on colour there is need of data set of several thousand images of any single pest at different orientation. These data sets are labelled and taken as reference for image tracking, detection and classification in other versions.