You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/hardware/01.mkr/01.boards/mkr-zero/tutorials/mkr-zero-user-manual/content.md
+51-97
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,14 @@
1
1
---
2
2
title: 'MKR Zero User Manual'
3
3
difficulty: beginner
4
-
compatible-products: []
4
+
compatible-products: [mkr-zero]
5
5
description: 'Learn about and how to use the MKR Zero board'
6
6
tags:
7
7
- Cheat sheet
8
8
- User manual
9
9
author: 'Benjamin Dannegård'
10
10
hardware:
11
-
- hardware/
11
+
- hardware/01.mkr/01.boards/mkr-zero
12
12
software:
13
13
- ide-v1
14
14
- ide-v2
@@ -36,18 +36,8 @@ This user manual provides a comprehensive overview of the MKR Zero board, highli
36
36
37
37
The MKR ZERO brings you the power of a Zero in the smaller format established by the MKR form factor. The MKR ZERO board acts as a great educational tool for learning about 32-bit application development. It has an on-board SD connector with dedicated SPI interfaces (SPI1) that allows you to play with MUSIC files with no extra hardware! The board is powered by Atmel’s SAMD21 MCU, which features a 32-bit ARM® Cortex® M0+ core.
38
38
39
-

40
-
41
39
The board contains everything needed to support the microcontroller; simply connect it to a computer with a micro-USB cable or power it by a LiPo battery. The battery voltage can also be monitored since a connection between the battery and the analog converter of the board exists.
42
40
43
-
### Board Libraries
44
-
45
-
The [`SD` library](https://www.arduino.cc/reference/en/libraries/sd/) enables reading and writing on SD cards. Once an SD memory card is connected to the SPI interface of the Arduino board you can create files and read/write on them. You can also move through directories on the SD card.
46
-
47
-
To install the `SD` library, navigate to `Tools > Manage libraries...` or click the **Library Manager** icon in the left tab of the Arduino IDE. In the Library Manager tab, search for `SD` and install the latest version of the library.
48
-
49
-

50
-
51
41
### Pinout
52
42
53
43
The full pinout is available and downloadable as PDF from the link below:
@@ -68,131 +58,95 @@ The complete schematics are available and downloadable as PDF from the link belo
68
58
69
59
## First Use
70
60
71
-
### Connecting the Board
72
-
73
-
As shown in the image below, the Nicla Sense Env can be connected to a Portenta or MKR family board using the onboard ESLOV connector and the included ESLOV cable. Alternatively, you can connect the Nicla Sense Env as a shield by using the MKR-style pins on the Portenta or MKR family boards.
74
-
75
-

61
+
### Installing the SAMD Core
76
62
77
-
### Powering the Board
63
+
After we have downloaded, installed and opened the Arduino IDE, let's continue to installing the `SAMD boards (32-bits ARM Coretx-M0+)` core. When we open the editor, we will see an empty sketch. Here we need to navigate to the **Board Manager** on the left side of the IDE.
- Using the onboard **ESLOV connector**, which has a dedicated +5 VDC power line regulated onboard to +3.3 VDC.
82
-
- Using an **external +3.3 VDC power supply** connected to the `VCC` pin (please refer to the [board pinout section](#pinout) of the user manual).
67
+
This will open up a new tab, with all available cores. Type in "samd" in the search field, and install the `Arduino SAMD Boards (32-bits ARM Cortex-M0+)` core.
83
68
84
-
### Installing the SAMD core
85
-
86
-
After we have downloaded, installed and opened the Arduino IDE, let's continue to installing the `SAMD boards (32-bits ARM Coretx-M0+)` core. When we open the editor, we will see an empty sketch.
87
-
88
-
![An empty Arduino IDE sketch window]()
89
-
90
-
Here we need to navigate to **Tools > Board > Board Manager**.
91
-
92
-
![Selecting board manager]()
93
-
94
-
This will open up a new window, with all available cores. Type in "samd" in the search field, and install the `Arduino SAMD Boards (32-bits ARM Cortex-M0+)` core.
95
-
96
-
![List of cores]()
69
+

97
70
98
71
This process may take some time, and you may need to accept the installation window that comes up (depending on your operative system). When it is finished, it should say "INSTALLED" under the title.
99
72
100
-
Exit the board manager, and go to **Tools > Board > Arduino SAMD Boards (32-bits ARM Cortex-M0+)**. Here you can see all the SAMD boards listed, where you can select the MKR board you are using. You have now successfully installed the core.
101
-
102
-
![List of available boards]()
103
-
104
-
### Selecting the port
105
-
106
-
Now, let's make sure that our board is found by our computer, by selecting the port. Regardless what kind of program we are uploading to the board, we always need to choose the port for the board we are using. This is simply done by navigating to Tools > Port, where you select your board from the list.
73
+
Now go to **Tools > Board > Arduino SAMD Boards (32-bits ARM Cortex-M0+) > MKR Zero**. Here you can see all the SAMD boards listed, where you can select the MKR board you are using. You have now successfully installed the core.
107
74
108
-
![Selecting the right board and port]()
75
+
### Selecting the Port
109
76
110
-
This will look different depending on what kind of operative system you are
111
-
using. For Windows users, it could look like this:
77
+
Now, let's make sure that our board is found by our computer, by selecting the port. Connect the board to your computer using a USB-B® cable and open the Arduino IDE. Then by pressing the white bar, as seen in the image below, the board and port can be selected.
112
78
113
-
-`<COM29> (Arduino MKR Zero)`
114
-
115
-
For MAC users, it could look like this:
116
-
117
-
-`/dev/cu.usbmodem14112 (Arduino MKR Zero)`
79
+

118
80
119
81
### Blink Example
120
82
121
83
Let's control the MKR Zero board to reproduce the classic `blink` example used in the Arduino ecosystem. We will use this example to verify the MKR Zero board's connection to the Arduino IDE.
122
84
123
-
Now, connect the host board to your computer using a USB-B® cable, open the Arduino IDE, and connect the board to it.
85
+
Connect the board to your computer using a USB-B® cable and open the Arduino IDE.
124
86
125
87
Copy and paste the example sketch below into a new sketch in the Arduino IDE:
126
88
127
89
```arduino
90
+
// the setup function runs once when you press reset or power the board
91
+
void setup() {
92
+
// initialize digital pin LED_BUILTIN as an output.
93
+
pinMode(LED_BUILTIN, OUTPUT);
94
+
}
128
95
96
+
// the loop function runs over and over again forever
97
+
void loop() {
98
+
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
99
+
delay(1000); // wait for a second
100
+
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
101
+
delay(1000); // wait for a second
102
+
}
129
103
```
130
104
131
-
To upload the sketch to the host board, click the **Verify** button to compile the sketch and check for errors, then click the **Upload** button to program the device with the sketch.
105
+
To upload the sketch to the board, click the **Verify** button to compile the sketch and check for errors, then click the **Upload** button to program the device with the sketch.
132
106
133
-

107
+

134
108
135
-
You should see the onboard orange LED of your Nicla Sense Env board turn on for one second, then off for one second, repeatedly.
109
+
You should see the onboard orange LED of your MKR Zero board turn on for one second, then off for one second, repeatedly.
136
110
137
-
### SD card example
111
+
### Board Libraries
138
112
113
+
The [`SD` library](https://www.arduino.cc/reference/en/libraries/sd/) enables reading and writing on SD cards. Once an SD memory card is connected to the SPI interface of the Arduino board you can create files and read/write on them. You can also move through directories on the SD card.
139
114
115
+
To install the `SD` library, navigate to the `Manage libraries` tab on the left side of the IDE.
140
116
141
-
### Low Power Mode Management
117
+

142
118
143
-
Saving energy is vital for many projects, particularly those deployed in remote areas or with a limited power supply. The Nicla Sense Env supports a deep sleep mode that can help to minimize the board's power consumption.
119
+
In the Library Manager tab, search for `SD` and install the latest version of the library.
144
120
145
-
***Deep sleep is essential for extending battery life and minimizing energy consumption when the board is not collecting data or performing tasks. It is necessary for battery-powered or power-constrained applications.***
121
+

146
122
147
-
The example sketch shown below demonstrates how to put the Nicla Sense Env board into deep sleep mode using the `Arduino_NiclaSenseEnv` library API:
123
+
### SD Library Examples
148
124
149
-
```arduino
150
-
/**
151
-
Low Power Mode Management Example for Nicla Sense Env
152
-
Name: nicla_sense_env_low_power_mode_example.ino
153
-
Purpose: This sketch demonstrates how to put the Nicla Sense Env
154
-
into deep sleep mode using the Arduino_NiclaSenseEnv library API.
155
-
156
-
@author Arduino Product Experience Team
157
-
@version 1.0 31/05/24
158
-
*/
159
-
160
-
// Include the NiclaSenseEnv library
161
-
#include "NiclaSenseEnv.h"
162
-
163
-
// Global device object for Nicla Sense Env
164
-
NiclaSenseEnv device;
125
+
In the `SD` library there are a few examples that makes use of the libraries functions. Access the examples by navigating to **File > Examples > SD**.
165
126
166
-
void setup() {
167
-
// Initialize serial communication and wait up to 2.5 seconds for a connection
Serial.println("- Device could not be found. Please double-check the wiring!");
177
-
}
178
-
}
127
+
![Accessing the examples]()
179
128
180
-
void loop() {
181
-
// Nothing to do here. The device is in deep sleep mode.
182
-
}
183
-
```
129
+
To use this library put an SD card into the MKR Zero boards SD card slot.
130
+
131
+

132
+
133
+
The examples can be used to test the SD card connection. Here are the examples in the library:
134
+
135
+
-**CardInfo** - This sketch gets info about your SD card. Very useful for testing a card when you're not sure whether its working or not. Prints info about the SD card in the serial monitor. Change the `chipSelect` variable in the sketch so that it matches the required settings for the MKR Zero, as seen in the comments of the sketch.
136
+
137
+
-**Datalogger** - Logs data from three analog sensors to an SD card. The sketch will create a `datalog.txt` file on the SD card where the information will be stored. Change the `chipSelect` variable in the sketch so that it matches the required settings for the MKR Zero, as seen in the comments of the sketch.
184
138
185
-
Here is a detailed breakdown of the example sketch shown before and the `Arduino_NiclaSenseEnv` library API functions used in the sketch:
139
+
-**DumpFile** - Reads a file from the SD card and sends it over the serial port. Change the `chipSelect` variable in the sketch so that it matches the required settings for the MKR Zero, as seen in the comments of the sketch.
186
140
187
-
-`device.deepSleep()`: This function puts the Nicla Sense Env board into a deep sleep state, minimizing power consumption to the lowest possible level.
141
+
-**Files** - Creates and destroys an SD card file. Change the `chipSelect` variable in the sketch so that it matches the required settings for the MKR Zero, as seen in the comments of the sketch.
188
142
189
-
After uploading the example sketch to the host board, you should see the following output in the Arduino IDE's Serial Monitor:
143
+
-**listfiles** - Prints out the files in a directory on a SD card. Change the `chipSelect` variable in the sketch so that it matches the required settings for the MKR Zero, as seen in the comments of the sketch.
190
144
191
-

145
+
-**NonBlockingWrite** - This example demonstrates how to perform non-blocking writes to a file on a SD card. The file will contain the current millis() value every 10ms. If the SD card is busy, the data will be dataBuffered in order to not block the sketch. Change the `chipSelect` variable in the sketch so that it matches the required settings for the MKR Zero, as seen in the comments of the sketch.
192
146
193
-
***Waking up a Nicla Sense Env board from deep sleep mode can only be done by a hardware reset.***
147
+
-**ReadWrite** - This example shows how to read and write data to and from an SD card file. Change the `chipSelect` variable in the sketch so that it matches the required settings for the MKR Zero, as seen in the comments of the sketch.
194
148
195
-
You can download the example sketch [here](assets/nicla_sense_env_low_power_mode_example.zip).
149
+
For more information about the API of the SD library, [go here](https://docs.arduino.cc/libraries/sd/). For more in-depth tutorials for the MKR Zero, [go here](https://docs.arduino.cc/hardware/mkr-zero/#tutorials).
0 commit comments