Where cows come from?
It all started when a friend of mine working for a smart device integration business asked me for advice. Their company had a pilot project aimed at optimizing and automating operations on a dairy farm. They designed a device plugged into a cow's ear to track parameters like temperature, motion, location, and more. The goal was to provide farm owners visibility of the following situations:
- the temperature of the cow is out of range (cow freezes or ill)
- a cow spends little time near the feeder and drinker (poor weight gain possible)
- a cow is not active enough (cow feels unwell)
- cow's tracker signal lost (the cow escaped!)
- and anything else that can decrease milk yield and increase cow anxiety.
Apparently, farm owners also needed the data to be securely stored and seamlessly accepted from the hub located on the farm. At the people-facing side, they wanted live charts for every cow and notifications to farm workers once measurements are out of the normal range.
Picking the toolset
Having analyzed the above task, I turned from a software engineer to a sales manager and answered:
But even though flespi is good, it is not almighty (yet). flespi platform is great for data collection and storage, but the analytics module is still underway, which is why we needed an ally. We picked thingsboard.io platform as a high-level analysis tool for this project.
Integrating the solution
And the adventure began! It was a chilly late-October morning when we started transforming the Internet of Things into the Internet of Creatures.
I was working along with the team of flespi partners. They first installed a central hub to collect data:
Next, the guys attached the wireless sensors into the ears of the livestock. The good news is that the device can work for up to six months on a single charge — changing these batteries is much more challenging than the ones in your remote! Plugging in the sensor in the first place takes a lot of human effort and cow patience. In these 2 to 3 minutes that it takes a cow is shaking its head, moving ears, and trying to break free in every possible way. So the farm manager holds its head saying softly: “Stand still, baby. You are gonna be a cyborg soon”.
My part was to make flespi working in the described environment. We already know how to create a device in flespi. It took me 10 minutes to create a device and write a script that sends the data from a cow to the flespi device via REST API. And yes, I got the permission from the cow to use its personal data ;)
The messages I started getting from the hub installed on the farm look as follows:
{"temperature": 36.15,"outside": 5}
Note: Farm managers decided not to use the full potential of the tracking devices and started from monitoring temperature for several cows. Temperature data is very informative and can indicate that cow is ill, freezing, fertile, and so on. So just one measure is enough for the first stage of the project.
Building a web application
Creating an account on thingsboard.io is quick and straightforward. What is worth pointing out about this platform is that it’s an open-source project which runs on virtually any OS — even on an Amazon EC2 server or Raspberry Pi! For our testing purposes, we used demo PaaS on demo.thingsboard.io.
One overarching idea we want to convey in this article is that a great variety of IoT platforms (thingsboard.io being a nice example) offer intuitive workflow and toolset to build a fully-functional business application without any programming skills.
The next simple steps (mostly mouse-clicks) allowed me to build a beautiful dashboard with a live chart of temperature readings for every cow. They are clear and informative enough for use by farm staff as a production monitoring tool allowing to solve the tasks mentioned above.
1. Connect device on the flespi panel to a device on thingsboard.io.
2. Create a dashboard on thingsboard.io.
3. Show telemetry data for a thingsboard device on a time series plot widget.
Here is an example chart for a single cow (in-ear sensor and outside sensor).
And the entire dashboard:
The process of Big Data collection began, and now it’s up to the farm manager to determine the level of usefulness of this solution — it all boils down to analytical approaches they will use to prevent losses and forecast trends.
How flespi helps?
You might reasonably point out that the same scenario is doable without flespi. And it’s true. But let us justify the use of the flespi platform in a few strategic points:
- flespi looks outside. Data-collecting system resides on the local network — flespi is responsible for the Internet side. This allows services from other local networks (without public static IP but with Internet access) pull data from the flespi service. In this way, flespi can be a bridge connecting to local network applications without setting up VPS, static IP or updating a regularly changing DNS.
- flespi adds flexibility. If the need to change the data processing or visualization platform occurs, switching to a new one or streaming to an additional one will require minimal configuration.
- flespi stores telemetry. A built-in telematics database engine serves as a solid primary and backup database with messages stored for 10 years — no external solutions needed.
- flespi adapts easily. Changing the communication protocol or adding new types of devices to the network is quick and painless.
- flespi helps to fix. The platform offers extensive diagnostic tools to pinpoint and debug issues.
- flespi is reliable. We designed our system to work with 100 million simultaneous connections at a guaranteed service level. We developed a complex and feature-rich administration system. We implemented the fastest IoT cloud database in record time. We came up with a one of a kind protocol description technology. And packed it all for you.
Let’s take a ride to the connected future together.