TrunkLink - Visualizing Invisible Elephant Movements to Prevent Human–Wildlife Conflict
by CodersCafeTech in Circuits > Wireless
122 Views, 3 Favorites, 0 Comments
TrunkLink - Visualizing Invisible Elephant Movements to Prevent Human–Wildlife Conflict
We live in a place often called God’s Own Country, Kerala, where dense forests, monsoon fed landscapes, and rich biodiversity create one of the most beautiful ecosystems on Earth. Yet, beneath this beauty lies a growing conflict.
As forests shrink and human settlements expand, elephants are increasingly forced into villages and farmlands in search of food and water. The result is devastating on both sides, lives are lost, livelihoods are destroyed, and one of the planet’s most intelligent species faces constant threat.
This project is built on a simple belief: a better world is not one where humans dominate nature, but one where both can coexist safely.
TrunkLink is our attempt to move toward that future, an intelligent, connected system that combines Edge AI, IoT, and long range communication to predict elephant movement, understand their behavior, and alert communities before conflict occurs.
Instead of reacting to damage, TrunkLink focuses on prevention.
Instead of separating humans and wildlife, it enables coexistence.
By turning data into early warnings and awareness into action, this project reimagines how technology can protect not just people, but entire ecosystems, creating a future where progress and nature no longer stand in opposition, but move forward together.
Supplies
Hardware
- 1 x Nordic Thingy:91 X
- 1 x LoRa-E5 module (STM32WLE5)
- 1 x SenseCAP M2 LoRaWAN Gateway
- 1 x Solar Power Manager with MPPT
- 6 x 6V solar panels
- 1 x 3.7V Li-ion battery (1800 mAh)
- 1 x External LoRa antenna (UFL → SMA)
- 1 x 3D-printed enclosure
Software
- nRF Connect SDK (Zephyr RTOS)
- Edge Impulse
- Firebase Realtime Database
- The Things Network (TTN)
- Web dashboard (HTML / JS)
How It Works?
TrunkLink represents a shift from traditional GPS based tracking to an intelligent system designed for coexistence, where technology actively works to reduce conflict and protect both humans and wildlife. Built around the Nordic Thingy:91 X and enhanced with long range LoRa communication, it is engineered to function reliably in remote and challenging environments like the Western Ghats.
Real Time Location Awareness
Enables forest authorities to continuously monitor elephant movement, even in dense forests, turning unseen wildlife movement into actionable insight.
Community Centered Alert System
Empowers local communities with early warnings when elephants approach within a 5 kilometer radius, helping people make safer decisions and avoid dangerous encounters.
Behavior Aware Intelligence
Uses Edge AI to go beyond tracking, understanding how elephants move and identifying signs of stress or unusual activity, enabling faster and more informed intervention.
Proactive Boundary Monitoring
Allows rangers to define virtual safe zones and receive instant alerts when boundaries are crossed, shifting wildlife management from reactive control to proactive protection.
Setting Up the Nordic Thingy:91 X
For a system like TrunkLink, which operates in remote forests with limited infrastructure, the hardware needs to be reliable, compact, and power-efficient. The Nordic Thingy:91 X provides all of this in a single platform.
- High-accuracy GNSS with support for GPS, GLONASS, Galileo, and BeiDou ensures reliable positioning even under dense forest cover.
- The integrated nRF9151 System-in-Package combines processing and connectivity, reducing size and weight, which is critical for wearable collars.
- It is future-ready with support for satellite (Non-Terrestrial Network) connectivity, enabling operation even in completely disconnected regions.
- Advanced power management allows long-term deployment using solar energy with minimal maintenance.
To program the device, we use the nRF Connect SDK, which is built on the Zephyr RTOS and provides all required drivers and protocol support.
1. Install Dependencies
- Install SEGGER J-Link software for programming and debugging
- Install the nrfutil command-line tool for device management
2. Install nRF Connect SDK
- Install Visual Studio Code
- Add the nRF Connect for VS Code extension pack
- Use the extension to install:
- The required toolchain
- The appropriate version of the nRF Connect SDK
3. Verify Installation
- Connect the Thingy:91 X via USB
- Run the following command:
- Ensure the device is detected and the correct SDK/toolchain is selected in VS Code
To flash the application.
1. Create a Workspace
- Create a folder near the root directory (to avoid path issues)
- Example: C:\myfw\ncsfund
2. Create a New Application
- Open the nRF Connect extension in VS Code
- Select “Create New Application”
- Choose a sample (e.g., zephyr/samples/basic/blinky)
- Save it inside your workspace
3. Build Configuration
- Click “Add Build Configuration”
- Select the correct board target:
- thingy91x/nrf9151/ns
- Build the project
- Output binaries will be generated in the /build folder
4. Flash the Application
Run the following command to flash the firmware:
LoRa Hardware Used in TrunkLink
To enable reliable communication in remote forest regions where cellular networks are unavailable, TrunkLink uses a dedicated LoRa-based communication setup.
The primary communication module is the LoRa-E5 (STM32WLE5JC), which provides long-range, low-power wireless transmission. It is connected to the system via UART using the debug interface, with VCC connected to 3.3V, GND to ground, and TX/RX connected to pins 24 and 25. This allows communication using AT commands, enabling the system to send processed data over LoRa.
For antenna configuration, the module initially uses its built-in coil antenna during testing. However, for real-world deployment, a 2 dBi rubber duck antenna is used to achieve better range and signal penetration. This requires removing the onboard zero-ohm resistor and connecting a UFL-to-SMA connector to interface the external antenna with the module.
To receive and forward the transmitted data, a SenseCAP M2 LoRaWAN Gateway is used. This gateway acts as the backbone of the network, collecting LoRa data from field devices and forwarding it to the internet via Wi-Fi or Ethernet. Designed for continuous operation and wide-area coverage, it ensures stable communication even in dense forest environments.
Together, these components form a robust long-range communication system that enables TrunkLink to operate effectively in areas with no traditional network infrastructure.
Setting Up the Things Network (TTN)
With the SenseCAP M2 gateway already powered and connected to the internet, the next step is to configure it using The Things Network so it can forward LoRaWAN data from the device to the cloud.
1. Log in to TTN Console
- Open the TTN console
- Select the appropriate cluster or region
2. Create a New Application
- Navigate to Applications > Create Application
- Enter an Application ID and name
- Click Create Application
3. Register the Device
- Go to End Devices > Register End Device
- Choose Manual Registration
- Select the correct frequency plan
4. Generate Device Credentials
- DevEUI
- AppEUI
- AppKey
These credentials are required later in the firmware to establish secure communication between the device and the network.
5. Complete Registration
- Click Register End Device
Once configured, the gateway can successfully forward LoRaWAN packets from the field device to TTN, enabling real time data communication for the TrunkLink system.
Setting Up Edge Impulse for Elephant Behavior Classification
To enable TrunkLink to understand elephant behavior in real time, we built an Edge AI pipeline that processes motion sensor data directly on the device. This allows the system to classify behaviors and detect potential risks without depending on continuous cloud connectivity.
Dataset
The dataset is derived from animal behavior research adapted for elephant movement patterns. It includes four key behaviors: vigilance, resting, foraging, and running. The data is collected across multiple sessions to capture real-world variation, sampled at 100 Hz with 200 samples per episode. It uses tri-axial accelerometer data, which makes it suitable for deployment on a wearable collar.
Preparing the Dataset
The original dataset is stored in .mat format, so it needs to be converted before use. A preprocessing script is used to extract accelerometer values, convert them into time-series format, and scale the data if required. The conversion can be done using the command:
This generates a structured dataset in JSON format, organized by behavior, ready for training.
Uploading Data
The processed data is uploaded to Edge Impulse through the Data Acquisition section. Once uploaded, the dataset is split into training and testing sets, typically in an 80 to 20 ratio, to ensure the model can generalize well to unseen data.
Creating the Impulse
In the Impulse Design section, a new pipeline is created. A Raw Data processing block is used so the model can learn directly from sensor inputs, followed by a Classification learning block. This setup defines how the data flows through the system.
Feature Generation
Feature generation is performed using the Raw Data block with default settings. The system extracts patterns such as movement rhythm, intensity, and coordination across axes. These features help the model distinguish between different behaviors effectively.
Model Training
The model is trained using the default classifier settings. It learns to classify the four behaviors based on the extracted features. The trained model achieves around 96% accuracy, indicating strong performance.
Model Testing
The trained model is then evaluated using unseen data through the Model Testing section. This step verifies that the model performs reliably outside the training dataset and is ready for deployment.
Deployment
Finally, the model is exported as a C++ library from the Deployment section. This library is integrated into the firmware running on the device, enabling real-time behavior classification directly on the collar.
Setting Up Firebase
To enable real-time data communication for this project, we use Firebase and its Realtime Database service. Follow the steps below to set everything up properly.
Create a Firebase Project
Start by creating a new project in the Firebase Console. Click on Add Project, give it a name, and follow the setup instructions. Once created, this project will act as the backend for your application.
Add Firebase to Your App
After creating the project, add Firebase to your application by selecting the web (</>) option. Register your app with a name, and Firebase will generate a configuration object containing API keys and project details. This configuration is required to connect your application to Firebase.
Enable Realtime Database
Navigate to the Build → Realtime Database section in the Firebase Console. Create a new database, choose a region close to your users for better performance, and start in test mode for initial development.
The database will provide a unique URL, which is used to read and write data from your application.
Get Project Credentials
You will need the following details from your Firebase project:
- Project ID (found in Project Settings)
- Database URL
- Firebase configuration object (API key, auth domain, etc.)
These credentials are essential for initializing Firebase in your code.
Database Access and Security
Firebase provides a Database Secret (legacy method) that allows full read/write access. This can be found under Project Settings → Service Accounts. Treat this like a password and never expose it publicly.
Database Structure
The Realtime Database stores data in a JSON tree format. In this project, the structure is designed to manage device data, live location, and historical records efficiently
Web Interface
The TrunkLink web platform is designed with a dual-tier architecture, providing separate interfaces for public users and authorized forest rangers. This separation ensures that sensitive wildlife tracking data remains secure, while still enabling community awareness and participation.
Public Subscription Portal
The public portal allows users to create an account and subscribe to elephant proximity alerts by sharing their live location through their device’s GPS.
The system works by continuously fetching real-time elephant location data from Firebase. Distance calculations are performed directly on the user’s device, comparing their current position with all tracked elephant locations.
When an elephant enters within a 5-kilometer radius, the system instantly triggers a proximity alert. This approach ensures fast response times while reducing server load, as computations are handled client-side.
Authorized Ranger Dashboard
The ranger dashboard is built for advanced wildlife monitoring and management. It provides real-time elephant tracking through an interactive GIS-based map interface, allowing rangers to visualize movement patterns clearly.
The platform also includes dynamic geofencing tools, enabling the creation of virtual boundaries around protected or high-risk areas. When elephants cross these boundaries, immediate alerts are generated.
In addition, the system integrates Edge AI-based behavioral analysis, which detects unusual motion patterns that may indicate distress or aggressive behavior. These alerts are prioritized and delivered to rangers for quick response.
The dashboard further supports emergency coordination and provides detailed analytics, helping monitor population trends, study movement behavior, and assess human-elephant conflict scenarios effectively.
Power Management
The system is powered using a solar-based setup designed for reliability and efficiency in outdoor environments.
A 5V Solar Power Manager is used along with six solar panels connected in parallel, each providing approximately 70 mA at 6V. This configuration increases the overall current output while maintaining a stable voltage level.
The Solar Power Manager features built-in MPPT (Maximum Power Point Tracking), allowing it to optimize energy harvesting from the solar panels. It can supply up to 900 mA of charging current to a 3.7V Li-ion battery, whether powered via solar input or a USB source.
To keep the system simple and avoid modifying the Thingy:91 X, an external 1800 mAh battery is used. This approach ensures ease of integration and maintains the integrity of the hardware.
Additionally, the Solar Power Manager provides a USB output, which allows the Thingy:91 X to be powered directly using a standard USB cable. This makes the setup clean, modular, and easy to maintain.
The following block diagram illustrates the overall power distribution in the system.
Device Design
The device is built with an octagonal form factor, specifically designed to maximize the available surface area for solar energy harvesting. Six solar panels are arranged radially around a central point, ensuring efficient exposure to sunlight from multiple angles.
The enclosure is divided into three primary sections: a two-part upper assembly and a bottom compartment. The bottom section houses all core electronics, including the Thingy:91 X, the solar power management module, and the battery pack.
The modular upper sections are securely attached to the base using M3 × 15 mm fasteners, allowing easy assembly and maintenance. The entire structure is fabricated using 3D printing with PLA filament, making it lightweight and cost-effective.
For improved visual finish, the bottom layer of the upper assembly is spray-painted in grey, adding contrast and a more refined look.
The chosen military green color scheme serves a dual purpose. It helps the device blend naturally into outdoor environments for discreet deployment, while also giving it a clean, industrial aesthetic.
Assembly
The assembly process begins by installing the core electronics into the bottom compartment. The Thingy:91 X development board and the Solar Power Manager are mounted securely using M3 screws along with 3M double-sided tape for added stability. The debug probe is pre-connected to the Thingy:91 X to simplify setup.
Once the primary components are in place, the LoRa E5 module and battery pack are positioned inside the enclosure. The battery is placed close to the Thingy:91 X to reduce power transmission losses, while the LoRa module is located near the antenna mounting area for efficient signal routing.
The rubber duck antenna is then connected to the LoRa module and secured into the dedicated hexagonal slot. This ensures a firm hold and helps maintain stable signal transmission during operation.
Next, the six solar panels are attached to the grey-painted mounting surfaces using double-sided tape. All panels are connected in a parallel configuration to maximize current output, and the wiring is routed to the solar charge controller for centralized power management.
Finally, the enclosure is completed by assembling all housing sections and fastening them with M3 × 15 mm screws. This creates a strong and weather-resistant structure. A durable fabric belt is then attached to the integrated mounting extensions, enabling secure deployment on elephant collars for field use.
Deployment
We have successfully deployed TrunkLink on an elephant and verified its functionality through our website. Moving forward, we are looking to collaborate with the Wayanad Wildlife Sanctuary to implement similar tracking collars, further advancing our conservation efforts.
What's in the Future for TrunkLink
- Satellite Connectivity: Leverage the nRF9151's Non-Terrestrial Network (NTN) capability for direct satellite uplink, eliminating LoRa gateway dependencies and enabling global coverage in the most remote forests.
- Enhanced AI & Multi-Species Support: Predictive analytics for elephant movement forecasting, health monitoring through behavioral analysis, and expansion to other endangered species like tigers, leopards, and sloth bears.
- Mobile Apps & Community Features: Native iOS/Android apps for rangers with offline capability, community reporting portals, and smart non-harmful acoustic deterrent systems.
- Hardware Improvements: Biodegradable collar materials, extended battery life through kinetic energy harvesting, and integrated environmental sensors for water quality and vegetation health monitoring