Agricultural Monitoring with IoT and Machine Learning

Picture of yard under attack.

IoT and TinyML enable low-latency, low power and low bandwidth machine learning at the edge.

TJ VanToll

Principal Developer Advocate

Final pest detector hardware enclosed and set up outside for use

TJ VanToll



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

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 cellular IoT sensor prototype for continuous monitoring of environments and machines for less than $180, using only 5 hardware components.


Twilio SMS notification example

TJ VanToll

Why TinyML for Sustainable 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.

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. For connectivity, use the Blues Wireless Notecard, a cellular and GPS-enabled device-to-cloud data pump that comes with 500 MB of cellular connectivity data and 5,000 monthly consumption credits included. 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 IoT Agricultural Monitor

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 find the complete source code for the project at the GitHub repository linked below and complete project assembly instructions on Hackster.




Cost: $179.94

Project Time: 5 hours

Lines of Code: 13

Languages: Python


All hardware initially connected together for use

TJ VanToll


Software apps and online services

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.

How Blues Wireless Improves Agricultural Monitoring with ML

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 Agricultural Monitoring 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.

Blues Wireless device-to-cloud ecosystem diagram
Edge Impulse ML model detecting people and animals in image

TJ VanToll

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. This project required common animals and backyard pests to be identified, so Microsoft’s CameraTraps model, MegaDetector, was used.

CameraTraps' database is so extensive, it’s 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

Edge Impulse ML model detecting squirrel in the Raspberry Pi camera

TJ VanToll

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:

  • Speech activation
  • Wildfire detection
  • Flooding and water leak detection
  • Wearable health devices
  • Anomaly detection for predictive maintenance
  • Intelligent shipping
  • Gesture recognition for the visually impaired
  • Inventory management
  • Smart city devices (people counting, traffic monitoring)
  • Wildlife tracking

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

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. Schedule a consultation with a Blues Wireless Project Expert to discuss your project idea with you and help you find the shortest path to a proof-of-concept device to get your product or device connected to your cloud.

Contact Us

Frequently Asked Questions

    I need to measure different data. How can I customize this device?

    By adding a host MCU, you are able to capture any type of information and communicate it to the Notecard using our JSON interface over UART or I2C.

    If you have questions about acquisition or compatibility, please Contact Us.
    Which microcontrollers does the Blues Wireless Notecard support?

    The Notecard is compatible with any microcontroller (MCU) from an 8-bit Arduino to 32-bit ESP32 or STM32 and every major Single Board Computer (SBC) platform. Some popular examples include the Adafruit Huzzah32, STM32 Nucleo, Arduino Nano, ESP32-WROOM, among many others. The Notecard communicates over either I2C or UART, so it acts as a peripheral that you can connect to a product’s existing I2C bus or UART connection.

    It’s also possible to communicate with the Notecard from any embedded language, including compiled languages like C and C++, to interpreted languages like Python and JavaScript.

    Which cellular networks does the Blues Wireless Notecard utilize?

    Different models of the Blues Wireless Notecard are available that connect to LTE-M, NB-IoT, and Cat-1 networks globally. When LTE-M, NB-IoT, or Cat-1 aren’t available, the Notecard is also supported by UMTS/HSPA+ and GSM/GPRS/EDGE wireless standards.

    I need a fleet of devices. Are there options for me to buy a larger quantity?

    Yes! Blues Wireless can support your project whether you need 10 devices or 10,000. We also have relationships with device building firms and contract manufacturers to help bring your vision to life.

    Please Contact Us.
    Which countries does the Blues Wireless Notecard support?

    Global coverage is available in 135 countries, with direct support provided by leading providers and carriers. For a full list, please see our documentation article on Notecard’s supported countries.

    Which wireless standards are used by the Blues Wireless Notecard?

    Various Notecard models are available that connect to LTE-M, NB-IoT, and Cat-1 networks. In global regions without these capabilities, coverage is also supported by UMTS/HSPA+ and GSM/GPRS/EDGE wireless standards.

    Does the Blues Wireless Notecard require a Notecarrier to function?

    No! The Blues Wireless Notecard is a small 30mm x 35mm system on module (SoM) that is able to be embedded in any IoT project on its own via its M.2 edge connector.

    However, Blues Wireless provides a variety of Notecarrier host boards for easily adding cellular connectivity to a new or existing IoT solution for prototyping purposes. The Notecarrier also provides antennae for both the GPS and cellular capabilities of the Cellular Notecard (and the cellular antenna is also compatible with the Wi-Fi Notecard).

We’re making IoT quick and easy.

Start your IoT journey with us!