Collars & Gateways

A framework to track elephant activity over short & long term and alert potential incidents in areas of human-elephant conflict.

The elephant edge challenge provides an exciting opportunity for ideas in conservation technology to be applied on the field. In this particular challenge, technology can play dual roles in mitigating human-animal conflict and in gaining advanced insights into short and long term behaviour of elephants.

The idea proposed and demonstrated in this project is a framework that combines smart collars and smart gateways.

Human-Elephant conflict in India

In India, between the years 2015 – 2018, human-elephant conflict caused 1713 human and 373 elephant deaths. Technology can help in reducing the deaths in some scenarios. For instance, 49 elephants died due to accidents with trains between 2016 – 2018. Coffee & Tea plantation roads that are increasingly used by tourists are becoming ever increasing scenes of conflict. Crop raiding by elephants destroys the livelihood of farmers and is becoming increasingly dangerous for humans and elephants. Some studies also indicate that hotspots of human-elephant conflicts are around edges of protected areas, plantations and riverine corridors.

Requirements of a technology solution

The common requirements of a technology framework solution for the different kinds of human-elephant conflict would include:

  • Accurate and reliable early warning systems deployed in identified hotspots.
  • Smart collar sensor data combined with edge machine learning to provide real time alerts that can be basic sensor based and more complex machine learning based detection of alerts such as human presence, gunshots, firecrackers, etc.
  • Sensor and machine learning data for insights into complex elephant behaviour.
  • Gateways to communicate with collars and send data over the cloud to a dashboard for Park/Forest officials.
  • Local alerts by the gateway to the people locally affected during human-elephant conflicts.

A common framework solution

This project proposes a framework to address these requirements. The following is a breakdown of the framework solution:

O Gateway towers with graded and configurable early warning systems based on geographical perimeters. For example, towers can have configured warning and alert perimeters. These can be used to send appropriate notifications when elephant collars enter/leave these perimeters.

O Notifications that are two fold:

  • Local notifications that can be adapted to the regional context. For example, alerts over Bluetooth mesh/SMS in farms, digital displays in forest roads and train tracks, Bluetooth mesh hopped messages to train drivers, etc.
  • Cloud notifications to the dashboard along with push alerts for remote monitoring by Park/Forest officials, etc.

The following common data types:

  • Real time collar data
  • Gateway tower configuration data
  • Gateway to dashboard data
  • Activity history data
  • Machine Learning (ML) history data

O With the real time collar data we can:

  • Send collar identification information
  • Send sensor data
  • Send real time ML detected events

O With the Gateway tower configuration we can:

  • Set geographic perimeters around any critical areas of human-animal conflict

O With the Gateway to dashboard data we can:

  • Combine data from gateway, collar and events through gateway monitoring, sensors & machine learning and send them to cloud dashboards.

O With the activity history we can:

  • Store the elephant activity detected through sensors when the collar is not in range of any gateway tower to broadcast.

O With the ML history we can:

  • Store events, behaviours and environment predictions. These can provide short term and long term insights into more complicated behaviour of elephants.

O With the addition of some sensor reading code, real sensor data from the collar can be pushed to gateways through the given code.

O Similarly different regional context or conflict area specific machine learning solutions can be “plugged-and-played” into this framework.

O It is also imagined that the software written for this challenge can be a guide in developing and deploying a robust version in the field (in a more native language like C).

The above proposed framework can be applied to:

  • Farmlands with frequent crop raiding by elephants
  • Railway track sections with higher incidence of accidents
  • Sanctuary borders that see human-elephant conflicts
  • Zones in forests that have high risk of poaching
  • Plantation roads where dangers to humans are high
  • Forest observation points for general monitoring of elephants
  • Similar setup for other endangered species that are in conflict with humans.


The code has been written with the following functionalities:

  • To read gateway tower configuration information from a JSON file.
  • Monitor geographical perimeters of the tower defined in the JSON file.
  • Generation of event messages when the elephant collar is in range and breaches the defined perimeters. This is done by checking the Cross Track distance of the elephant collar location from the four sides of the perimeter. As of now, this works for rectangular perimeters but not for any four sided polygons.
  • Different event messages generation for local and dashboard notifications.
  • Send data (containing tower, collar and event information) from device to IoT Connect dashboard

The following functions were added to simulate sensors and communication between LoRa and Bluetooth devices

  • Simulate an elephant collar coming in range of a LoRa gateway by defining a range radius and checking if the elephant is within that range by calculating the Haversine distance.
  • Mimic the gateway listening to elephant collars through LoRa or Bluetooth by connecting to a MQTT broker and subscribing (listening) for animal collar topics
  • Simulate an elephant moving through different areas and broadcasting information by reading artificial collar information from a prepared JSON file and publish the information periodically.


Sample real time collar data:

{  "collar_id": "Elephant214KLIN",  "animal_species": "Elephant",  "animal_name": "yaanai",  "animal_position": {    "latitude": 8.969345,    "longitude": 77.130787  },  "orientation": "North",  "activity": {    "current_state": "WALKING",    "mag_orientation": "UPRIGHT",    "duration": 13.5,    "acceleration": {      "x-axis": 0.5,      "y-axis": 0.21,      "z-axis": 0.03    }  },  "sensor_events": [    {      "level": "WARNING",      "event": "Low battery",      "value": 9    }  ],  "tiny_ml_detected_events": [    {      "level": "DANGER",      "event": "Firecracker sounds detected",      "confidence": 87.5    },    {      "level": "ALERT",      "event": "Human voices detected",      "confidence": 91.2    }  ],  "collar_charge": 75,  "last_gateway_sync": "2020-10-25 15:27:13"}

In this data structure, we have included the field: “animal_position” with latitude and longitude. This is included for the purposes of this simulation. The collar location during actual deployment will be calculated by the gateway tower connected to the LoRa Cloud.

Sample gateway to dashboard cloud data:

{  "dataArray": [    {      "data": {        "tower_id": "FarmlandGateway1",        "tower_area": "Theni",        "tower_position": {          "latitude": 8.955328,          "longitude": 77.13456        },        "tower_type": "FARM_LAND_TOWER",        "tower_zone": "CONFLICT",        "event_message": {          "level": "WARNING",          "text": "Yaanai inside FarmlandGateway1 warning perimeter"        }      },      "uniqueId": "FarmlandGateway1",      "time": "2020-10-27 19:12:34"    },    {      "data": {        "collar_id": "Elephant214KLIN",        "animal_species": "Elephant",        "animal_name": "yaanai",        "animal_position": {          "latitude": 8.969345,          "longitude": 77.130787        },        "orientation": "North",        "activity": {          "current_state": "WALKING",          "mag_orientation": "UPRIGHT",          "duration": 13.5,          "acceleration": {            "x-axis": 0.5,            "y-axis": 0.21,            "z-axis": 0.03          }        },        "collar_charge": 75,        "last_gateway_sync": "2020-10-25 15:27:13"      },      "uniqueId": "collarInfo",      "time": "2020-10-27 19:12:34"    }  ]}

Sample activity history data:

{  "collar_id": "Elephant214KLIN",  "animal_species": "Elephant",  "animal_name": "yaanai",  "activity_log": [  	{  	  "timestamp": "2020-10-25 15:21:45",  	  "state" : "RESTING",  	  "duration" : 27.5,  	  "orientation" : "UPRIGHT",  	  "acceleration": {	      "x-axis": 0.01,	      "y-axis": 0.03,	      "z-axis": 0.00	    },	  "mag_orientation": "North"    	},  	{  	  "timestamp": "2020-10-25 15:21:45",  	  "state" : "RESTING",  	  "duration" : 27.5,  	  "orientation" : "UPRIGHT",  	  "acceleration": {	      "x-axis": 0.01,	      "y-axis": 0.03,	      "z-axis": 0.00	    },	  "mag_orientation": "North"    	},  	{  	  "timestamp": "2020-10-25 15:21:45",  	  "state" : "RESTING",  	  "duration" : 27.5,  	  "orientation" : "UPRIGHT",  	  "acceleration": {	      "x-axis": 0.01,	      "y-axis": 0.03,	      "z-axis": 0.00	    },	  "mag_orientation": "North"    	}  }

Sample machine learning history on collar data:

{  "collar_id": "Elephant214KLIN",  "animal_species": "Elephant",  "animal_name": "yaanai",  "ml_prediction_log": [    {      "timestamp": "2020-10-25 15:21:45",      "event_prediction": {        "event": "WITH_HERD",        "level": "INFO",        "confidence": 94.7      },      "beaviour_prediction": {        "behaviour": "Agitated",        "confidence": 56.2      },      "environment_prediction": {        "environment": "RIVER_BANK",        "confidence": 65.3      }    },    {      "timestamp": "2020-10-25 15:45:06",      "event_prediction": {        "event": "WITH_HERD",        "level": "INFO",        "confidence": 95.1      },      "beaviour_prediction": {        "behaviour": "Normal",        "confidence": 86.2      },      "environment_prediction": {        "environment": "RIVER_BANK",        "confidence": 43.4      }    },    {      "timestamp": "2020-10-25 16:23:21",      "event_prediction": {        "event": "WITH_HERD",        "level": "INFO",        "confidence": 97.8      },      "beaviour_prediction": {        "behaviour": "Normal",        "confidence": 86.2      },      "environment_prediction": {        "environment": "THICK_FOREST",        "confidence": 43.4      }    }  ]} 


With the code and sample data included in this project we can simulate:

  • One or more elephants moving and broadcasting real time collar information.
  • One or more gateway towers listening for collar broadcasts.
  • Perimeter, sensor and ML based events.

Two reproducible simulations are included in this project.

Scenario 1: Elephant leaving sanctuary and crossing railway track

For this demonstration, a location in Edapalayam, Kerala, India has been picked. Here there is a railway track running through a forest area. Two towers have been added to monitor this potential conflict zone.

The simulated path of an elephant leaving the sanctuary, crossing the railway track and going to the forest on the other side:

The towers have configured warning and alert perimeters. However, they behave differently.

  • The Sanctuary edge tower, notifies when the elephant collar leaves the warning/alert perimeter.
  • The Railway tower notifies when the elephant collar is within the warning/alert perimeters.

A representation of the warning and alert areas of the two towers.

Source: Collars & Gateways

About The Author

Muhammad Bilal

I am highly skilled and motivated individual with a Master's degree in Computer Science. I have extensive experience in technical writing and a deep understanding of SEO practices.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top