close-circle
Close

Elephant Detection Devices: software overview

A project log for Elephant AI

a system to prevent human-elephant conflict by detecting elephants using machine vision, and warning humans and/or repelling elephants

Neil K. Sheridan 10/15/2017 at 20:570 Comments

Let's do the example for dayPi

* main while loop is for the safe shutdown button, but I'm not sure it is worth the risk of using this.

So our while loops are going to be:

1. while light_sensor == True

The dayPi will operate whilst it is daylight according to the light sensor. So we use our def of check_light_sensor to get back HIGH or LOW from the light sensor. If this while loop breaks, we run our client code to become a client and send a message to the nightPi that it is time to start. Then we switch to server and wait for messages back. The messages are either regarding the light_sensor or a detection message which we must pass to our serial modem for sending out as SMS. Note that we continue to act as server until the light_sensor is True.

2. while PIR == HIGH

If the PIR sensor is HIGH, i.e. something hot is in range of the PIR, we need to perform our image capture, and then send the image to the elephant detector software

- take image

- send image to detector

 if image == elephant:

 - are we doing a deter? If yes, then we start the following while loop:

               - run our client code to use Bluetooth to send message to deter device. Once we get echo back from deter device that message is sent, we run our server code and wait for deter device to message us when deter performed

                -  if that failed we try again for n attempts 

                - if we get deter performed message back we break out of while loop

 - take data from detector and convert it to string containing top 5 elephant classes

 - compose our message containing all variables required (e.g. device location, time, deter done, top 5 elephant classes, etc.)

- save image of suspected elephant 

 - we now run our serial modem code to send SMS containing our message to phone numbers on list

- wait 60 seconds

if image == not elephant:

- wait 60 seconds

Let's do the example for nightPi

* main while loop is for the safe shutdown button, but I'm not sure it is worth the risk of using this.

So our while loops are going to be:

1. while light_sensor == False

The nightPi will operate whilst it is not daylight according to the light sensor. So we use our def of check_light_sensor to get back HIGH or LOW from the light sensor. If this while loop breaks, we run our client code to become a client and send a message to the dayPi that it is time to start. Then we switch to server and wait for a message back.

2. while PIR == HIGH

If the PIR sensor is HIGH, i.e. something hot is in range of the PIR, we need to switch on our IR illumination device, perform our image capture, and then send the image to the elephant detector software

- switch on IR illumination device

- take image

- send image to detector

 if image == elephant:

 - are we doing a deter? If yes, then we start the following while loop:

               - run our client code to use Bluetooth to send message to deter device. Once we get echo back from deter device that message is sent, we run our server code and wait for deter device to message us when deter performed

                -  if that failed we try again for n attempts 

                - if we get deter performed message back we break out of while loop

 - take data from detector and convert it to string containing top 5 elephant classes

 - compose our message containing all variables required (e.g. device location, time, deter done, top 5 elephant classes, etc.)

- save image of suspected elephant 

 - we now have to switch to client code, so we can send this message to the dayPi. Note that the dayPi has the serial modem, we don't. And the dayPi is now acting as a server. So we switch to client code and send it the detection message via Ethernet.

- wait 60 seconds

if image == not elephant:

- wait 60 seconds

Discussions