Skip to content
This repository was archived by the owner on Aug 11, 2021. It is now read-only.

Commit 7c97acd

Browse files
LenardgeorgeErnestoELCsebromero
authored
Getting Started with the Edge Control (#103)
* Created a Structure for the Tutorial * Added Step 1 Basic Setup * Added the Power Rail Diagram * Update content.md * Create ec_ard_connect_power_source.svg * Create ec_ard_gs_board_topology.svg * Update content.md * Added Conclusion to the Content * Revision by EE. * Update content.md * Added the cover image * Added front matter * Update content.md * Update content.md * Create ec_ard_gs_core.png * Update content.md * Reviewed the complete sketch * Signed the content * Update ec_ard_gs_board_topology.svg * Delete Arduino-Logo.svg * Update content.md * Delete metadata.json * Use minus symbol instead of dash * Fix typos and rephrase minor parts * Use better title Co-authored-by: ErnestoELC <e.lopez@arduino.cc> Co-authored-by: Sebastian Romero <s.hunkeler@arduino.cc>
1 parent 9b021eb commit 7c97acd

File tree

6 files changed

+3230
-0
lines changed

6 files changed

+3230
-0
lines changed

content/tutorials/portenta-h7/ec-ard-gs/assets/ec_ard_connect_power_source.svg

Lines changed: 491 additions & 0 deletions
Loading

content/tutorials/portenta-h7/ec-ard-gs/assets/ec_ard_gs_board_topology.svg

Lines changed: 1271 additions & 0 deletions
Loading
254 KB
Loading

content/tutorials/portenta-h7/ec-ard-gs/assets/ec_ard_gs_cover.svg

Lines changed: 1295 additions & 0 deletions
Loading
74 KB
Loading
Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
---
2+
title: Getting Started With the Arduino Edge Control
3+
coverImage: assets/ec_ard_gs_cover.svg
4+
tags: [Getting Started, Setup, Blink]
5+
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.
6+
---
7+
8+
# Getting Started With the Arduino Edge Control
9+
10+
## Overview
11+
The Edge Control board is a versatile tool that allows agriculturalists to develop creative and innovative solutions for agriculture by harnessing modern technology. In this tutorial you will set up the development environment for the board and learn to write a simple sketch that blinks the on-board LED.
12+
13+
### You Will Learn
14+
- About the basic board topology
15+
- How to setup the development environment
16+
- How to power up the board
17+
- About the basic API provided by the Arduino_EdgeControl library
18+
19+
### Required Hardware and Software
20+
- Arduino Portenta H7 board (<https://store.arduino.cc/portenta-h7>)
21+
- USB C cable (either USB A to USB C or USB C to USB C)
22+
- Arduino IDE 1.8.10+
23+
- External power source : a 12V LiPo/SLA battery or power supply
24+
- 1x Phoenix connector
25+
- 2x Jumper wires
26+
27+
## Instructions
28+
29+
In this getting started tutorial you will set up the Edge Control board and blink an LED. You will first learn to install the core and download the library from the library manager. You will write a simple blink sketch using some fundamental APIs provided by the Arduino Edge Control Library. You will need to connect your board to an external power source and therefore have a LiPo battery or a power source with you when running the sketch.
30+
31+
### 1. Get to Know the Board
32+
33+
The Arduino Edge Control board is designed to address the needs of **precision farming**. It provides a low power control system and modular connectivity allows you to adapt the board to your specific farming needs. The following image gives you an overview of some of the core features of the board that you need to be aware of before you can get started with the board.
34+
35+
![Download the Core](assets/ec_ard_gs_board_topology.svg)
36+
37+
**Terminal Blocks** allows you to connect up to
38+
39+
- **8** x **5V Analog Sensors**
40+
- **4** x **4-20mA sensors**
41+
- **16** x **Watermark Sensors**
42+
- **16** x **Latching Devices** (e.g. Motorized Valves)
43+
44+
and provides **4** x **configurable Solid State Relays**.
45+
46+
***Connections to the Terminal blocks are made through the Phoenix connectors included in the kit.***
47+
48+
The **LCD Module Connector** is used to attach the LCD module to the Edge Control Board through a flat cable.
49+
50+
The on-board **MKR slots 1 & 2** can be used to connect Arduino MKR boards to extend the capabilities such as connectivity through **LoRa, Wi-Fi, 2G/3G/CatM1/NBIoT**, and Sigfox.
51+
52+
The board includes both a **microSD card socket** and an additional **2MB flash memory** for data storage. Both are directly connected to the main processor via a SPI interface.
53+
54+
This board comes with the **Nina B306** processor which is the same processor used in other boards such as the **Nano 33 BLE**.
55+
56+
### 2. The Basic Setup
57+
58+
Before you start programming the Edge control board, you will have to download the [Mbed core](https://github.com/arduino/ArduinoCore-mbed) from the board manager. In the Arduino IDE open the **Board manager** search for the `Edge Control` core and install it.
59+
60+
![Download the Core](assets/ec_ard_gs_core.png)
61+
62+
### 3. The Blink Sketch
63+
64+
Open a new sketch file, name it `hello_edge_control.ino` and add the **Edge Control library**. This library provides access to many of the different pins and functionalities of the board.
65+
66+
```cpp
67+
#include <Arduino_EdgeControl.h>
68+
```
69+
70+
For this example you need to ensure that the Serial communication has begun. The following code ensures that the board waits for at least 2.5 seconds before it times out and continues without an established serial connection. This guarantees that the communication has been established when connected to the Serial Monitor and also allows to work without being connected to it. Print a message on the Serial port with the text `Hello, Edge Control`
71+
72+
```cpp
73+
// Set the timeout
74+
auto startNow = millis() + 2500;
75+
while (!Serial && millis() < startNow);
76+
Serial.println("Hello, Edge Control!");
77+
```
78+
79+
The board is designed to be very low power and for this reason some the electronics are powered off by default. Once the serial communication has been established, we need to enable the power on the power rails that we want to use. The power tree below will give you an idea of the different power rails in the board.
80+
81+
82+
![Power rails of the Edge Control board](assets/ec_ard_gs_power_rail.png)
83+
84+
The Edge Control board uses an I/O expander in order to increase the number of digital control signals. If we want to blink the on-board LED we would need to enable the power of the I/O expander to which the LED is connected to and also enable the power to the 5V DCDC converter. 5V power line is powered by the **battery source** for which you can either use a power supply or a 3 cell LiPo battery to provide the required voltage.
85+
86+
The `Power` class provides API access to enable the different voltages on the board. In this tutorial we need to enable the 3.3V and 5V power lines using the `enable3V3()` and `enable5V()` functions.
87+
88+
```cpp
89+
// Enable power lines
90+
Power.enable3V3();
91+
Power.enable5V();
92+
```
93+
94+
Communication to the I/O Expander happens through the I2C port which we initialise with `Wire.begin()`. We also need to initialise the expander and configure the LED pin as OUTPUT.
95+
96+
```cpp
97+
// Start the I2C connection
98+
Wire.begin();
99+
100+
// Initalise the expander pins
101+
Expander.begin();
102+
Expander.pinMode(EXP_LED1, OUTPUT);
103+
```
104+
105+
Inside the loop function, you can use the `Expander.digitalWrite(pin, value)` function to control the LED via the I/O expander as with a normal GPIO pin.
106+
107+
```cpp
108+
Serial.println("Blink");
109+
Expander.digitalWrite(EXP_LED1, LOW);
110+
delay(500);
111+
Expander.digitalWrite(EXP_LED1, HIGH);
112+
delay(500);
113+
```
114+
115+
**Hint: The Complete Sketch can be found in the Conclusions**
116+
117+
### 4. Connect a Power Source
118+
119+
Power sources can be connected to the on-board relay ports of the Edge Control board. Attach your **Phoenix connectors** to the **RELAY terminal** on the board. Connect two jumper wires to the **GND** and **B** pins of the **Relay ports**.
120+
121+
![The power pins of the Edge Control](assets/ec_ard_connect_power_source.svg)
122+
123+
Connect a jumper from the **B** pin to the positive terminal of the battery and a jumper from the **GND** pin to the negative terminal of the battery
124+
125+
### 5. Upload the Sketch
126+
127+
Connect the board to your computer, upload the `hello_edge_control.ino` sketch and open the **Serial Monitor**. If all the connections are done right, the LED blinks and you should be able to see the output `Hello Edge Control` and `Blink` in the serial monitor.
128+
129+
## Conclusion
130+
In this tutorial you learned how to set up your Edge Control Board, to power it, and how to use the core functions to control the GPIO pins.
131+
132+
### Complete Sketch
133+
134+
```cpp
135+
#include <Arduino_EdgeControl.h>
136+
137+
void setup() {
138+
Serial.begin(9600);
139+
140+
// Set the timeout
141+
auto startNow = millis() + 2500;
142+
while (!Serial && millis() < startNow);
143+
Serial.println("Hello, Edge Control Sketch!");
144+
145+
// Enable power lines
146+
Power.enable3V3();
147+
Power.enable5V();
148+
149+
// Start the I2C connection
150+
Wire.begin();
151+
152+
// Initalise the expander pins
153+
Expander.begin();
154+
Expander.pinMode(EXP_LED1, OUTPUT);
155+
}
156+
157+
void loop() {
158+
// put your main code here, to run repeatedly:
159+
Serial.println("Blink");
160+
Expander.digitalWrite(EXP_LED1, LOW);
161+
delay(500);
162+
Expander.digitalWrite(EXP_LED1, HIGH);
163+
delay(500);
164+
}
165+
```
166+
167+
### Next Steps
168+
169+
We are developing new tutorials on how to connect valves, LCDs, watermark sensors and use many other functionalities of the board. In the mean time you can explore the Arduino Edge Control library to develop your own application.
170+
171+
**Authors:** Lenard George
172+
**Reviewed by:** Ernesto Lopez [21.04.2021]
173+
**Last revision:** Sebastian Romero [22.04.2020]

0 commit comments

Comments
 (0)