---
title: Digitalizing the Wild with Blues
description: Explore a creative solution to help prevent human-wildlife conflicts with LoRa and Blues Cellular IoT.
source_url: https://dev.blues.io/blog/digitalizing-the-wild-with-blues/
canonical_url: https://dev.blues.io/blog/digitalizing-the-wild-with-blues/
markdown_url: https://dev.blues.io/blog/digitalizing-the-wild-with-blues.md
---

# Digitalizing the Wild with Blues

![Digitalizing the Wild with Blues banner](https://dev.blues.io/images/blog/posts/digitalizing-the-wild-with-blues/banner.jpg?v=a177a1a7)

August 31, 2023

## Explore a creative solution to help prevent human-wildlife conflicts with LoRa and Blues Cellular IoT.

- [Notehub](https://dev.blues.io/blog/tag/notehub)
- [Cellular](https://dev.blues.io/blog/tag/cellular)
- [Machine Learning](https://dev.blues.io/blog/tag/machine-learning)

[![Pradeep](https://dev.blues.io/images/blog/authors/pradeep.jpg?v=e589f9e0)](https://dev.blues.io/blog/author/pradeep/)

[PradeepVLSI Chip Testing Engineer](https://dev.blues.io/blog/author/pradeep/)

Photo by [Bernd 📷 Dittrich](https://unsplash.com/@hdbernd?utm_source=unsplash\&utm_medium=referral\&utm_content=creditCopyText) on [Unsplash](https://unsplash.com/photos/o2tCjrHTgwc?utm_source=unsplash\&utm_medium=referral\&utm_content=creditCopyText)

Human-wildlife conflicts are interactions between humans and wildlife that result in negative impacts on human social, economic, or cultural life, wildlife populations, or the environment. They occur when humans and wildlife share the same resources, such as land, water, food, or habitat, and when humans perceive wildlife as a threat to their safety, livelihood, or well-being.

![Elephants living amongst people](https://dev.blues.io/images/blog/posts/digitalizing-the-wild-with-blues/elephant.png?v=c2f1892a)

Human-wildlife conflicts are not a new phenomenon, but they have increased in frequency and intensity in recent decades due to various factors, such as human population growth, urbanization, habitat fragmentation, climate change, wildlife poaching, and illegal trade. These factors have reduced the natural habitats and resources of wildlife, forcing them to adapt to human-dominated landscapes and compete with humans for survival. In January 2023, a 64-year-old man in Tamil Nadu was attacked by an elephant that killed 21 people in Kerala and Tamil Nadu. The elephant, code-named PT 7, was tranquilized by a forest team and relocated to the Wayanad Elephant Camp. This is one example that shows the importance of finding effective and sustainable solutions to prevent human-wildlife conflicts.

Some innovative solutions that can reduce or deter human-wildlife conflicts include fencing, repellents, alarms, lights, or translocation.

## Let’s Build Better with Blues

In this post, I will show you how I created my own solution that detects an animal and alerts people with LoRa and Blues [Cellular IoT](https://dev.blues.io/cellular-iot/). Below is an illustration overview of the solution I built.

![Technology used for human-wildlife conflict solution](https://dev.blues.io/images/blog/posts/digitalizing-the-wild-with-blues/image30.png?v=76e34b4a)

For this project, I used a [Xiao ESP32s3 Sense board](https://www.seeedstudio.com/XIAO-ESP32S3-Sense-p-5639.html), which is a low-power controller with an onboard camera. This helped me classify wild animals using [Edge Impulse](https://www.edgeimpulse.com/). I then transferred the classification information to a Blues base station via LoRa. To complete this transfer, I designed a custom PCB that has both Xiao ESP32S3 Sense and LoRa Wio E5 modules.

![custom PCB](https://dev.blues.io/images/blog/posts/digitalizing-the-wild-with-blues/image14.png?v=1a53c9a4)

The Base station receives the LoRa signals and reverts them to the cloud network via Blues Cellular IoT.

![Blues base station and custom PCB](https://dev.blues.io/images/blog/posts/digitalizing-the-wild-with-blues/image20.png?v=5707d280)

## Edge Impulse Model Creation

I used Edge Impulse to develop an image classification system. To do this, I used 10 GB of data from [Kaggle](https://www.kaggle.com/datasets/antoreepjana/animals-detection-images-dataset?resource=download).

> **Note:**
>
> Larger data sets will give better results.

![Animals Detection Images Datasheet in Edge Impulse](https://dev.blues.io/images/blog/posts/digitalizing-the-wild-with-blues/image34.png?v=089c7467)

Next, I uploaded all the necessary image models to Edge Impulse.

![upload data section on Edge Impulse](https://dev.blues.io/images/blog/posts/digitalizing-the-wild-with-blues/image26.png?v=db8b4481)

Then, I labeled the images. For this step, you can label them manually, or you can generate predefined labels with YOLO V5.

![Labeling section on Edge Impulse](https://dev.blues.io/images/blog/posts/digitalizing-the-wild-with-blues/image22.png?v=57b5e2e2)

Next, I prepared the impulse design, with the classification set in the image below.

![Design section of Edge Impulse](https://dev.blues.io/images/blog/posts/digitalizing-the-wild-with-blues/image8.png?v=a76b6f35)

Then, I generated the model features. Below is my model output.

![Click to set a description for this version section of Edge Impulse](https://dev.blues.io/images/blog/posts/digitalizing-the-wild-with-blues/image2.png?v=e6dcf062)

Once I generated the model output, I deployed the model for Arduino IDE.

![Configure your deployment section of Edge Impulse](https://dev.blues.io/images/blog/posts/digitalizing-the-wild-with-blues/image17.png?v=98be438f)

## EL Model Deployment

The next step was to import the El Library to my Arduino IDE. To import, I opened the Arduino IDE and navigated to the Sketch tab. I then selected the Add Zip Library. Finally, I selected the downloaded zip file from the Edge Impulse portal to deploy the EI model to the Xiao ESP32S3 Sense.

![navigate to sketch > include library > Add ZIP libary](https://dev.blues.io/images/blog/posts/digitalizing-the-wild-with-blues/image32.png?v=a54f7975)

Here is the Arduino sketch’s flow that helped me classify the wild animals and transfer the alert via LoRa.

![Arduino Sketch flow](https://dev.blues.io/images/blog/posts/digitalizing-the-wild-with-blues/image19.png?v=0ef7880a)

To view the full code used in this section, see this [GitHub repo.](https://github.com/pradeeplogu0/Blues-Wild-Animal-Detector/blob/main/slave_node.ino)

This part of this Arduino sketch will send an alert message via LoRa if it detects any wild animal.

```c
#if EI_CLASSIFIER_OBJECT_DETECTION == 1
  bool bb_found = result.bounding_boxes[0].value > 0;
  for (size_t ix = 0; ix < result.bounding_boxes_count; ix++) {
    auto bb = result.bounding_boxes[ix];
    if (bb.value == 0) {
      continue;
    }
    ei_printf("    %s (%f) [ x: %u, y: %u, width: %u, height: %u ]\n", bb.label, bb.value, bb.x, bb.y, bb.width, bb.height);

    if (bb.label == "elephant")
    {
      Serial.println("Elephant Detected");
      node_send(1000);
      digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
      delay(1000);                       // wait for a second
      digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
      delay(1000);
    }
  }
  if (!bb_found) {
    ei_printf("    No objects found\n");
  }
```

Once the particular animal is detected, the above function will trigger the `node_send()` function. Here is the `node_send()` function definition.

```c
static int node_send(uint32_t timeout)
{
  static uint16_t count = 0;
  int ret = 0;
  char data[32];
  char cmd[128];
  int node = 1;
  int alarm = 1;
  memset(data, 0, sizeof(data));
  sprintf(data, "%04X,%04X", node, alarm);
  sprintf(cmd, "AT+TEST=TXLRPKT,\"5345454544%s\"\r\n", data);
  ret = at_send_check_response("TX DONE", 2000, cmd);
  if (ret == 1)
  {

    Serial.print("Sent successfully!\r\n");

  }
  else
  {
    Serial.print("Send failed!\r\n");
  }
  return ret;
}
```

This above function will send node number and alert message to the receiver when it is triggered.

Below, you can see the results of the Arduino serial monitor.

![Arduino serial monitor output](https://dev.blues.io/images/blog/posts/digitalizing-the-wild-with-blues/image33.png?v=9988f76e)

## Reciever Setup

Next, I worked on the base station side. I set up the base station to receive all the LoRa signals and alert users when data would be moved to [Blues Notehub](https://notehub.io/projects) via Notcard. Then, I set it to alert all remote users via [Qubitro](https://qubitro.com/).

![Blues base station and custom PCB](https://dev.blues.io/images/blog/posts/digitalizing-the-wild-with-blues/image20.png?v=5707d280)

In this image, both Xiao + LoRa E5 and Blues Notecard are connected to the Xiao ESP32 S3 board. I used this [Arduino sketch](https://github.com/pradeeplogu0/Blues-Wild-Animal-Detector/blob/main/master.ino) to receive the data from the slave node and then transferred it to [Blues Notehub](https://notehub.io/projects). Here you need to modify the product UID.

```bash
#define PRODUCT_UID "your project UID"
```

I then navigated to the Notehub | [Create Project](https://notehub.io/create-project) and created a new project.

![Create new project in Notehhub](https://dev.blues.io/images/blog/posts/digitalizing-the-wild-with-blues/image4.png?v=20f7e3f0)

I entered my project name, copied the project UID, and replaced it in the Arduino Sketch. After this, I was able to see the Blues Notehub starting to receive data.

![Data displayed in Blues Notehub](https://dev.blues.io/images/blog/posts/digitalizing-the-wild-with-blues/image7.png?v=fb75e2f9)

## Cloud Visualization

Once the data reached the Notehub, I used Qubitro to visualize and make an alert function based on the received data.

![Qubitro projects page](https://dev.blues.io/images/blog/posts/digitalizing-the-wild-with-blues/image9.png?v=7c6f0286)

Qubitro simplifies the IoT development process by providing tools, services, and infrastructure that enable users to connect their devices, store and visualize their data, and build robust applications without coding. Qubitro supports various IoT protocols and platforms, such as LoRaWAN, MQTT, and The Things Stack.

I navigated to the [Qubitro Portal](https://portal.qubitro.com/) and created a new project.

![Create new project pop up in Qubitro](https://dev.blues.io/images/blog/posts/digitalizing-the-wild-with-blues/image16.png?v=8bc9822a)

Then, I selected MQTT as the data source.

![Select MQTT as data source in Qubitro](https://dev.blues.io/images/blog/posts/digitalizing-the-wild-with-blues/image29.png?v=0ded50c1)

Next, I entered all the input details as needed.

![Insert input details for data source](https://dev.blues.io/images/blog/posts/digitalizing-the-wild-with-blues/image31.png?v=f91721a3)

Then, I opened the created MQTT source and selected the connection details. It will show you all the credentials, we need these credentials in order to transfer our data to Qubitro.

![Connection details and credientials](https://dev.blues.io/images/blog/posts/digitalizing-the-wild-with-blues/image23.png?v=bb4214f4)

### Routing Data Through Blues Notehub

Let’s move on to the Blues Notehub’s route page. Here, I created a new MQTT route and changed the username and password according to my Qubitro credentials.

![Route configuration](https://dev.blues.io/images/blog/posts/digitalizing-the-wild-with-blues/image11.png?v=5ea441bb)

At the bottom, I defined which data should move to Qubitro. Here I’m using body only. So, my payload only transferred to the Qubitro.

![transform data set to body only](https://dev.blues.io/images/blog/posts/digitalizing-the-wild-with-blues/image6.png?v=08b61274)

After my payload was successfully transferred to Qubitro, I opened the Qubitro portal to monitor the incoming data.

![Historical data on Qubitro](https://dev.blues.io/images/blog/posts/digitalizing-the-wild-with-blues/image3.png?v=63d3edcb)

### Visualizing Data

We can visualize the data via the Qubitro dashboard. First, I navigated to the Dashboard section and created a new dashboard.

![Creating a new dashboard](https://dev.blues.io/images/blog/posts/digitalizing-the-wild-with-blues/image37.png?v=238490c0)

Then, I clicked on edit and added the widgets I needed.

![Edit Widgets](https://dev.blues.io/images/blog/posts/digitalizing-the-wild-with-blues/image27.png?v=d3e5eabe)

Next, I have added the image widget with the data points, making it straightforward to comprehend the data levels.

![Widget configuration with data points](https://dev.blues.io/images/blog/posts/digitalizing-the-wild-with-blues/image1.png?v=1d70c266)

Then, I added a standard gauge to check and visualize the alert level.

![Adding Standard Gauge](https://dev.blues.io/images/blog/posts/digitalizing-the-wild-with-blues/image36.png?v=f6ef193d)

Finally, I used a state widget for slave number visualization

![Adding state widget](https://dev.blues.io/images/blog/posts/digitalizing-the-wild-with-blues/image24.png?v=6a524a3d)

and map widgets for GPS mapping.

![View of map widget for GPS mapping](https://dev.blues.io/images/blog/posts/digitalizing-the-wild-with-blues/image18.png?v=498b3bcb)

This was my final dashboard, which shows the location of my base station and the slave node’s status.

![Final Dashboard on Qubitro](https://dev.blues.io/images/blog/posts/digitalizing-the-wild-with-blues/image15.png?v=d18fef6c)

## Rule Engine Setup

In this section, I added a rule function to alert users when an anomaly is detected. To do this, I navigated to the function in the Qubitro portal and then selected the rule section.

![Create function section](https://dev.blues.io/images/blog/posts/digitalizing-the-wild-with-blues/image21.png?v=ca03fff3)

Then I created a new rule.

![Creating a new rule function](https://dev.blues.io/images/blog/posts/digitalizing-the-wild-with-blues/image35.png?v=80150f8d)

Here I used Webhooks. I entered all the basic details and moved to the next page.

![Setting up webhhooks](https://dev.blues.io/images/blog/posts/digitalizing-the-wild-with-blues/image13.png?v=a4e7ec36)

Then, I opened the [webhook site](https://webhook.site/) and copied the webhook URL.

![Webhook website](https://dev.blues.io/images/blog/posts/digitalizing-the-wild-with-blues/image25.png?v=e121ffca)

Next, I pasted the URL to the Qubitro rule page.

![Webhook url pasted in Qubitro rule page](https://dev.blues.io/images/blog/posts/digitalizing-the-wild-with-blues/image5.png?v=eb2f6503)

Then I selected the conditions. For this condition, my rule will trigger when my Alert level is greater than 0.

![Select conditions for rule](https://dev.blues.io/images/blog/posts/digitalizing-the-wild-with-blues/image12.png?v=9ce06a79)

Below is the webhook response.

![Webhook response on webhook site](https://dev.blues.io/images/blog/posts/digitalizing-the-wild-with-blues/image28.png?v=8011bdab)

At this point, you could use Twilio or Mailgun to send a customized SMS or email to alert you.

## Wrap up

Human-wildlife conflict can have negative impacts on biodiversity conservation, human development, and social harmony. It can also lead to retaliation against wildlife, which can further endanger their survival. With the help of Blues and Machine Learning, we can develop creative solutions to help overcome these issues.
