100% found this document useful (1 vote)
551 views13 pages

Smart Agriculturewith Arduinoe Book

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
551 views13 pages

Smart Agriculturewith Arduinoe Book

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

April 2023

INTRODUCTION TO
SMART AGRICULTURE
Table of Contents

04 CHAPTER - 1 Introduction

04 CHAPTER - 2 Using Arduino for Control

06 CHAPTER - 3 Wireless Communications for IoT


Applications in Smart Agriculture

08 CHAPTER - 4 Arduino IoT Cloud Platform

11 CHAPTER - 5 Powering your Smart Agriculture Project

12 CHAPTER - 6 Conclusion

2 https://community.element14.com/learn/publications/ebooks/
Introduction to Smart Agriculture

element14 is a Community of over 800,000 makers, professional engineers, electronics enthusiasts, and
everyone in between. Since our beginnings in 2009, we have provided a place to discuss electronics,
get help with your designs and projects, show off your skills by building a new prototype, and much
more. We also offer online learning courses such as our Essentials series, video tutorials from element14
Presents, and electronics competitions with our Design Challenges.

With the population of the world increasing every year, efficiency and sustainability in farming is
becoming more and more important. All of the world’s industries are working to make the shift to Green
Technology. Smart agriculture leverages modern advancements in technology to reduce costs and
increase productivity. Arduino boards are versatile devices that can be used to communicate with and
control the sensors and machinery that are used in farming. This eBook introduces you to the Arduino
family of products, including the Arduino Cloud platform, and how they can be used to build applications
for smart agriculture.

element14 Community Team

https://community.element14.com/learn/publications/ebooks/ 3
CHAPTER - 1 Introduction

Technology has been playing an important role in known examples includes smart thermostats, smart
agriculture for many years now. It has given farmers doorbells, and robot vacuum cleaners.
the tools necessary to help increase productivity,
improve crop yields, and reduce costs. One of the This eBook covers the use of Arduino and IoT in
more exciting technologies currently influencing smart agriculture applications. We will begin with
agriculture are Arduino microcontrollers. These a closer look at how Arduino control boards are
small, low cost devices can be programmed to used to control sensors and motors. Furthermore,
control a wide variety of sensors, motors, and relays. we will cover options to communicate with devices
For example, soil moisture levels, temperature, remotely. Once we have an understanding of what
humidity, and light levels can all be measured using can be collected and how, we will look into how
the right sensors with an Arduino. In addition, they this information can be organized and interpreted to
can be used to control irrigation systems, monitor make informed decisions. As we move through some
crop growth, and drive autonomous vehicles. of the topics, we will cover some examples and use
cases where appropriate. The complete list of topics
A closely related technology that is also becoming covered is shown below:
increasingly important in the sustainable
transformation of agriculture is the Internet of Things • Using Arduino for controlling sensors, motors,
(IoT). IoT generally describes a network of physical and relays
objects (the “Things”) which include embedded
• Options for connecting devices wirelessly for
sensors, software, and technology used to collect
remote communication
data. These devices also connect to the Internet and
transfer the accumulated data to a central location, • Options for monitoring information in an
where it can be processed, monitored, and used organized manner
to take action. IoT devices are already becoming
quite common in our everyday lives. Some well- • Powering your devices

CHAPTER - 2 Using Arduino for Control

An Arduino board is a great tool for controlling sensors


and motors. It is an open source platform, inexpensive,
easy-to-use, and has a large community for support
and reference material. As such, there are many
tutorials available for getting started with connecting
and programming the device. Furthermore, a wide
range of boards has also become available since the
creation of the original Arduino Uno.

There are currently three families of Arduino boards,


Figure 1. Arduino Uno
plus a pro series. The classic devices, as the name

4 https://community.element14.com/learn/publications/ebooks/
suggests, includes all the original devices, such as the these functions. Specific pins are also required to
Uno and Mega boards. These boards are great starting read analog inputs, create pulse width modulated
points for communicating with devices such as sensors outputs (PWM), or use GPIO. In addition, it is
and motors. They differ mainly in the amount of GPIO important to make sure that the sensors and
and peripheral interfaces available. The next available Arduino voltages are compliant with one another.
family is the Nano line. These boards come in a smaller Many sensors or integrated circuits operate with a
form factor and vary on the features they include. Wi- 3.3V supply voltage, while some Arduino boards
Fi and BLE modules can be included on board for operate with 5V voltages. Applying 5V to a 3.3V
wireless connectivity, in addition to sensors such as device can cause permanent damage to the lower
humidity, temperature, pressure, and microphone. The operating voltage device. To interface with these
last family of boards is the MKR family. The MKR series lower voltages, a variety of level shifting devices
was designed to be combined with shields and carrier are available.
boards to create projects without the need for any
additional circuitry. Every board features a Cortex-M0 2. Write the code to control the sensors. In general,
32-bit SAMD21 low power processor and a radio code is written in the Arduino IDE and uploaded
module that enables Wi-Fi, Bluetooth, LoRa, and NB- to the microcontroller. While other options are
IoT wireless communication. possible, this is the most straightforward and
common method.
Once a specific board is chosen, getting it to
communicate with various sensors or motors involves 3. Upload the program to the Arduino device and test
just a few steps. Gather the required components for the functionality. Uploading code to the Arduino is
the project; this includes the Arduino, sensors, jumper done through the IDE and involves the click of just
wires, power supplies, and breadboard or protoboard. a few buttons. After the code has been loaded onto
The following steps outline the general workflow for the Arduino, it begins to run, allowing the user to
creating working prototype projects. observe or test the functionality of the prototype.

1. Connect the sensors to the Arduino. This Below is an example program written to read in
involves identifying the proper pins to use on the temperature data from a general purpose TMP36
Arduino. For devices that require SPI or I2C for temperature sensor.
communication, the Arduino has dedicated pins for

Figure 2. Example Arduino program for


reading in data from a temperature sensor

https://community.element14.com/learn/publications/ebooks/ 5
The TMP36 is a low-cost and easy-to-use temperature the sensor data, convert it to a meaningful quantity, and
sensor. The device has three pins, one of which gets then “do something” with that data. In the above case,
connected to a supply voltage between 2.7V and we printed the temperature to a screen, however the
5.5V, another gets connected to ground, and the last data can be used to trigger a motor, turn on an LED, or
outputs a voltage that is linearly proportional to Celsius upload the data point to a database for storing.
temperature and can be read using an analog input
pin on the Arduino. Without any external calibration, An Arduino board is well suited to working with
the sensor can typically provide an accuracy of +/-2° electronics such as sensors and motors. It provides a
Celsius over a temperature range from -40°C to 125°C. simple platform for controlling and relaying information
between devices, in addition to having a very large
In Figure 2, the pin used for reading the sensor output community for support and reference. Generally,
is first declared. Next, the serial port is initialized in initial prototypes are created using an Arduino board,
order to display information to the computer screen along with jumper wires, breadboards, and sensor
while testing. Inside the main loop, the voltage is read modules. Once the prototype is tested and proven to
from the Arduino pin that is connected to the sensor be working, the next step usually taken is to create a
output. This voltage is then converted to a temperature PCB design to hold all the electronic components and
value and printed to the screen. The delay() command circuits. This allows for a cleaner overall solution that is
at the bottom of the loop tells the program to wait for custom tailored to one’s specific needs. For instance,
one-second before proceeding, ensuring the output is the Arduino circuitry can be combined onto a single
readable and not changing too fast. Although this is board with a temperature sensor, humidity sensor, and
a simple example program for a temperature sensor, photodiode for detecting light levels. This eliminates the
it demonstrates the simplicity the Arduino offers in need for any jumper wires, allows for a custom size and
interfacing to devices. The general idea for connecting shape that is more optimal for specific applications, and
to different types of sensors is the same. First, read in creates a more professional final product.

Wireless Communications for IoT


CHAPTER - 3 Applications in Smart Agriculture

After choosing the design and testing sensors or motor connectivity to farming applications, whether large or
connections, the next step might be adding wireless small scale.
communication to the device. This allows a network of
remote devices to relay information back to a central hub The first option we will cover is Long Range Radio (LoRa).
for monitoring. For example, an array of soil moisture LoRa was designed with IoT networks and machine-to-
sensors can be used to monitor conditions throughout machine interaction in mind. It also allows long-range
a field, allowing the user or system to target dryer areas communication and extended battery life, making it an
for irrigation. Wireless connectivity is actually an integral ideal choice for remote monitoring applications such
feature in IoT solutions for agriculture applications. as smart agriculture. LoRa is a proprietary technology
It may be the only usable communication option for developed by Semtech and communicates wirelessly in
monitoring the vast amounts of devices used in smart unlicensed spectrum bands from 137MHz to 1020MHz.
agriculture. On the other hand, wireless communication It uses a spread spectrum modulation that operates
is also a convenient feature for the urban farmer or with low data rates and can reliably communicate over
DIY enthusiast. With that said, there are a few different a range of multiple kilometers in rural environments. In
wireless technologies that can be used to bring remote urban environments, this range is reduced to hundreds

6 https://community.element14.com/learn/publications/ebooks/
of meters. LoRa can also support multiple network topologies such as point-to-point, mesh, and star. For users
who are just starting to work with wireless communications, the most important part may be its ease of use.
Using devices that utilize the LoRa protocol requires minimal setup and configuration. It also features end-to-end
encryption, which keeps sensitive data secure.

Figure 3. Plot showing the bandwidth vs range of different wireless technologies (https://www.semtech.com/lora)

The second option available is SigFox. SigFox is a global operates in the spectrum of licensed cellular networks.
wireless communications provider that offers a low power This can be within existing GSM carrier links, unused
wide area network (LPWAN) for IoT devices. Similar guard bands between LTE channels, or independently.
to LoRa, it allows for long-range communication and NB-IoT boosts communication range by using
enables long battery life through low power operation. narrowband communication, utilizing transmission
It also operates wirelessly in the unlicensed spectrum, repetitions, and deploying different transmission
utilizing a narrowband modulation. Each message is bandwidths to improve efficiency. Since the technology
100Hz wide and transfers data at 100 or 600 bits per utilizes cellular networks, it does have the advantage of
second depending on the region of operation. SigFox being able to leverage existing cellular infrastructure, for
uses a star network architecture where devices are not example, cell towers and base stations. To gain access
physically attached to a specific base station. Instead, to the networks, the devices typically require a SIM card,
the broadcasted communication can be received by any which allows the network to authenticate its connection.
base station within range, of which there may be three or In addition, some sort of paid subscription plan is
more on average. These base stations are then used to required for using the network’s resources; however,
transmit data to the cloud, where the data is processed with that investment also comes high levels of security.
and managed. Like LoRa, SigFox also offers end-to-end For NB-IoT, advanced encryption and authentication
encryption for secure wireless communication links. mechanisms are used to keep data transmitted over the
network secure.
A third available option is known as the Narrowband
Internet of Things (NB-IoT). Like the two aforementioned It is also worth mentioning Wi-Fi and Bluetooth here.
technologies, NB-IoT is designed for IoT wireless While they are not long-range options for wireless
communication and to meet the requirements of low communications on their own, there have been promising
power, extended battery life, and long-range coverage. developments for use in smart agriculture applications.
However, unlike the other technologies discussed, it Bluetooth mesh IoT is a mesh networking system that,

https://community.element14.com/learn/publications/ebooks/ 7
along with the newer BLE technology, offers a low power method for many devices to connect with one another.
As a result, one can find that a large network of Bluetooth devices can offer an option of coverage for a large area.
This also provides an ideal method of wireless communication for urban farming applications.

One example application using LoRa technology is a smart irrigation system. A smart irrigation system uses soil
moisture sensors and a valve controller to improve agricultural efficiency. In addition, light sensors, carbon dioxide
sensors, and humidity sensors were included for additional data analytics capabilities. The overall goal of the
smart irrigation system is to control the opening and closing of a water valve based on the soil moisture levels. As
a result, water consumption and labor costs can be reduced and crop irrigation efficiency can improve.

Figure 4. Example diagram showing the architecture of a smart irrigation system


(https://www.renkeer.com/soil-moisture-sensor-for-irrigation/)

CHAPTER - 4 Arduino IoT Cloud Platform

The Arduino IoT cloud platform is a cloud-based service monitoring, variable synchronization across devices,
designed for managing and monitoring IoT devices. It a jobs scheduler, over-the-air updates, Amazon Alexa
allows developers to connect their Arduino powered support, and dashboard sharing.
projects to the Internet, collect data, build a visual
dashboard, and monitor devices remotely. The platform To begin using the Arduino IoT cloud, a supported board
includes a range of tools for building and deploying IoT must first be chosen. This will depend on the application
devices, such as an online IDE, device manager, data needs, as well as the type of wireless communication
visualization tool, and an app builder. Like other Arduino that one wishes to use. For example, if we are working
products, a key benefit to using the platform is its ease on a project that uses LoRa for wireless communication,
of use. Minimal knowledge of networking and cloud there are two supported boards available from Arduino.
computing is required, and developing applications These are the MKR WAN 1300 and the MKR WAN 1310.
is intuitive and simple. Key features include data
8 https://community.element14.com/learn/publications/ebooks/
Figure 5. Arduino MKR WAN 1310

The next step involves creating an account on the Arduino IoT Cloud website. After gaining access to the website,
we can begin a new project by creating a “Thing”. Upon clicking on the “Things“ tab at the top of the screen, we
are presented with a page that will allow us to choose a device, connect to a network, and create new variables.
The variables created will automatically generate in a sketch that we can use later when writing code for the device.
All the expected variable types are available such as int and float types; however, there are also special variable
types available such as temperature and luminance. There is a large amount of additional specialized variables
available for use. They can be used as normal variables, but provide specialized wrappers that make working with
third party devices and dashboards more fluent.

Figure 6. Arduino IoT “Thing” page for setting up devices in a network (arduino.cc)

https://community.element14.com/learn/publications/ebooks/ 9
Devices are added and managed using the “Devices” tab The last step in getting a complete platform running is
at the top of the screen. In addition, connecting a Wi-Fi to create a dashboard. The dashboard can be created
network can be done through the “Network” section of through the “Dashboards” tab at the top center of
the “Setup” page (shown in Figure 6). After configuring the screen; this brings you to a page that allows you
the project, we can begin writing code for the devices. to see and edit existing dashboards, as well as create
The IDE and sketches work in a similar fashion to the new ones. The dashboards are generally created
original Arduino IDE. When opening up a sketch there using widgets, which are linked to variables that have
will be some additional code included for connecting to been created and used. It is as simple as choosing a
the network and cloud. The web IDE also allows users widget, selecting a Thing, and choosing the variable to
to verify and upload code to their devices. One of the link with the widget. Upon completion, the widget will
convenient features of the IoT platform is the ability to automatically start updating with real time information,
wirelessly update devices. There is no need to manually assuming the IoT device is powered on and wirelessly
connect to and program each device; code can be connected. Figure 7 shows an example dashboard with
pushed onto the devices through the web application. various available widgets.

Figure 7. Arduino IoT Dashboard (arduino.cc)

One example use case of the Arduino IoT Cloud is monitoring sensor data from various boards in the Arduino
MKR family. These include the MKR Wi-Fi 1010 and MKR ENV Shield. The shield integrates sensors such as
temperature, humidity, pressure, and illuminance. Following the steps above, the board must first be configured as
a new device and a Thing must be created. Next, new variables are created which correspond to the data that will
be collected (i.e. temperature) and a network connection must be made. After writing code that allows the sensor
values to be read, the dashboard can be constructed. Figure 8 shows the dashboard created to display the data
from various sensors.

10 https://community.element14.com/learn/publications/ebooks/
Figure 8. Example Arduino IoT dashboard displaying sensor data from MKR shield board (arduino.cc)

CHAPTER - 5 Powering your Smart Agriculture Project

Powering your smart devices is an essential part of Regardless, IoT devices will need some sort of battery
building a successful IoT network. In urban agriculture to hold charge, providing power when needed. Battery
environments, a simple solution such as power from a choices may be constrained by the size of the device
wall outlet or battery may suffice. In larger agricultural or available budget. Generally, smaller, inexpensive
environments, however, many devices can be located in batteries offer less power capacity. The three most
remote areas where running power to them or replacing widely available battery options are alkaline, lithium-
batteries may be impractical. The first step in powering ion, and lithium-polymer batteries. Alkaline is the most
the design comes from choosing the right components. In common, but also the poorest choice due to their output
these types of environments, choosing devices with low voltage degrading relatively quickly and their limited
power in mind is critical; saving even a few microwatts temperature range of operation. Lithium-ion batteries
can make the difference in a battery lasting either a year are the next best option and offer a considerably better
or five years. Furthermore, the wireless communication voltage discharge characteristic curve. Lastly, lithium-
used should be optimized for the lowest possible power polymer batteries offer wide temperature ranges,
consumption. Most of the wireless communication high energy densities, and low self-discharge rates.
protocols previously discussed already make efficient Nickel-metal hydride (NiMH) is an additional battery
use of low power communications. However, the most technology that offers a middle ground between alkaline
critical power consumption applications require care and lithium. The plot below compares the different
when choosing the best communication scheme. battery technologies voltage output over time under a
continuous discharge of 1W.

https://community.element14.com/learn/publications/ebooks/ 11
Figure 9. Comparison of different battery technologies (https://makermax.ca/articles/alkaline-vs-lithium-ion/)

For devices in remote locations, it may make sense to generation panels became available. Today it is possible
add some type of energy harvesting to the device to to find solar panels with efficiencies approaching 40%,
provide additional charge to the battery when possible. whereas in the past they were about 10%.
The most common of these approaches, especially
in agriculture applications, is through solar energy. A Although not practical for many agricultural
variety of different solar panels currently exist, with some environments, additional energy-harvesting methods
designed specifically for IoT applications. Some of these include vibration energy harvesting, fluid flow energy
include urethane panels, ETFE panels, and glass panels. harvesting, and direct energy harvesting where energy
They differ in cost, size, weight, and longevity. Modern is converted from a wireless signal to electrical power.
solar panel technology has vastly improved since first

CHAPTER - 6 Conclusion

We have covered some of the basics of how an Arduino board is used to communicate with sensors and how this
information can be transmitted wirelessly and displayed in an organized and professional interface. The Arduino
IoT Cloud serves as a versatile platform for users to begin building their IoT solutions. Additionally, we reviewed
various wireless communication protocols associated with IoT technology. Finally, a brief review of technology to
power remote devices was covered.

In conclusion, Arduino and IoT are already influencing agriculture. The technology allows for increased efficiency
and productivity while reducing costs. As the industry moves towards Green Technology, farmers will be able to
optimize their operations and increase their yields, making it possible to feed the growing population of the world
while also reducing the environmental impact of agriculture.

12 https://community.element14.com/learn/publications/ebooks/
Find out more about Arduino here.

300 S. Riverside Plaza, Suite 2200 Facebook.com/e14Community


Chicago, IL 60606 Twitter.com/e14Community
https://community.element14.com/

© 2023 by Newark Corporation, Chicago, IL 60606. All rights reserved. No portion of this publication, whether in whole or in part, can be reproduced without the express written consent of
Newark Corporation. Newark® is a registered trademark of Farnell Corp. All other registered and/or unregistered trademarks displayed in this publication constitute the intellectual property of
their respective holders. Printed in the U.S.A. WF-3279317

You might also like