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
Typos fix
  • Loading branch information
mcmchris committed May 27, 2023
commit 8dc31895877ee97d5cb7e3847d445c61fbd218d3
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ software:
hardware:
- hardware/05.pro-solutions/boards/solutions-and-kits/edge-control
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jhansson-ard any idea why the edge control and the enclosure don't appear on the hardware column????

image

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed that too.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could it be that there is an extra "boards" in the link? Should it not be hardware/05.pro-solutions/solutions-and-kits/edge-control?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the point is that the product to talk about is:

edge control
edge control enclosure
MKR wifi 1010

so... no idea

- hardware/05.pro-solutions/boards/solutions-and-kits/enclosure-kit
- hardware/01.mkr/01.boards/mkr-wifi-1010
---

## Introduction
Expand All @@ -54,7 +55,7 @@ The goal of this application note is to showcase a smart farming irrigation syst
- Program irrigation timers from remote through Arduino IoT Cloud by using WiFi connectivity.
- Manually activate irrigation from Arduino IoT Cloud through dedicated widgets.
- Monitor average irrigation time and water consumption on dedicated charts on Arduino IoT Cloud.
- Provide a weather station on Arduino Cloud, using API connected to a weather website to decide on whether to irrigate or not.
- Provide a weather station on Arduino IoT Cloud, using API connected to a weather website to decide on whether to irrigate or not.

## Hardware and Software Requirements

Expand All @@ -64,8 +65,9 @@ The goal of this application note is to showcase a smart farming irrigation syst
- Arduino Edge Control
- Arduino MKR WiFi 1010
- Arduino Edge Control Enclosure Kit
- 4-20mA Liquid Level Sensor
- 4-20mA (0-1 meter) Liquid Level Sensor
- 4x 2 Wires Motorized ball Valves (3 Wires version are also supported)
- 12V DC power supply
- 11' of 1/2" PVC pipes
- 3x 1/2" PVC TEE
- 8x 1/2" PVC elbow
Expand Down Expand Up @@ -95,23 +97,23 @@ The electrical connections of the intended application are shown in the diagram

The Edge Control board will be powered with an external 12V DC power supply connected to BATT+ and GND of J11 respectively.
The four motorized ball valves will be connected to the Edge Control Latching outputs of J9 connector from OUT0 to OUT6.
The water level transmitter will be connected to +19V reference and 4-20mA input 1 of J7 connector.
The water level transmitter will be connected to the +19V reference and the 4-20mA input number 1 of the J7 connector.

![Project physical connections](assets/connections-labeled_16-9.png)

## Smart Irrigation System Overview

The irrigation system works as a whole, integrating the level measurement, and the control of the valves with the Edge Control, together with the communication with the cloud using the MKR WiFi 1010.
The irrigation system works as a whole, integrating the level measurement and the activation of the valves by the Edge Control, together with the communication with the cloud using the MKR WiFi 1010.

The Edge Control is responsible for keeping time with its integrated Real Time Clock, in order to time the use of the valves and know when a day has passed. In addition, it measures the level of the stored water with a 4-20mA liquid level transmitter to calculate its use. It controls at the same time an LCD screen where the status of the valves and timers is shown, and it also allows to manual control of the valves through the LCD push button.
The Edge Control is responsible for keeping time with its integrated real-time clock (RTC), in order to time the use of the valves and know when a day has passed. In addition, it measures the level of the stored water with a 4-20mA liquid level transmitter to calculate its use. It controls at the same time an LCD screen where the status of the valves and timers is shown, and it also allows manual control of the valves through the LCD push button.

For communication with the cloud, the MKR WiFi 1010 serves as a bridge, it notifies the Edge Control of any changes in the cloud to activate, deactivate or configure a timer to the valves, in addition, it reports the values of the Edge Control sensors to the cloud. The communication between both is by I2C.

![Smart irrigation system with Edge Control](assets/project-setup.png)

### Valves Control

If a valve is activated from the cloud, the message "opening valve" will appear on the screen at the same time that it is being activated. If the valve is activated by a cloud timer, the display will show the same message, including a countdown of the remaining irrigation time. The valves working time is reported to the cloud for a visualization of the daily use average.
If a valve is activated from the cloud, the message "opening valve" will appear on the screen at the same time that it's being opened. If the valve is activated by a cloud timer, the display will show the same message, including a countdown of the remaining irrigation time. The valves working time is reported to the cloud for a visualization of the average daily use.

### Water Usage

Expand All @@ -126,7 +128,7 @@ Regarding the weather, the MKR WiFi 1010 requires the forecast of the city's wea
We will go through some important code sections to make this application fully operative. We will begin with the required libraries:

- Including `Arduino_EdgeControl.h` will enable the support for the Edge Control peripherals, install it by searching for it on the Library Manager.
- Including `Wire.h` will enable the I2C communication needed between the Edge Control, the MKR WiFi 1010 and the other peripherals, it's included in the BSP of the Edge Control.
- Including `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 Edge Control.

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

Expand Down Expand Up @@ -227,11 +229,11 @@ Repetitively the Edge Control will be detecting button taps for the valve's manu

The `updateSensors()` function send the local sensor's values and valves statuses and also requests the updated status of externally controlled variables from the Cloud.

To measure the water level we are using a 4-20mA 0 to 1 meter sensor, the Edge Control converts the current from the sensor loop into a voltage by using an internal 220 ohms resistor to be read by the analog-to-digital converter (ADC), to convert this voltage back to a current value, we divide by 220 and following the characteristic equation of a 4-20mA sensor `y = 16x + 4`, we solve for x, `x = (y - 4)/16` with a result in meters for x, as we are working on a centimeters range we multiply by 100 resulting on `x = (y - 4)*(100/16) = (y - 4)*6.25` this is the brief explanation of the mathematical expression we use to convert voltage into centimeters.
To measure the water level we are using a 4-20mA (0 to 1 meter) sensor, the Edge Control converts the current from the sensor loop into a voltage by using an internal 220 ohms resistor to be read by the analog-to-digital converter (ADC), to convert this voltage back to a current value, we divide by 220 and following the characteristic equation of a 4-20mA sensor `y = 16x + 4`, we solve for x, `x = (y - 4)/16` with a result in meters for x, as we are working on a centimeters range we multiply by 100 resulting on `x = (y - 4)*(100/16) = (y - 4)*6.25` this is the brief explanation of the mathematical expression we use to convert voltage into centimeters.

`float w_level = ((voltsReference / 220.0 * 1000.0) - 4.0) * 6.25;`

As we want to show an intuitive graph for the valve's active time, we decided to reset the accumulated time each day at midnight so we can have a daily use graph con the Arduino IoT Cloud.
As we want to show an intuitive graph for the valve's active time, we decided to reset the accumulated time each day at midnight so we can have a daily use graph on the Arduino IoT Cloud.

The `valvesHandler()` function activates, deactivates and keeps the active time of each zone valve.

Expand Down Expand Up @@ -329,14 +331,14 @@ The MKR WiFi 1010 needs the following libraries:

- `ArduinoIoTCloud.h` This one handles the Arduino IoT Cloud connection and project variables publishing. It can be installed directly from the Arduino Library Manager.
- `Arduino_ConnectionHandler.h` This one manages the Wi-Fi® connection and can be installed directly from the Arduino Library Manager.
- `ArduinoJson.h` and `Arduino_JSON` This one let us parse and create JSON structures for the HTTP requests. They can be installed directly from the Arduino Library Manager.
- `ArduinoJson.h` and `Arduino_JSON` These let us parse and create JSON structures for the HTTP requests. They can be installed directly from the Arduino Library Manager.
- `ArduinoHttpClient.h` This library lets us request weather data from the Open Weather API. It can be installed directly from the Arduino Library Manager.
- `Wire.h` will enable the I2C communication needed 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 lets us control the MKR built-in RGB LED, it's included in the BSP of the MKR WiFi 1010 board.
- `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 lets us control the MKR built-in RGB LED, it's 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 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` 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.
- `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), also, we define the water tank dimensions.
Expand Down Expand Up @@ -417,7 +419,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 switch is changed on the Arduino IoT Cloud.
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.

```arduino
/*
Expand Down Expand Up @@ -459,11 +461,11 @@ Using flow control variables we store the initial water level as a reference poi

### The Arduino IoT Cloud Dashboard

Taking advantage of the Arduino Cloud, we can 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, we can 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:

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

Within the Arduino Cloud's dashboard, the system variables can be monitored and controlled. We have 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 we have 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 raiming 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. We have 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 we have 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.

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

Expand Down