Skip to content

Commit dd47b79

Browse files
mkr zero manual done
1 parent 4986561 commit dd47b79

File tree

8 files changed

+51
-97
lines changed

8 files changed

+51
-97
lines changed
Loading

Diff for: content/hardware/01.mkr/01.boards/mkr-zero/tutorials/mkr-zero-user-manual/content.md

+51-97
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
---
22
title: 'MKR Zero User Manual'
33
difficulty: beginner
4-
compatible-products: []
4+
compatible-products: [mkr-zero]
55
description: 'Learn about and how to use the MKR Zero board'
66
tags:
77
- Cheat sheet
88
- User manual
99
author: 'Benjamin Dannegård'
1010
hardware:
11-
- hardware/
11+
- hardware/01.mkr/01.boards/mkr-zero
1212
software:
1313
- ide-v1
1414
- ide-v2
@@ -36,18 +36,8 @@ This user manual provides a comprehensive overview of the MKR Zero board, highli
3636

3737
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.
3838

39-
![ ](assets/front_page.png)
40-
4139
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.
4240

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-
![Installing the board's library in the Arduino IDE](assets/user-manual-3.png)
50-
5141
### Pinout
5242

5343
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
6858

6959
## First Use
7060

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-
![Connecting the Nicla Sense Env](assets/user-manual-23.png)
61+
### Installing the SAMD Core
7662

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.
7864

79-
The Nicla Sense Env can be powered by:
65+
![Selecting board manager](assets/installing-a-core-img01.png)
8066

81-
- 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.
8368

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+
![List of cores](assets/installing-a-core-img02.png)
9770

9871
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.
9972

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.
10774

108-
![Selecting the right board and port]()
75+
### Selecting the Port
10976

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.
11278

113-
- `<COM29> (Arduino MKR Zero)`
114-
115-
For MAC users, it could look like this:
116-
117-
- `/dev/cu.usbmodem14112 (Arduino MKR Zero)`
79+
![Selecting the right board and port](assets/uploading-a-sketch-img03.png)
11880

11981
### Blink Example
12082

12183
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.
12284

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.
12486

12587
Copy and paste the example sketch below into a new sketch in the Arduino IDE:
12688

12789
```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+
}
12895
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+
}
129103
```
130104

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.
132106

133-
![Uploading a sketch to the board in the Arduino IDE](assets/user-manual-7.png)
107+
![Uploading a sketch to the board in the Arduino IDE](assets/uploading-a-sketch-img01.png)
134108

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.
136110

137-
### SD card example
111+
### Board Libraries
138112

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.
139114

115+
To install the `SD` library, navigate to the `Manage libraries` tab on the left side of the IDE.
140116

141-
### Low Power Mode Management
117+
![Library manager in the Arduino IDE](assets/installing-a-library-img01.png)
142118

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.
144120

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+
![Installing a library in the Arduino IDE](assets/installing-a-library-img02.png)
146122

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
148124

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**.
165126

166-
void setup() {
167-
// Initialize serial communication and wait up to 2.5 seconds for a connection
168-
Serial.begin(115200);
169-
for (auto startNow = millis() + 2500; !Serial && millis() < startNow; delay(500));
170-
171-
if (device.begin()) {
172-
// Putting the device to sleep
173-
Serial.println("- Going to deep sleep mode...");
174-
device.deepSleep();
175-
} else {
176-
Serial.println("- Device could not be found. Please double-check the wiring!");
177-
}
178-
}
127+
![Accessing the examples]()
179128

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+
![Inserting the SD card to the MKR Zero board](<assets/circuit-sd-card.png)
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.
184138

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.
186140

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.
188142

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.
190144

191-
![Example sketch output in the Arduino IDE's Serial Monitor](assets/user-manual-12.png)
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.
192146

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.
194148

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).
196150

197151
## Support
198152

0 commit comments

Comments
 (0)