Smart Farming with IoT and Machine Learning
IoT and TinyML enable low-latency, low power and low bandwidth machine learning at the edge.TJ VanTollPrincipal Developer Advocate
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.
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
Hardware
- Blues Wireless Raspberry Pi Starter Kit:
- Blues Wireless Notecard SoM
- External cellular antenna
- Blues Wireless Notecarrier Pi Hat
- Raspberry Pi 4 Model B
- Raspberry Pi Camera Module V2
- PIR Motion Sensor (generic)
- Awclub ABS Plastic Junction Box
Software apps and online services
- Blues Wireless Notehub.io
- Twilio SMS Messaging API
- Edge Impulse (custom image classification modeling)
- Microsoft CameraTraps
The main parts of this project are:
- Connecting a microcontroller to a motion sensor and a camera
- Taking images
- Processing images via a machine learning model
- 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.
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.
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
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.
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.
The Blues Wireless Notecard and its companion Notecarrier-Pi HAT support virtually any Raspberry Pi-compatible single-board computer (SBC) with a 40-pin male header connector. Some examples of compatible SBCs include the balenaFin, Banana Pi, and the ROCK Pi.
Note that due to the power requirements of the Notecard, some Raspberry Pi 2 and 3 models include a current-limiting fuse that will power-cycle the device when the Notecard’s modem is on and transmitting. To avoid these issues, we recommend using Raspberry Pi 4 devices with the Notecard and Notecarrier Pi HAT.
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.
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.
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.
The Blues Wireless Notecard, combined with the Notecarrier-AF, is the easiest way to add cellular connectivity to your MCU-based IoT project. Blues Wireless provides a Feather Starter Kit that includes a Adafruit ESP32 HUZZAH to get you started as quickly as possible. Alternatively, if you are invested in the Raspberry Pi platform, you can get started with the Raspberry Pi Starter Kit.
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).
- Notecard: SoM peripheral with a cellular modem, IMU sensor, GPS modem, with an M.2 edge connector.
- Notecarrier: A prototyping board with cellular/Wi-Fi and GPS antennae, used to breakout the pins on the Notecard’s M.2 connector.
- Notehub: A cloud service, used as a backend to connect with the Notecard. Notehub.io securely receives all data and communications created by the Notecard. In turn, Notehub.io can securely sync encrypted data with the cloud application of your choice using VPN tunnels which eliminates the need for traffic to traverse the public Internet.
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