Automated Elephant-detection system

Real-time machine-vision based detection of elephants in rural areas: providing warnings to locals and thus prevent human-elephant conflict

Similar projects worth following
Human-elephant conflict (HEC) is a major cause of death and injury for both elephants and humans. Primary sources of conflict: elephants raiding human crops, unexpected encounters between humans and elephants as elephants traverse their established trails, elephants crossing railway lines. One way to prevent HEC is to automatically detect elephants & alert villagers, or train-drivers, to their presence via SMS, cloud-based apps, or LED signs.

In this solution:

1. Cameras mounted on poles or trees will obtain images of elephants
2. Compare images with known images of elephants
3. If probability of match higher than threshold, then notify village base station, and thus villagers

How can we solve the challenge of detecting elephants in order to provide local people with advance warning of their presence? Advance warning being particularly useful in that it can: a.) prevent people stumbling upon elephants unaware and spooking them b.) allow interception of crop-raiding elephants before they reach the crops (this is thought to be safest and easiest time to deter them). Early detection of elephants will mitigate human-elephant conflict, thus preventing death and injuries of both elephants and humans.

This short video from shows elephants launching their crop-raiding mission during the night,and the local people trying to scare them away.

In this solution, small weatherproof cases containing required elephant-detection system (elephant detection device) hardware will be tree- or pole-mounted in locations previously identified as being known to be passed by elephants. These locations could be a) interfaces between forests and farmland b) elephant pathways (these are the established trails that elephants use to move between, for example, forest and watering areas c) frequent railway-line crossings.

The elephant-detection system (elephant detection device) hardware will comprise [see them here]:

  • Raspberry Pi 3
  • camera module
  • communication via RF [or can make use of 3G if we are lucky enough to have coverage/ or GPRS as outlined in this log] short-range (120m) using XBee 2mW RF transmitters for sending to the field transmission stations
  • storage for image database (SD card)
  • solar panels and associated components
  • PIR sensor

It's imperative that the elephant-detection device is of very low-cost (<£100), as multiple devices will be required, and the budget of villagers affected might not be very high. The purpose of an elephant-detection system being open-source, is so that villagers can access plans, download software, purchase components, and assemble the system themselves; placing detection devices where they expect elephants!

How do we detect an elephant from the images that the camera obtains?

The most challenging part of the project is comparison of taken images of suspected elephants with known images of elephants! This would be quite easy if using MatLab, but this is not open-source and it's very expensive! Instead, I'm using OpenCV in Python to either compare histograms (the fastest and least intensive re processing & resources) or to feature match (slower and more resource intensive). This processing will be accomplished using the Raspberry Pi's on each elephant detection device, and the detection results will be transmitted via RF to the field transmission stations, and then onwards to the village base station.

I've outlined the different methods I'm testing in the following project logs:

This is an example overview of software and hardware activity on the elephant detection device, and the outcomes that positive and negative results of elephant detection would trigger. In this example, the histogram comparison method was employed:

Example placement of elephant-detection system components

As an example, I have used Sansiajang, Odisha, India. This village was identified in 'Human-Elephant Conflict: Case Study from Balasore and Rairangpur division of Mayurbhanj Elephant Reserve, Odisha, India' as being afflicted by human-elephant conflict.

As can be seen from the map, Sansiajang is surrounded by agricultural land, and has a large forest to the north, which is where elephants may wait before launching their crop-raiding missions. The elephant detection devices of the detection system would be placed at this interface between the forest and the agricultural land. The detection devices would be mounted at approx 1.5m above ground-level,... Read more »

  • 1 × Raspberry Pi 3 Model B Used for elephant detection device, field transmission station and village base station
  • 1 × Raspberry Pi 5MP Camera Module -> CSI interface on Pi (For Elephant Detection Device) £18.52
  • 2 × XBee 2mW Wire Antenna - Series 2 (ZigBee Mesh) Used for elephant detection device, field transmission station
  • 2 × SparkFun XBee Explorer Dongle (XBee -> USB -> Raspberry Pi) Used for elephant detection device, field transmission station
  • 1 × Long-range RF Modem Used for field transmission station and village base-station; Similar to XTend 900 1W RPSMA

View all 12 components

  • ElephantAI

    Neil K. Sheridan10/15/2017 at 19:07 0 comments

    Hi everyone! Don't forget to keep up with this project's new iteration! The ElephantAI! This is near to completion now and the build instructions for hardware and software are mostly all written up!

  • xpost from Elephant AI: Second results with object detector using Histogram of Oriented Gradients (HOG) and Linear Support Vector Machines (SVM)

    Neil K. Sheridan03/24/2017 at 22:34 0 comments
  • xpost from Elephant AI: object detector using Histogram of Oriented Gradients (HOG) and Linear Support Vector Machines (SVM)

    Neil K. Sheridan03/23/2017 at 20:53 0 comments

    First results with object detector using Histogram of Oriented Gradients (HOG) and Linear Support Vector Machines (SVM)

    See here:

  • Migrating to Elephant AI

    Neil K. Sheridan03/21/2017 at 21:34 0 comments

    Hi everyone! Thanks for following my project! I'm migrating it to Elephant AI now! This is for a new entry to the Hackaday 2017 prize! And it is a bit confusing too, as lots of my earlier plans for hardware and software here have been superseded! I can't believe I was thinking just histogram comparison or feature matching with FLANN would work!

    You can find the Elephant AI project here ->

  • Detecting poachers

    Neil K. Sheridan03/04/2017 at 21:04 0 comments

    One feature I am hoping to add to the elephant system is the capability to identify poachers. Obviously elephant detection devices will be in the correct place to spot them! But how can we train an image classifier to differentiate between good[!] people and poachers? What is distinct about a poacher? Well, it seems likely that poachers would carry a rifle ready for use when they are in the elephants' habitat! So is the difference between an image of someone carrying a rifle and someone not carrying a rifle enough to work with?

    So looking at some of these images, it does seem kinda hopeful that we could differentiate between humans carrying rifles vs. humans not carrying them!

    Source: NDTV videoOf course we need not work only with images to detect poachers! Once they fire their rifles we can 'easily' detect such a loud and distinct noise (unless it is raining heavily etc.). But that might not be so good because local people may be out hunting. Perhaps we could restrict poacher identification to night-time? I'm going to have a look thru literature on poacher behaviour to get a better idea.

    ** update regarding algorithms

    I'm currently trying out TensorFlow with or without Keras. as a more promising alternative to OpenCV.

    Just also, I'm not sure now about having one trained image classifier that would be used for every installation of the system. I think it would improve accuracy if we trained each system with a dataset of images obtained at that location.

  • Updates for Feb 2017

    Neil K. Sheridan02/28/2017 at 22:31 0 comments

    Hi everyone,

    I am currently working on reducing the false-positive detection rates by investigating other machine vision algorithms and training methods/image processing. I'm also studying deep-learning approaches to detection. And integrating auditory for a multi-modal approach to detection.

    As concerns actuators: besides the the audio repelling using tiger and bee sounds, I am investigating using mechanical actuators in form of pneumatic weapons to fire chilli balls into the path of crop-raiding elephants. Obviously the mention of a weapon is off-putting, but these would not harm elephants, and taking human-elephant contact out of the situation entirely would be really risk-reducing to both species.

    chilli pepper weapons inspired by ideas from the makerspace

    I'm also looking at how I could integrate poacher detection into the system. And steps we need to take to eliminate risk of this system being misused by poachers themselves (see: )

  • Elephant-deterrent devices

    Neil K. Sheridan10/17/2016 at 20:43 0 comments

    Instead of waiting for the local people to arrive and scare the elephants away from their crop-raiding missions, possibly endangering themselves, and the elephants, this add-on device aims to automatically deter elephants! Making use of sounds that they associate with animals they dislike!

    The two sounds which have previous experimental evidence for their efficacy in deterring elephants are: sounds of tigers and bees!

    Wild Asian elephants distinguish aggressive tiger and leopard growls according to perceived danger

    African elephants run from the sound of disturbed bees


    This device will have a library of 200x10 minute duration audio clips (bees, tigers) to be selected pseudo-randomly (to prevent elephants becoming habituated to audio). The devices will be in range of the elephant-detection devices (for communication via RF using the XBee 2mW), and triggered by a simple yes/no message from the elephant-detection devices to begin their sequence of playing elephant-deterrent audio clips (bees or tigers).

  • Final log for the 2016 competition

    Neil K. Sheridan10/09/2016 at 20:59 0 comments

    The elephant detection system will not be finished in time I'm afraid! The biggest problem towards the end was not being able to access elephants in order to obtain training images! The best training images would have come from the raspberry pi camera, which was not possible to do, since I had trouble getting access to elephants! So at the moment I'm working on as a proof of concept, using common garden animals (e.g. cat, fox, hedgehog, mouse, rat, badger) instead of elephants. This will also allow me to devise an appropriate IR LED array, and work on switching between IR-filtered and noIR-filtered cameras depending on day/night. That was the second biggest problem!

  • Obtaining images of elephants at night!

    Neil K. Sheridan09/23/2016 at 19:10 0 comments

    I hadn't even thought what a problem this would be until now! Elephants tend to launch their crop-raiding missions under the cover of darkness! I'm sure you would too! I've come up with several possible solutions:

    1. Two raspberry pi cameras: one with an IR filter (for daylight) and one without an IR filter (for darkness)
    2. One raspberry pi camera: use an IR-filtered raspberry pi camera but trigger a flash at the same time
    3. One external camera: don't use a raspberry pi camera, but use an external camera with a flash instead
    4. One raspberry pi camera: use a raspberry pi camera with no IR filter and only detect elephants in darkness

    I've narrowed this down to either solution 1 or solution 3. In fact, the 2015 hackaday prize had an entry for a pi camera multiplexer which can facilitate connection of both a raspberry pi IR-filtered camera, and a raspberry pi camera with no IR filter. We can decide which to use by employing a simple circuit with a photoresistor/LDR to determine if it's daytime or nighttime. However, we aren't going to see much at night without some infrared light. There are plenty of projects that have used IR LEDs for home security. But they are only designed for illuminating a human say 2-3m away from the LED array!

    To obtain an image of an elephant 10-20m from the elephant-detection device will take something it bit more powerful. What I'm stuck with at the moment is using something like an 11W IR illuminator, such as show below, which is obviously going to be a big drain on batteries and add more to the cost!

    I'm not keen on solution 3, because using a flash will most likely result in elephants avoiding the elephant-detection device.

  • Enclosures for the elephant-detection devices

    Neil K. Sheridan09/20/2016 at 19:15 0 comments

    I've been trialling a variety of enclosures, ranging from ABS boxes, to waterproof lunchboxes, to 3d-printable or laser-cut designs. Which is in-keeping with my goal of providing plans so people can make the elephant-detection system as easily and cheaply as possible. These are some of the 3d-printable designs which I'm currently working on:

    Obviously the elephant-shaped one is best!

View all 21 project logs

Enjoy this project?



smita20gule wrote 09/11/2018 at 04:46 point

Hii neil, your project is very good. As we are thinking to use the same concept to detect tigers in india. we need your help to implement this idea so can you please explain us about how we can design circuit diagram?. if you have any suggestion regarding this idea then you are most welcome! 

  Are you sure? yes | no

guhan.atkumar wrote 01/10/2017 at 06:56 point

Hi Neil, Your project is really good. I am trying to implement something similar to your project,in my case i'm from India and there are hundreds of elephants dying every year in accidents that happen due to trains passing through forests, can i implemet something like your project but all i need is to detect elephants and inform them to the near by train station or trains so that they could be warned to travel in a way slower speed ?.Will this be possible in a way cheaper price with just using motion sensors alone,if so can u please explain me about this and how about using dual infrared sensors parallel to train tracks?

  Are you sure? yes | no

Neil K. Sheridan wrote 03/03/2017 at 22:09 point

hi, ah I figure yes you could just have IR beam break circuit to do it,  parallel to train tracks in regions that elephants are known to cross. You could mount them on poles above human and other animal height so only elephants break the beam. Then use a modem like Huawei E303 to just SMS the train drivers to slow down. Yeah, it'd be way cheaper than using PIR in this context - since you just make a 'fence' of IR beams alongside the tracks. I've not seen anything greater than a 10m IR beam break circuit so I don't know how many multiple circuits you would need to make. Here's one somebody made for camera traps anyway

I imagine you could do a similar break circuit with a LASER too, that would have a much greater range than 10m! I don't know much abt costing but will look into it as it might be useful trigger for elephant detection devices vs. PIR.

  Are you sure? yes | no

Neil K. Sheridan wrote 03/03/2017 at 22:30 point

Actually I was just thinking.. there is another way to do this: instead of warning train drivers, we could warn the elephants of approaching trains. So we'd get an IR break beam circuit say 20km from the elephant crossing area, and when a train passed and broke the beam, we'd trigger a device at the elephant crossing point to make a certain sound that the elephants would associate with incoming danger. It's not great, because the elephants would have to see their friends hurt before they associated the noise with danger [:-(], but it would make a really low-cost addition to a protection system for elephants crossing the railway.

  Are you sure? yes | no

Em Bedd Hu Man wrote 05/02/2016 at 23:33 point

Hey Neil, I really like this. You know, I'm working on something similar, but not for elephants.

So I think your PIR sensor won't do much good because the cheaper ones have a 7 metre max. range. I've seen ones w/35 metre range but the price is aprox 60 USD. The camera will be able to see much farther. I also don't know the temperature over there, but I've run them in humid jungle temps and at anything above 35 or so they're unreliable.

In my experience w/opencv in RPi2b, it's extremely resource intensive and requires a lot of battery. I was using the C api so can't speak for python, but I was doing blob detection based on color & size using video. In short, it works, but it's a very expensive operation. Best to have power coming from a wall. I see you are using histograms based on images, which I'm not familiar with but sounds much more resource friendly than video operations.

Also, w/that small battery how do you expect to get more than a few hours out of that?

I think ideally you can use a gsm modem such a huawei e303 or similar zte model, both of which should have low power modes & are quite cheap. If you're interested I can also donate some C code I wrote that provide remote administration via SMS in a very resource friendly way, on a beaglebone green it idles @ .1 % cpu usage so on a Rpi3 it should be a good bit less.

Be sure to keep the updates coming, I am very interested to see how it performs in the wild. Thanks!

  Are you sure? yes | no

Neil K. Sheridan wrote 05/03/2016 at 11:15 point

Hi! Thanks! 

Ah, now I had not thought of that regarding the range of the PIR sensor! Thanks for bringing it up..  I'll have a look and see if I can find some lower cost long-range ones..

Glad to hear it works using the Raspberry Pi! Yes, I was worried it will be dreadfully resource intensive - I just hope the histogram method  will be accurate enough but I don't know..

Yeah, I'll have to move to a bigger battery for sure - that one is only for my prototype really. Thanks that would be great abt the code - I'll get back to regarding it when I progress to that stage :-) Thanks for tip re modem too; e303 is much cheaper than the one I found so far..

For sure I think there will be lots of ahem, 'interesting' problems when I test it in the wild !!

  Are you sure? yes | no

Yours Truly wrote 04/22/2016 at 15:47 point

Awesome project! Are you planning to integrate flashing lights and/or audio in order to scare away the elephants before they reach the crops?

  Are you sure? yes | no

Neil K. Sheridan wrote 04/22/2016 at 18:35 point

Thank you! :-) Yes, actually I was considering that! I was thinking of adding audio towers which would play random (so elephants didn't get used to them) sounds of tigers or bees..

  Are you sure? yes | no

Rimgar wrote 04/19/2016 at 19:39 point

Following a different approach using micorphones for detecting elephants, you might be interested in the research of Zeppelzauer et al.

  Are you sure? yes | no

Neil K. Sheridan wrote 04/19/2016 at 20:08 point

thanks! I had heard of that technique, but haven't seen the paper you linked..

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates