Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
122 commits
Select commit Hold shift + click to select a range
c42486c
content.md description
mcmchris May 23, 2023
daeab83
App note writing
mcmchris May 23, 2023
4fa9152
App note writing
mcmchris May 24, 2023
0532f70
App note writing
mcmchris May 24, 2023
1d0d8d2
App note writing
mcmchris May 24, 2023
4cfc221
App note writing
mcmchris May 24, 2023
88fa7fa
App note writing
mcmchris May 24, 2023
28047da
App note writing
mcmchris May 24, 2023
8339b8f
App note writing
mcmchris May 24, 2023
2f058fa
App note writing
mcmchris May 25, 2023
48dd04f
App note writing
mcmchris May 25, 2023
3f976e1
App note writing
mcmchris May 25, 2023
2a85e88
App note writing
mcmchris May 25, 2023
48c83f3
App note writing
mcmchris May 25, 2023
5ecb2df
App note writing
mcmchris May 25, 2023
57b5afa
App note writing
mcmchris May 25, 2023
b7ce4d8
App note writing
mcmchris May 25, 2023
c956bf3
App note writing
mcmchris May 25, 2023
e43acf1
App note writing
mcmchris May 25, 2023
2dc9d84
App note writing
mcmchris May 25, 2023
909c212
App note writing
mcmchris May 25, 2023
bfcdeb3
App note writing
mcmchris May 25, 2023
52c0892
Typos fixed
mcmchris May 25, 2023
30cf32d
Format fixed
mcmchris May 25, 2023
5092db0
Format fixed
mcmchris May 25, 2023
4aef2ce
Format fixed
mcmchris May 25, 2023
e465e3f
Format fixed
mcmchris May 25, 2023
dac7315
Format fixed
mcmchris May 25, 2023
fc2992a
Format fixed
mcmchris May 25, 2023
4ba1155
Format fixed
mcmchris May 25, 2023
ee3e8ed
Format fixed
mcmchris May 25, 2023
96a2df8
Format fixed
mcmchris May 25, 2023
24010d6
Format fixed
mcmchris May 25, 2023
ad5b920
Format fixed
mcmchris May 25, 2023
5fb6c88
Format fixed
mcmchris May 25, 2023
24676a5
Format fixed
mcmchris May 25, 2023
5f17ead
gif added
mcmchris May 25, 2023
facc8d4
Update content/hardware/05.pro-solutions/solutions-and-kits/edge-cont…
jhansson-ard May 26, 2023
5029d47
Apply suggestions from code review
jhansson-ard May 26, 2023
9c1b517
wiring-diagram-1 callout fonts switched to Roboto
mcmchris May 26, 2023
f186791
Titles size adjust
mcmchris May 26, 2023
09272b7
Update content/hardware/05.pro-solutions/solutions-and-kits/edge-cont…
mcmchris May 26, 2023
d931fa6
Format fix
mcmchris May 26, 2023
38ecd10
Format fix
mcmchris May 26, 2023
963247a
Format fix
mcmchris May 26, 2023
a2be02b
gif update
mcmchris May 26, 2023
d7292ae
photos aspect ratio fix
mcmchris May 26, 2023
bf797a2
gif update
mcmchris May 26, 2023
902ce7a
photos aspect ratio fix
mcmchris May 26, 2023
2b96cfd
photos aspect ratio fix
mcmchris May 26, 2023
2b4ee62
photos aspect ratio fix
mcmchris May 26, 2023
8dc3189
Typos fix
mcmchris May 27, 2023
5b1566c
GIF file compression patch
TaddyHC May 27, 2023
57ec8a7
GIF file compression patch
TaddyHC May 27, 2023
6fe9dd3
Content minor patch (For GIF Trigger)
TaddyHC May 27, 2023
623d9f3
Adding the 3 wires valve connection reference.
mcmchris May 28, 2023
8f4a469
Update content.md
mcmchris May 28, 2023
58787ef
Water volume formula explanation updated.
mcmchris May 28, 2023
ad4e4bf
Water volumen math expressions explained
mcmchris May 28, 2023
d767050
Update content/hardware/05.pro-solutions/solutions-and-kits/edge-cont…
jhansson-ard May 29, 2023
4e391d5
Add files via upload
mcmchris May 29, 2023
ebca89a
Delete dashboard.png
mcmchris May 29, 2023
07d8571
Update dashboard image aspect ratio
mcmchris May 29, 2023
a89ace7
Connections details image added
mcmchris May 29, 2023
c257253
thumbnail foot updated
mcmchris May 29, 2023
689576e
Intro update
mcmchris May 29, 2023
59e8c65
Numbers from 0-9 in letters
mcmchris May 29, 2023
f1024e0
Numbers from 0-9 in letters
mcmchris May 29, 2023
8431587
Liquid Level Sensor type added
mcmchris May 29, 2023
c4c1972
Materials list update
mcmchris May 29, 2023
005ce68
Codes to Sketches
mcmchris May 29, 2023
a0343cb
Title update
mcmchris May 29, 2023
18db88b
Image updates
mcmchris May 29, 2023
9585aa4
Merge branch 'mcmchris/edge-control/smart-irrigation-system' of https…
mcmchris May 29, 2023
be9a9b9
Overview update (long phrases fix)
mcmchris May 29, 2023
0d64824
Overview words update
mcmchris May 29, 2023
80ab8fc
Merge branch 'mcmchris/edge-control/smart-irrigation-system' of https…
mcmchris May 29, 2023
1d79ea5
Rephrasing on *Valves Control* paragraph
mcmchris May 29, 2023
1f39cfa
Simplifying *Water Usage* paragraph
mcmchris May 29, 2023
2374a71
Simplifying *Weather Forecast Consideration* paragraph
mcmchris May 29, 2023
3133d58
Update content/hardware/05.pro-solutions/solutions-and-kits/edge-cont…
mcmchris May 29, 2023
e5802b9
Update content/hardware/05.pro-solutions/solutions-and-kits/edge-cont…
mcmchris May 29, 2023
ed73fc3
update content.md
mcmchris May 29, 2023
d966275
Merge branch 'mcmchris/edge-control/smart-irrigation-system' of https…
mcmchris May 29, 2023
90503e4
update content.md
mcmchris May 29, 2023
8944955
update content.md
mcmchris May 29, 2023
c15d789
update content.md
mcmchris May 29, 2023
e930de6
update content.md
mcmchris May 29, 2023
3e5d4a8
update wiring images
mcmchris May 29, 2023
e74f395
update wiring images
mcmchris May 29, 2023
4185ee9
update wiring images
mcmchris May 29, 2023
6e58adb
update wiring images
mcmchris May 29, 2023
7a9cc8a
update wiring images
mcmchris May 29, 2023
e5686c9
Sketches commented functions delete
mcmchris May 29, 2023
a39dd10
Update content/hardware/05.pro-solutions/solutions-and-kits/edge-cont…
jcarolinares May 30, 2023
1c50279
Update content/hardware/05.pro-solutions/solutions-and-kits/edge-cont…
jcarolinares May 30, 2023
64427b2
Update content/hardware/05.pro-solutions/solutions-and-kits/edge-cont…
jcarolinares May 30, 2023
c5e8579
Update content/hardware/05.pro-solutions/solutions-and-kits/edge-cont…
jcarolinares May 30, 2023
cf7f630
Update content/hardware/05.pro-solutions/solutions-and-kits/edge-cont…
jcarolinares May 30, 2023
80f220e
Update content/hardware/05.pro-solutions/solutions-and-kits/edge-cont…
jcarolinares May 30, 2023
9f036e9
Update content/hardware/05.pro-solutions/solutions-and-kits/edge-cont…
jcarolinares May 30, 2023
16979db
Update content/hardware/05.pro-solutions/solutions-and-kits/edge-cont…
jcarolinares May 30, 2023
989072b
Update content/hardware/05.pro-solutions/solutions-and-kits/edge-cont…
jcarolinares May 30, 2023
652fc09
Update content/hardware/05.pro-solutions/solutions-and-kits/edge-cont…
jcarolinares May 30, 2023
e664813
Update content/hardware/05.pro-solutions/solutions-and-kits/edge-cont…
jcarolinares May 30, 2023
e50f15e
Update content/hardware/05.pro-solutions/solutions-and-kits/edge-cont…
jcarolinares May 30, 2023
298f803
Update content/hardware/05.pro-solutions/solutions-and-kits/edge-cont…
jcarolinares May 30, 2023
010cdf6
Update content/hardware/05.pro-solutions/solutions-and-kits/edge-cont…
jcarolinares May 30, 2023
93ec676
Update content/hardware/05.pro-solutions/solutions-and-kits/edge-cont…
jcarolinares May 30, 2023
67f623b
Update content/hardware/05.pro-solutions/solutions-and-kits/edge-cont…
jcarolinares May 30, 2023
c87d25f
Update content/hardware/05.pro-solutions/solutions-and-kits/edge-cont…
jcarolinares May 30, 2023
33af288
Update content/hardware/05.pro-solutions/solutions-and-kits/edge-cont…
jcarolinares May 30, 2023
c618a30
Update content/hardware/05.pro-solutions/solutions-and-kits/edge-cont…
jcarolinares May 30, 2023
72b9ae9
Update content/hardware/05.pro-solutions/solutions-and-kits/edge-cont…
jcarolinares May 30, 2023
c224d7d
Update content/hardware/05.pro-solutions/solutions-and-kits/edge-cont…
jcarolinares May 30, 2023
3de0277
Update content/hardware/05.pro-solutions/solutions-and-kits/edge-cont…
jcarolinares May 30, 2023
1dd7781
Update content/hardware/05.pro-solutions/solutions-and-kits/edge-cont…
jcarolinares May 30, 2023
cf3b014
Update content/hardware/05.pro-solutions/solutions-and-kits/edge-cont…
jcarolinares May 30, 2023
8cebd1b
Apply suggestions from code review
jcarolinares May 30, 2023
9948ad5
Update content/hardware/05.pro-solutions/solutions-and-kits/edge-cont…
jcarolinares May 30, 2023
75bc409
Update content/hardware/05.pro-solutions/solutions-and-kits/edge-cont…
jcarolinares May 30, 2023
be7d187
Small grammar improvements
jcarolinares May 30, 2023
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Apply suggestions from code review
 Remaining suggestions from Marta review accepted Co-authored-by: martab1994 <93210545+martab1994@users.noreply.github.com>
  • Loading branch information
jcarolinares and martab1994 authored May 30, 2023
commit 8cebd1b7b402e05ab1a6b92c5a6a3cdcc11854d9
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ void loop() {

// Different button taps handler
switch (buttonStatus) {
case ZERO_TAP: // will execute always the button is not being pressed.
case ZERO_TAP: // will execute always when the button is not being pressed.
if (controlLCD == 1 && showTimeLCD == 0) {
ValvesStatusLCD(); // when there is not an active timer
controlLCD = 0;
Expand Down Expand Up @@ -315,7 +315,7 @@ void loop() {
break;
}

// reset the valves accumuldated on time every day at midnight
// reset the valves' accumulated active time every day at midnight
if (getLocalhour() == " 00:00:00") {
Serial.println("Resetting accumulators every day");
vals.z1_on_time = 0;
Expand Down Expand Up @@ -347,19 +347,19 @@ void loop() {

The MKR WiFi 1010 needs the following libraries:

- `ArduinoIoTCloud.h` It handles the Arduino IoT Cloud connection and project variables publishing. It can be installed directly from the Arduino Library Manager.
- `Arduino_ConnectionHandler.h` It manages the Wi-Fi® connection and can be installed directly from the Arduino Library Manager.
- `ArduinoJson.h` and `Arduino_JSON` These libraries parse and create JSON structures for the HTTP requests. They can be installed directly from the Arduino Library Manager.
- `ArduinoHttpClient.h` This library requests weather data from the Open Weather API. It can be installed directly from the Arduino Library Manager.
- `Wire.h` will enable the I2C communication between the Edge Control, the MKR WiFi 1010 and the other peripherals, it's included in the BSP of the MKR WiFi board.
- `utility/wifi_drv.h` This library controls the MKR built-in RGB LED. It's included in the BSP of the MKR WiFi 1010.
- `ArduinoIoTCloud.h` handles the Arduino IoT Cloud connection and project variables publishing. It can be installed directly from the Arduino Library Manager.
- `Arduino_ConnectionHandler.h` manages the Wi-Fi® connection and can be installed directly from the Arduino Library Manager.
- `ArduinoJson.h` and `Arduino_JSON` parse and create JSON structures for the HTTP requests. They can be installed directly from the Arduino Library Manager.
- `ArduinoHttpClient.h` requests weather data from the Open Weather API. It can be installed directly from the Arduino Library Manager.
- `Wire.h` will enable the I2C communication between the Edge Control, the MKR WiFi 1010 and the other peripherals. It is included in the BSP of the MKR WiFi board.
- `utility/wifi_drv.h` controls the MKR built-in RGB LED. It is included in the BSP of the MKR WiFi 1010.

There are two headers included in the project code that handles some helper functions and structures:

- `thingProperties.h` This is automatically generated by the Arduino IoT Cloud, however, if you are using an offline IDE verify it's in the same directory as your sketch, it includes all the Arduino IoT Cloud variables.
- `thingProperties.h` is automatically generated by the Arduino IoT Cloud. However, if you are using an offline IDE, verify it is in the same directory as your sketch and includes all the Arduino IoT Cloud variables.
- `SensorValues.hpp` handles the shared variables between the Edge Control and the MKR WiFi 1010 through I2C.

In the global variables, we define the MKR board I2C address (it must be the same as defined in the Edge Control code); we also define the water tank dimensions.
In the global variables, the MKR board I2C address is defined. It must be the same as defined in the Edge Control code. In addition, the water tank dimensions are also set up.

```arduino
#include "thingProperties.h"
Expand Down Expand Up @@ -395,11 +395,11 @@ String city = "Santiago de los Caballeros";
String countryCode = "DO";
```

The MKR WiFi 1010 will update its connection with the Arduino IoT Cloud, and check for changes on every variable, from the valves switches to the scheduled activated timers. It shows when it's successfully connected to the cloud by turning on its blue LED. Also, it asks for a weather forecast every 10 minutes to update the temperature, humidity and rain probability in the Arduino IoT Cloud dashboard.
The MKR WiFi 1010 communicates with the Arduino IoT Cloud and checks for changes on every variable, from the valves switches to the scheduled activated timers. The board turns its LED blue when it is successfully connected to the cloud. Also, it asks for a weather forecast every 10 minutes to update the temperature, humidity and rain probability in the Arduino IoT Cloud dashboard.

```arduino
void loop() {
// function that ask for schedule timers set on the Cloud
// function that asks for timers scheduled on the Cloud
scheduleHandler();

unsigned long currentMillis = millis();
Expand All @@ -416,7 +416,7 @@ void loop() {
}
}

// doing this just once after there's a WiFi connections
// doing this just once when a WiFi connection is established
if (bootForecast == 1 && WiFi.status() == WL_CONNECTED) {
getForecast(); // request rain probability
getWeather(); // request temperature and humidity
Expand All @@ -437,7 +437,7 @@ void loop() {
}
```

The system needs to be as fast as possible when a valve activation is requested, this is why there is one function for each valve that is fired once the valve status is changed on the Arduino IoT Cloud.
The system needs to be as fast as possible when a valve activation is requested. For this reason, each valve has its own function that is called once the valve status changes on the Arduino IoT Cloud.

```arduino
/*
Expand All @@ -453,33 +453,32 @@ void onZ1Change() {
}
```

The `uploadValues(SensorValues_t *vals)` is executed every time the Edge Control requests data through I2C from the MKR. It updates all the local and cloud-shared variables to be sent, it also converts the water level variable to water volume using the cylinder volume formula:
The `uploadValues(SensorValues_t *vals)` is executed every time the Edge Control requests data to the MKR through I2C communication. It updates all the local and cloud-shared variables to be sent and converts the water level variable to water volume applying the cylinder volume formula:

`v = πr²h`

Where:
* `r` is the tank radius in meters.
* `h` is the tank height in meters.

As `r` and `h` are in meters, the volume result will be in cubic meters (m³), for a more intuitive perception of water quantity we will convert it to liters:
As `r` and `h` are in meters, the volume result will be in cubic meters (m³). For a more intuitive perception of water quantity, the volume can be converted into liters:

`1m³ = 1000 L`

As our level sensor output is in centimeters we can convert (height) to meters dividing by 100:`h = (water_level/100)`
Since the level sensor output is in centimeters, it can be converted (height) into meters by dividing by 100:`h = (water_level/100)`

To turn m³ into liters we just need to multiply by 1000: `water_volume = PI*(radius)*(radius)*(water_level/100)*1000`
To turn m³ into liters, multiply by 1000: `water_volume = PI*(radius)*(radius)*(water_level/100)*1000`

This is the brief why of the expression used in the code.

Using flow control variables we store the initial water level as a reference point. Any level measured below that point will be considered as water used updating the `water_usage` variable. If we refill the tank, it will save the higher value of water level as a new reference point.
To evaluate water consumption, the initial water level is stored as a reference point. Any level measured below that point will be considered as consumed water, updating the `water_usage` variable. If the tank is refilled, the new water level will become the new reference point.

```arduino
water_level = vals->water_level_local;
water_volume = PI * (radius) * (radius) * ((int)water_level/100) * 1000;

if (waterCtrl == 0) {
currentWater = water_volume;
Serial.println("Initial Water Volumen: ");
Serial.println("Initial Water Volume: ");
Serial.println(currentWater);
water_usage = 0;
waterCtrl = 1;
Expand All @@ -495,15 +494,20 @@ Using flow control variables we store the initial water level as a reference poi

### The Arduino IoT Cloud Dashboard

Taking advantage of the Arduino IoT Cloud, its possible to seamlessly integrate a simple but powerful dashboard to monitor and visualize the status of the system in real-time, resulting in a professional Human-Computer Interaction (HCI) as can be seen below:
Taking advantage of the Arduino IoT Cloud, it is possible to seamlessly integrate a simple but powerful dashboard to monitor and visualize the status of the system from remote, resulting in a professional Human-Computer Interaction (HCI) as shown below:

![Arduino Cloud project dashboard ](assets/dashboard_16-9.png)

Within the Arduino IoT Cloud's dashboard, the system variables can be monitored and controlled. There are temperature, humidity and rain probability gauges showing the current weather status and forecast, toggle switches to control each motorized valve accompanied by a scheduler widget to set automatic irrigation routines, also time series graphs showing the daily activated time of each valve. Finally, there are water supply monitoring widgets, one that shows the current water level in percentage from 0-100%, a water volume widget that shows the remaining liters of water in the tank, and a water usage widget that shows the liters used daily.
Within the Arduino IoT Cloud's dashboard, the system variables can be monitored and controlled as follow:
- Temperature, humidity and rain probability are displayed in gauges, showing the current weather status and forecast.
- Each motorized valve can be toggled through a dedicated switch accompanied by a scheduler widget to set automatic irrigation routines.
- Each valve activated time is shown in a time series chart.
- Water consumption can be monitored in dedicated widgets: one that shows the current water level in percentage from 0-100%, a water volume widget that shows the remaining liters of water in the tank and a water usage widget that shows the daily consumed liters.


![Arduino Cloud project dashboard on a smartphone](assets/dashboard-cel.png)

The dashboard can be easily accessible from a PC, mobile phone or tablet from anywhere, receiving an instantaneous update wherever we are.
The dashboard is easily accessible from a browser, mobile phone or tablet, allowing a user to receive an instantaneous update on the irrigation status from anywhere.

## Full Smart Irrigation System Example

Expand All @@ -530,6 +534,6 @@ Thanks to the Edge Control capabilities to connect to the cloud and be remotely

### Next Steps

As you already know how to develop a Smart Irrigation System with Arduino Edge Control and the MKR WiFi 1010, it's time for you to continue exploring all the capabilities of the Arduino Pro environment to integrate it with your professional setup and improve it with powerful solutions.
Since you already know how to develop a Smart Irrigation System with Arduino Edge Control and the MKR WiFi 1010, it is time for you to continue exploring all the capabilities of the Arduino Pro portfolio and integrating it in your professional setup.

You can add different connectivity modules like LoRaWAN®, GSM, RS-485 or Ethernet by using the [Arduino MKR family](https://store-usa.arduino.cc/collections/mkr-family)
You can extend the capabilities of your Edge Control-based system by adding different connectivity options, leveraging the [Arduino MKR family](https://store-usa.arduino.cc/collections/mkr-family) like LoRaWAN®, GSM, RS-485 or Ethernet.