This repository was archived by the owner on Aug 11, 2021. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 8
Add latching tutorial for Edge Control #91
Merged
Merged
Changes from all commits
Commits
Show all changes
44 commits
Select commit
Hold shift + click to select a range
184628f
Added content
Lenardgeorge 88d7c6a
Added Metadata.json
Lenardgeorge c8c6850
Updated the structure
Lenardgeorge 2c4c9e5
Added images to asset folder
Lenardgeorge ba96fbf
Updated content for review
Lenardgeorge e38b4a5
Update package-lock.json
Lenardgeorge 04649ed
Added content
Lenardgeorge f08ba7a
Added Metadata.json
Lenardgeorge ff3ebb3
Updated the structure
Lenardgeorge 00413c0
Added images to asset folder
Lenardgeorge a351478
Updated content for review
Lenardgeorge a49b853
Update package-lock.json
Lenardgeorge 9b54efa
remove unnecessary notes tag
90030ee
Tutorial revision
7cbfe93
Review tutorial
68e407f
Proofread Content
Lenardgeorge d003f28
Installed the Validation tool
Lenardgeorge 5095b35
Remove colon from "you will learn" section
9c3a3d6
remove colon
17f4246
Added the cover image
Lenardgeorge 81e8457
Reviewed Ernesto's content
Lenardgeorge b3f622a
Updated Download_core image
Lenardgeorge c42156f
Resolved Conflicts
Lenardgeorge c2fc77b
Removed Image From Content
Lenardgeorge 70c1e0e
Merge branch 'dev-edgecontrol-tutorial-revision-EE' into dev-edgecont…
Lenardgeorge cd7624d
Updated to Title Case
Lenardgeorge c6e5425
Update metadata.json
Lenardgeorge eb6603b
Changed image with new core features
Lenardgeorge d73c068
Added link to the Mbed-Core Repo
Lenardgeorge da4f200
Update content.md
Lenardgeorge 7968197
Removed metadata.json
Lenardgeorge 9d05a80
Changed section number
Lenardgeorge 0db1665
Merge branch 'main' of https://github.com/arduino/arduino-pro-content…
Lenardgeorge f4ff65e
Added front matter to the tutorial
Lenardgeorge 2200a27
Removed unused images
Lenardgeorge ef301ad
Create ec_ard_3wirevalve_cover.svg
Lenardgeorge 715711d
Corrected validation errors
Lenardgeorge 85be8d5
Corrected signature errors
Lenardgeorge bd224e0
Corrected validation errors
Lenardgeorge d76ec3f
Corrected Validation Errors
Lenardgeorge 45b76fb
Corrected signature formats
Lenardgeorge 526bc78
Corrected validation error
Lenardgeorge 294d1ae
Corrected validation errors
Lenardgeorge 550f916
Minor rephrasing
sebromero 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
There are no files selected for viewing
672 changes: 672 additions & 0 deletions
672
content/tutorials/portenta-h7/ec-ard-3wirevalve/assets/ec_ard_3wirevalve_cover.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
491 changes: 491 additions & 0 deletions
491
.../tutorials/portenta-h7/ec-ard-3wirevalve/assets/ec_ard_connect_power_source.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
854 changes: 854 additions & 0 deletions
854
content/tutorials/portenta-h7/ec-ard-3wirevalve/assets/ec_ard_connect_valve.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions
25
content/tutorials/portenta-h7/ec-ard-3wirevalve/assets/ec_ard_valve_wires.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
160 changes: 160 additions & 0 deletions
160
content/tutorials/portenta-h7/ec-ard-3wirevalve/content.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,160 @@ | ||
--- | ||
title: Connecting and Controlling a Motorized Ball Valve | ||
coverImage: assets/ec_ard_3wirevalve_cover.svg | ||
tags: [Edge Control, Motorised Valve, Irrigation] | ||
description: This tutorial will give you an overview of the core features of the board, setup the development environment and introduce the APIs required to program the board. | ||
--- | ||
|
||
# Connecting and Controlling a Motorized Ball Valve | ||
|
||
## Overview | ||
|
||
A ball valve is a form of quarter-turn [valve](https://en.wikipedia.org/wiki/Valve) which uses a hollow, perforated and pivoting ball to control flow of liquids and gasses through it. This tutorial will guide you through connecting the board to a 3 Wire-Valve and writing a sketch that controls the basic operations such as the opening and closing of the valves. | ||
|
||
***Tip : If this is for your first Edge Control project, we recommend you to take a look at the [Getting Started Tutorial](https://www.arduino.cc/pro/tutorials/portenta-h7/ec-ard-gs) to setup the development environment before you proceed.*** | ||
|
||
### You Will Learn | ||
|
||
- How to connect a motorized valve to the Edge Control board | ||
- How to control the valve through basic commands provided by the `Arduino_EdgeControl` library | ||
- How to power the board with an external power supply | ||
|
||
### Required Hardware and Software | ||
|
||
- 1 x [Arduino Edge control board](https://store.arduino.cc/edge-control) | ||
- 1 x [US Solid Motorised Ball Valve (9 - 24 V)](https://ussolid.com/u-s-solid-motorized-ball-valve-1-2-brass-electrical-ball-valve-with-full-port-9-24-v-ac-dc-3-wire-setup.html) (or compatible) | ||
- External power source: 12V battery (LiPo / SLA) or power supply | ||
- 1 x Micro USB cable | ||
- Arduino IDE 1.8.10+ | ||
- 2 x Phoenix connectors 1844646 | ||
- 2 x Jumper cables | ||
|
||
## Instructions | ||
|
||
### 1. Connecting the Valves | ||
|
||
The motorized valve comes with three wires primarily marked as blue, yellow and red. The red and blue cables are for the positive and negative signals and the yellow is for the ground. | ||
|
||
 | ||
|
||
You need to ensure that the Phoenix connectors are in place before plugging in the wires to the respective pins. If you havent link | ||
|
||
Connect the red and the blue wire to any of the 8 pairs of `LATCHING OUT` pins. In this example we will use `1N` and `1P` of your Edge Control board. Latches allow you to store the state of the pins based on the previous output. As the valve doesn't come with internal drivers to store the state of the motor, we will use the `Latching_out` pins (instead of `Latching_out_cmd`) that are the ones that include drivers on the Edge Control. | ||
|
||
 | ||
|
||
Connect the yellow wire to the nearby `GND` pin. Ensure that the wires are fastened securely and tightly to the Phoenix connectors so that they make contact with the pins. | ||
|
||
### 2. Opening And Closing the Valves | ||
|
||
Open a new sketch file on the Arduino IDE and name it `ValveControl.ino`. Add the header file `Arduino_EdgeControl.h` to your sketch | ||
|
||
```cpp | ||
#include <Arduino_EdgeControl.h> | ||
``` | ||
|
||
Inside `void setup()` , after enabeling the serial communication, run the initialization routine `EdgeControl.begin()` . This routine is in charge of enabling the default power areas of the board. Then use `Latching.begin()` to configure the expander pins as outputs. | ||
|
||
```cpp | ||
void setup() | ||
{ | ||
Serial.begin(9600); | ||
while(!Serial); | ||
|
||
delay(1000); | ||
|
||
Serial.println("3-Wire Valve Demo"); | ||
|
||
EdgeControl.begin(); | ||
Latching.begin(); | ||
|
||
Serial.println("Starting"); | ||
} | ||
|
||
``` | ||
|
||
Inside the `loop()`you will add the instructions to open and close the valve. `Latching.channelDirection()` is used to control the signal to a particular pin using the parameter `LATCHING_OUT_1` and its direction using the parameters, `POSITIVE` or `NEGATIVE`. Hence, if you want the valve to open you will use the instruction, | ||
|
||
```cpp | ||
Latching.channelDirection(LATCHING_OUT_1, POSITIVE) | ||
``` | ||
|
||
and to close the valve, you need to send a signal in the opposite direction using the command, | ||
|
||
```cpp | ||
Latching.channelDirection(LATCHING_OUT_1, NEGATIVE) | ||
``` | ||
|
||
As it takes a few seconds for the valve to fully open or close, you need to maintain the signal for a set amount of time. Using the command, `Latching.strobe(4500)` you can adjust the duration (milliseconds) of signal passing through a particular pin. | ||
|
||
```cpp | ||
void loop() | ||
{ | ||
Serial.println("Closing"); | ||
Latching.channelDirection(LATCHING_OUT_1, POSITIVE); | ||
Latching.strobe(4500); | ||
delay(2500); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why the delay if we already use strobe()' |
||
|
||
Serial.println("Opening"); | ||
Latching.channelDirection(LATCHING_OUT_1, NEGATIVE); | ||
Latching.strobe(4500); | ||
delay(2500); | ||
} | ||
``` | ||
|
||
### 3. Connecting To A Power Source | ||
|
||
The valves require a power supply of 9 - 12 V and you can either use a regular power supply or a 3 cell LiPo battery to provide the required voltage. Power sources can be connected to the onboard relay ports of the edge control board. Connect two jumper wires to the **GND** and **B** pins of the **Relay ports** | ||
|
||
 | ||
|
||
Connect the jumper from the **B** pin to the positive terminal of the Battery and the jumper from the **GND** pin to the negative terminal of the battery | ||
|
||
### 4. Uploading the Sketch | ||
|
||
Connect the board to your computer, upload the `ValveControl.ino` sketch and open the **Serial Monitor**. If all the connections are done right, the valve opens and closes and you should be able to see the status as `Open` or `Close` on the serial monitor | ||
|
||
## Conclusion | ||
|
||
In this tutorial you learned how a 3 wire valve works and the basic operations that the Edge Control board uses to control the valves. With this knowledge you can build irrigation systems which periodically control the valves which can be installed in your fields. | ||
|
||
### Complete Sketch | ||
|
||
```cpp | ||
#include <Arduino_EdgeControl.h> | ||
|
||
void setup() | ||
{ | ||
Serial.begin(9600); | ||
while(!Serial); | ||
|
||
delay(1000); | ||
|
||
Serial.println("3-Wire Valve Demo"); | ||
|
||
EdgeControl.begin(); | ||
Latching.begin(); | ||
|
||
Serial.println("Starting"); | ||
} | ||
|
||
void loop() | ||
{ | ||
Serial.println("Closing"); | ||
Latching.channelDirection(LATCHING_OUT_1, POSITIVE); | ||
Latching.strobe(4500); | ||
delay(2500); | ||
|
||
Serial.println("Opening"); | ||
Latching.channelDirection(LATCHING_OUT_1, NEGATIVE); | ||
Latching.strobe(4500); | ||
delay(2500); | ||
} | ||
|
||
``` | ||
|
||
**Authors:** Ernesto E. Lopez, Lenard George Swamy | ||
|
||
**Reviewed by:** Ernesto E. Lopez [2021-03-18] | ||
|
||
**Last revision:** Lenard George Swamy [2021-04-06] |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is something missing here...