Our most popular Notecard got an update. Learn more about the new Notecard Cellular.

Smart Farming with IoT and Machine Learning

smart robotic in agriculture futuristic concept, robot farmers (automation) must be programmed to work to collect vegetable and fruit by using deep learning and object recognition technology
IoT and TinyML enable low-latency, low power and low bandwidth machine learning at the edge.

Smart farming with IoT and machine learning devices enables growers in remote areas to detect pests and diseases in plants. By taking a picture of the plant and running machine learning models at the edge, farmers can correct environmental conditions or apply treatment in real time. If your device runs on cellular, there is no need for a wired internet connection for the device to work properly - a practical requirement for most growers.

When building proof-of-concept or prototype IoT devices it is important to spend most of your time on features that solve business problems, not utility functionality. To that end, Blues Wireless Notecard is the simplest, and most cost-effective way to add connectivity to IoT devices. Simply plug the Notecard into an M.2 connector and it’ll connect your device to the cellular network automatically, ready to transmit and receive data.

Learn how to build a smart farming device prototype with cellular connectivity for less than $180, using only 5 hardware components.

Smart farming with IoT and machine learning pest and plant health identification with AI

Download PDF
View Hackster Project
Get Source Code
smart farming to improve crop yield global warming drought conditions
Photo by Steve Harvey on Unsplash

Why TinyML for Precision Agriculture

In a world of increasing temperatures and population count, optimizing growing operations quickly becomes a necessity. The global population is expected to reach nearly 10 billion by 2050, requiring a radical shift in the way we produce (and consume) food. IoT and TinyML enable low-latency, low power and low bandwidth machine learning at the edge to deliver actionable intelligence to small-scale and remote farmers that would otherwise not have access.

Using TinyML, IoT devices deliver actionable intelligence to small-scale and remote farmers, enabling smart farming systems for precision agriculture. TinyML is an embedded machine learning framework that enables low-latency, low power and low bandwidth machine learning at the edge.

Handling machine learning at the edge means you don’t have to ship image or video files to a cloud software program. Not only will you save megabytes, but you’ll also have a quicker, more responsive system. For workloads where privacy is a concern, this means potentially sensitive images don’t leave the local device, nor are they stored anywhere.

Using a cloud-based dashboard allows data access from anywhere. US-based AgroPatterns uses the Blues Wireless Notecard and Notehub to manage their connected greenhouses in South America. The Notecard provides reliable cellular connectivity in remote growing areas, and comes with 500 MB of data usable over 10 years. For the fastest development time, plug the Notecard into a Notecarrier, a host board with extensions for headers, battery connections and antennae.

Use the Notecarrier Pi for this project because it has headers that are compatible with Raspberry Pi.

Behind the Smart Farming IoT Device

If you’re looking to start writing and validating a machine learning algorithm on a cellular IoT device prototype in less than a day, this is the best project to follow. You can easily adapt the instructions to fit your smart farming application.

Find the complete source code for the project at the GitHub repository linked below and complete project assembly instructions on Hackster.

GitHub: https://github.com/tjvantoll/pest-detector

Hackster: https://www.hackster.io/tjvantoll/what-s-destroying-my-yard-pest-detection-with-raspberry-pi-890c3a

Price: $179.94

Project Time: 5 hours

Lines of Code: 13

Languages: Python


Software apps and online services

Raspberry Pi Starter Kit from Blues Wireless

Diagram of the flow from pest detector to Notehub cloud and Twilio SMS alerts

The main parts of this project are:

  1. Connecting a microcontroller to a motion sensor and a camera
  2. Taking images
  3. Processing images via a machine learning model
  4. Triggering alerts if the machine learning system detects a targeted pattern

We found it shockingly easy to set up the hardware and software to begin training a model. Your success will be determined by the path you choose to get an appropriate machine learning model. Using Notecard lets you skip past the communications part of your project because the infrastructure, permissions, security, and provisioning all come out of the box for you.

Building Smart Farming Devices with Blues Wireless

Blues Wireless is the most cost effective and easiest way to add connectivity to a device. In 30 minutes, you can go from unboxing to sending arbitrary data over a global cellular network, with no configuration needed. Building the right smart farming device with Machine Learning is complex enough without having to deal with building a connectivity layer so we advise customers to skip that and use one of our pre-built System on a Module Notecards with zero-configuration provisioning for connectivity.

In the image below, you’ll see a left-to-right depiction of how sensor data moves from an edge device to a cloud application. Blues Wireless provides the infrastructure for bidirectional communication between edge devices and cloud endpoints via a combination of hardware and software. On the hardware side, in the host device, Blues Wireless Notecard System on a Module provides an internal endpoint for sensor data. Notecard securely transmits the sensor data to the customer’s preferred cloud endpoint via Blues Wireless Notehub, an intermediary cloud application. Notehub provides protocol translation, transport security, data routing, device management, and device firmware update capability.

How Image Classification Works in Machine Learning

The image classification process is built on modeling or training a system to recognize patterns. Once the machine learning model is “trained”, the system will produce a file containing the descriptors of the model the Machine Learning software will consume to learn the model.

The project referenced in this use case required common animals and backyard pests to be identified, so Microsoft’s CameraTraps model, MegaDetector, was used.

However, CameraTraps' database is so extensive, it becomes too processor-intensive for a Raspberry Pi at a low enough latency.  While the MegaDetector model worked for our demonstration project, we recommend using either a prebuilt model with TensorFlow or a custom model with Edge Impulse, because they use more appropriate resources for an IoT project. Be sure to read our documentation on using Edge Impulse with Blues Wireless.

For technical support with the Blues Wireless Notecard and Notecarrier, please visit dev.blues.io.

Smart agriculture concept, Agronomist or farmer use Artificial intelligence and augmented reality in farm to help grow systems, saving water ,resources reduce labor time, make high yield and predict

Other ML and TinyML Applications of this Project

This device is useful for object recognition and alerting. You can extend or repurpose this device by simply changing the ML model. Because Notecard provides bidirectional communication, you can easily send new models from the cloud to your device. A much easier upgrade than going out in the field to manually update devices, isn’t it? Remember, devices built using the Blues Wireless Notecard can be used anywhere, even if Wi-Fi access isn’t available. Here are some other ideas for this device:

  • Smart city devices (people counting, traffic monitoring)
  • Wildfire detection
  • Flooding and water leak detection
  • Wearable health devices
  • Anomaly detection for predictive maintenance
  • Intelligent shipping
  • Retail inventory management
  • Wildlife tracking
  • Speech activation and gesture recognition

Follow these instructions to learn how to build an IoT machine learning prototype.

smart city AI machine learning image recognition

Ready to Discuss Your Project With Us?

Blues Wireless makes it easy to make connected devices. In the article above, you’ve seen how little effort it takes to build an initial proof-of-concept device that reports sensor data over the cellular network. In some cases, it’s best to start with one of our proof-of-concept applications, then swap out sensors or cloud apps until you get what you want. In others, it would be best to take a different tact entirely.

We can help. Our team of experts will discuss your project idea with you and help you find the shortest path to a proof-of-concept device so you can get your product or device connected to your cloud.

Frequently Asked Questions

We’re making IoT quick and easy.

Start your IoT journey with us!

Subscribe to our newsletter

Expert tips, exciting projects, and IoT insights delivered every month