Skip to content

[PC-1396] Edge Control User Manual #2176

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 48 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
569ddab
User Manual Folder created
mcmchris Sep 19, 2023
eb37a03
User Manual writing commit 1
mcmchris Sep 19, 2023
1f95891
Typo fix
mcmchris Sep 19, 2023
78e1552
User Manual writing commit 2
mcmchris Sep 19, 2023
75217f4
User Manual writing commit 3
mcmchris Sep 20, 2023
fcf731b
User Manual writing commit 4
mcmchris Sep 20, 2023
03f05b1
Images order change
mcmchris Sep 21, 2023
3c86be6
User Manual writing commit 5
mcmchris Sep 21, 2023
286ae85
User Manual writing commit 6
mcmchris Sep 21, 2023
63f9e25
User Manual writing commit 7
mcmchris Sep 21, 2023
2de52e2
User Manual writing commit 8
mcmchris Sep 25, 2023
ad925bf
User Manual writing commit 9
mcmchris Sep 25, 2023
981dc34
User Manual writing commit 10
mcmchris Sep 26, 2023
1235dfc
User Manual writing commit 11
mcmchris Sep 27, 2023
847b169
User Manual writing commit 12
mcmchris Sep 28, 2023
ef80511
Typo Fix
mcmchris Sep 28, 2023
9b00ef0
User Manual writing commit 13
mcmchris Sep 29, 2023
a204411
User Manual writing commit 14
mcmchris Oct 1, 2023
2a69cce
User Manual writing commit 15
mcmchris Oct 2, 2023
0931f88
User Manual writing commit 16
mcmchris Oct 2, 2023
e92e598
User Manual writing commit 17
mcmchris Oct 2, 2023
34cf055
User Manual writing commit 18
mcmchris Oct 2, 2023
0b6adef
User Manual writing commit 19
mcmchris Oct 3, 2023
0633987
User Manual writing commit 20
mcmchris Oct 3, 2023
adcf89b
User Manual writing commit 21
mcmchris Oct 3, 2023
c14d841
Final commit 22
mcmchris Oct 3, 2023
77cbfe2
Typos fix 1
mcmchris Oct 3, 2023
bb92359
Typos fix 2
mcmchris Oct 3, 2023
782d985
Typos fix 3
mcmchris Oct 3, 2023
7edf283
Typos fix 4
mcmchris Oct 3, 2023
5591243
Punctuation fix 1
mcmchris Oct 3, 2023
1d570fb
Rephrase fix 1
mcmchris Oct 3, 2023
f2cafdd
Typos fix 5
mcmchris Oct 3, 2023
b323fcf
Structure fix 1
mcmchris Oct 3, 2023
c547763
Gif size update
mcmchris Oct 3, 2023
b50ee27
Checking if spell fixes worked
mcmchris Oct 4, 2023
24bee1d
Edge Control Forum URL fixed
mcmchris Oct 4, 2023
acbb95d
Simple Pinout update
mcmchris Nov 20, 2023
466e33a
Tables update
mcmchris Nov 20, 2023
e32b6d5
I2C section extended
mcmchris Nov 20, 2023
c41a264
Metadata update to see preview
mcmchris Jan 24, 2024
898649a
Metadata update to see preview
mcmchris Jan 24, 2024
2ada41c
Merge branch 'main' into mcmchris/edge-control/user-manual
mcmchris Sep 16, 2024
962ab70
Merge branch 'main' into mcmchris/edge-control/user-manual
mcmchris Sep 16, 2024
bb192b2
Author name updated
mcmchris Sep 16, 2024
e03dd55
Taddy suggested changes 1
mcmchris Sep 17, 2024
f1f9894
Taddy review applied
mcmchris Sep 17, 2024
1d46666
Library note
mcmchris Sep 17, 2024
File filter

Filter by extension

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
User Manual writing commit 21
  • Loading branch information
mcmchris committed Oct 3, 2023
commit adcf89b14630e368291ac607c23c4e50612dcc28
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -969,7 +969,7 @@ The different commands and controllable power rails will be specified in the lis

```cpp
Power.on(PWR_VBAT); // turns on the 12V power rails for the "Latching Outputs"
Power.on(PWR_3V3); // turns on the 3.3V power rail for the micro SD Card (default ON)
Power.on(PWR_3V3); // turns on the 3.3V power rail for the micro SD Card
Power.on(PWR_19V); // turns on the 19V power rail for the 4-20mA sensors reference
Power.on(PWR_MKR1); // turns on the MKR board connected to slot 1
Power.on(PWR_MKR2); // turns on the MKR board connected to slot 2
Expand Down Expand Up @@ -1459,4 +1459,91 @@ void loop()

![UART communication demo](assets/UART.gif)

### Bluetooth® Low Energy
## Micro SD Card

A Micro SD Card can be integrated to the Edge Control for sensor data logging, storing projects configurations or any application concerned to data storage.

The very known [SD library](https://www.arduino.cc/reference/en/libraries/sd/) is compatible with the Edge Control, we can test the included examples just by adding some lines of code needed by the Edge Control.

The example code used below is an adaptation of the "Datalogger" example included in the `SD` library. It logs the value sampled from an analog input of the Edge Control.

The same wiring of the [analog input section](#analog-inputs) can be used, with the addition of an micro SD card attached.

```cpp
#include <Arduino_EdgeControl.h>
#include <SPI.h>
#include <SD.h>

constexpr unsigned int adcResolution{ 12 };

const int chipSelect = PIN_SD_CS;

void setup() {
// Open serial communications and wait for port to open:
Serial.begin(115200);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}

EdgeControl.begin();
// Power on the 3V3 rail for SD Card
Power.on(PWR_3V3);
Power.on(PWR_VBAT);

Wire.begin();
Expander.begin();

Serial.print("Waiting for IO Expander Initialization...");
while (!Expander) {
Serial.print(".");
delay(100);
}
Serial.println(" done.");

Input.begin();
Input.enable();

analogReadResolution(adcResolution);

Serial.print("Initializing SD card...");

// see if the card is present and can be initialized:
if (!SD.begin(chipSelect)) {
Serial.println("Card failed, or not present");
// don't do anything more:
while (1)
;
}
Serial.println("card initialized.");
}

void loop() {
// make a string for assembling the data to log:
String dataString = "";

int sensor = Input.analogRead(INPUT_05V_CH01); // read the Edge Control 0-5v Channel 1
dataString += String(sensor);

// open the file. note that only one file can be open at a time,
// so you have to close this one before opening another.
File dataFile = SD.open("datalog.txt", FILE_WRITE);

// if the file is available, write to it:
if (dataFile) {
dataFile.println(dataString);
dataFile.close();
// print to the serial port too:
Serial.println(dataString);
}
// if the file isn't open, pop up an error:
else {
Serial.println("error opening datalog.txt");
}
}

```

You will be able to read all the sampled data from the micro SD card inserting it to your PC on a `.txt` file called `DATALOG`.

![Data logging wiring and output](assets/data-logging.png).