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

PDF
Interconnecting cisco networking devices part-1
PDF
Central management of network and call services
PDF
Configure Webserver & SSL secure & redirect in SuSE Linux Enterprise
PPTX
Solaris 10 Advanced Features.
PDF
000 236
PPT
IPTABLES
PDF
66_pfSenseTutorial
PDF
234821765 ccna-virtual-lab
Interconnecting cisco networking devices part-1
Central management of network and call services
Configure Webserver & SSL secure & redirect in SuSE Linux Enterprise
Solaris 10 Advanced Features.
000 236
IPTABLES
66_pfSenseTutorial
234821765 ccna-virtual-lab

What's hot (20)

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

Similar to Automation of pheromone traps (20)

PDF
Raspi_TOR_Access_Point_BenMoore
PDF
K1102026669
PDF
Howto Pxeboot
PPTX
Capstone_Project.ppt
PDF
Video conferincing
PDF
Develop Smart Solutions with Raspberry Pi and EnableX Live Video API
PDF
Speech & Web based appliance control
PDF
Ijaems apr-2016-17 Raspberry PI Based Artificial Vision Assisting System for ...
PDF
Raspberry Pi Based GPS Tracking System and Face Recognition System.
DOCX
Raspberry with laptop
PPTX
New Microsoft PowerPoint Presentation (2).pptx
PPTX
Openshift Presentation ppt compare with VM
PPT
Smart Wireless Surveillance Monitoring using RASPBERRY PI
PDF
Raspberry pi Board Hardware & Software Setup
DOCX
Installation And Configuration Of DNS, Web And FTP Servers On Virtual Machine...
PPTX
Netw190 final project_joshua_brown
DOCX
Backtrack Manual Part4
PPTX
Bulb Control using Web App with Raspberry Pi
PPTX
Chef arista devops days a'dam 2015
PDF
How to WRAPS like Snoop Dogg
Raspi_TOR_Access_Point_BenMoore
K1102026669
Howto Pxeboot
Capstone_Project.ppt
Video conferincing
Develop Smart Solutions with Raspberry Pi and EnableX Live Video API
Speech & Web based appliance control
Ijaems apr-2016-17 Raspberry PI Based Artificial Vision Assisting System for ...
Raspberry Pi Based GPS Tracking System and Face Recognition System.
Raspberry with laptop
New Microsoft PowerPoint Presentation (2).pptx
Openshift Presentation ppt compare with VM
Smart Wireless Surveillance Monitoring using RASPBERRY PI
Raspberry pi Board Hardware & Software Setup
Installation And Configuration Of DNS, Web And FTP Servers On Virtual Machine...
Netw190 final project_joshua_brown
Backtrack Manual Part4
Bulb Control using Web App with Raspberry Pi
Chef arista devops days a'dam 2015
How to WRAPS like Snoop Dogg
Ad

More from sarvan k (7)

DOCX
Installation of Sensors and Data loggers at project site
DOCX
Revamping clics using clic youth clubs
PPTX
Ed x
PPTX
Kaizen 5s
PDF
Documentaion of datalogger and arduino
PPTX
Rajnikantslaptop sarvan
PPTX
Slide 1
Installation of Sensors and Data loggers at project site
Revamping clics using clic youth clubs
Ed x
Kaizen 5s
Documentaion of datalogger and arduino
Rajnikantslaptop sarvan
Slide 1

Recently uploaded (20)

PPTX
Zeem: Transition Your Fleet, Seamlessly by Margaret Boelter
PDF
EC290C NL EC290CNL Volvo excavator specs.pdf
PDF
book-slidefsdljflsk fdslkfjslf sflgs.pdf
PDF
How Much does a Volvo EC290C NL EC290CNL Weight.pdf
PDF
Volvo EC290C NL EC290CNL Hydraulic Excavator Specs Manual.pdf
PPTX
capstoneoooooooooooooooooooooooooooooooooo
PDF
Marketing project 2024 for marketing students
PDF
Volvo EC290C NL EC290CNL Excavator Service Repair Manual Instant Download.pdf
PDF
EC290C NL EC290CNL - Volvo Service Repair Manual.pdf
PDF
Caterpillar CAT 312B L EXCAVATOR (2KW00001-UP) Operation and Maintenance Manu...
PPTX
laws of thermodynamics with diagrams details
PDF
Volvo EC300D L EC300DL excavator weight Manuals.pdf
PDF
Physics class 12thstep down transformer project.pdf
PDF
Life Cycle Analysis of Electric and Internal Combustion Engine Vehicles
PDF
Volvo EC20C Excavator Service maintenance schedules.pdf
PDF
Journal Meraj.pdfuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu
PPTX
Culture by Design.pptxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
PDF
computer system to create, modify, analyse or optimize an engineering design.
PDF
Caterpillar CAT 311B EXCAVATOR (8GR00001-UP) Operation and Maintenance Manual...
PPT
ACCOMPLISHMENT REPOERTS AND FILE OF GRADE 12 2021.ppt
Zeem: Transition Your Fleet, Seamlessly by Margaret Boelter
EC290C NL EC290CNL Volvo excavator specs.pdf
book-slidefsdljflsk fdslkfjslf sflgs.pdf
How Much does a Volvo EC290C NL EC290CNL Weight.pdf
Volvo EC290C NL EC290CNL Hydraulic Excavator Specs Manual.pdf
capstoneoooooooooooooooooooooooooooooooooo
Marketing project 2024 for marketing students
Volvo EC290C NL EC290CNL Excavator Service Repair Manual Instant Download.pdf
EC290C NL EC290CNL - Volvo Service Repair Manual.pdf
Caterpillar CAT 312B L EXCAVATOR (2KW00001-UP) Operation and Maintenance Manu...
laws of thermodynamics with diagrams details
Volvo EC300D L EC300DL excavator weight Manuals.pdf
Physics class 12thstep down transformer project.pdf
Life Cycle Analysis of Electric and Internal Combustion Engine Vehicles
Volvo EC20C Excavator Service maintenance schedules.pdf
Journal Meraj.pdfuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu
Culture by Design.pptxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
computer system to create, modify, analyse or optimize an engineering design.
Caterpillar CAT 311B EXCAVATOR (8GR00001-UP) Operation and Maintenance Manual...
ACCOMPLISHMENT REPOERTS AND FILE OF GRADE 12 2021.ppt

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.