Skip to content

Commit c26f993

Browse files
committed
Added images + changes in CS
1 parent b1b9f41 commit c26f993

File tree

4 files changed

+71
-139
lines changed

4 files changed

+71
-139
lines changed
Loading

content/hardware/03.nano/boards/nano-esp32/tutorials/cheat-sheet/cheat-sheet.md

Lines changed: 71 additions & 139 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,20 @@ To install the core, go the **board manager** and search for **Nano ESP32**. If
5151

5252
You can also program your board via the [Arduino Web Editor](arduino-cloud/getting-started/getting-started-web-editor), an online IDE.
5353

54+
## MicroPython
55+
56+
The Nano ESP32 has support for MicroPython, a micro-implementation of Python that can easily be installed on your board.
57+
58+
To get started with MicroPython, please visit [MicroPython 101](/micropython-course), a course dedicated towards learning MicroPython on the Nano ESP32.
59+
60+
In this course, you will fundamental knowledge to get started, as well as a large selection of examples for popular third-party components.
61+
62+
## Arduino IoT Cloud
63+
64+
Nano ESP32 is supported in the [Arduino IoT Cloud](https://create.arduino.cc/iot/) platform. You can connect to the cloud either through "classic" Arduino, using the C++ library, or via MicroPython:
65+
- [Getting Started with Arduino IoT Cloud (classic)](https://docs.arduino.cc/arduino-cloud/getting-started/iot-cloud-getting-started)
66+
- [MicroPython with Arduino IoT Cloud](https://docs.arduino.cc/arduino-cloud/getting-started/iot-cloud-micropython)
67+
5468
## API
5569

5670
The Nano ESP32 can be programmed using the same API as for other Arduino boards (see [language reference](https://www.arduino.cc/reference/en/)).
@@ -69,22 +83,10 @@ The Nano ESP32 can be programmed to draw a minimal amount of power, making it su
6983

7084
The [Sleep Modes](https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/api-reference/system/sleep_modes.html) section in the ESP32 docs explains how to configure your board to draw minimal power, introducing the **light sleep** and **deep sleep**
7185

72-
## MicroPython
73-
74-
The Nano ESP32 has support for MicroPython, a micro-implementation of Python that can easily be installed on your board.
75-
76-
To get started with MicroPython, please visit [MicroPython 101](/micropython-course), a course dedicated towards learning MicroPython on the Nano ESP32.
77-
78-
In this course, you will fundamental knowledge to get started, as well as a large selection of examples for popular third-party components.
79-
80-
## Arduino IoT Cloud
81-
82-
Nano ESP32 is supported in the [Arduino IoT Cloud](https://create.arduino.cc/iot/) platform. You can connect to the cloud either through "classic" Arduino, using the C++ library, or via MicroPython:
83-
- [Getting Started with Arduino IoT Cloud (classic)](https://docs.arduino.cc/arduino-cloud/getting-started/iot-cloud-getting-started)
84-
- [MicroPython with Arduino IoT Cloud](https://docs.arduino.cc/arduino-cloud/getting-started/iot-cloud-micropython)
85-
8686
## Power Considerations
8787

88+
![Nano ESP32 Power Tree.](assets/nano-esp32-powertree.png)
89+
8890
To power the Nano ESP32 you may either use a USB-C cable, or the VIN pin. Never exceed 5-18V as the **MP2322GQH** converter on the board is not designed for any higher voltages.
8991

9092
### Input Voltage (VIN)
@@ -94,7 +96,7 @@ To power the Nano ESP32 you may either use a USB-C cable, or the VIN pin. Never
9496

9597
### Operating Voltage
9698

97-
The internal operating voltage of the microcontroller is 3.3V, and you should not apply voltages higher than that to the GPIO pins.
99+
The internal operating voltage of the ESP32-S3 SoC is 3.3V, and you should not apply voltages higher than that to the GPIO pins.
98100

99101
### 5V Pin / VUSB
100102

@@ -108,7 +110,7 @@ This measure is taken to prevent the board's microcontroller from accidentially
108110

109111
The Nano ESP32 has two headers: the **analog** and **digital**. Listed here are the **default** pins that comply with previous Nano form factor designs.
110112

111-
The following pins are available on the board.
113+
The following pins are available on the board:
112114

113115
| Pin | Type | Function |
114116
| -------- | ------- | ------------------------------------------- |
@@ -135,12 +137,15 @@ The following pins are available on the board.
135137
| A6 | Analog | Analog input 6 |
136138
| A7 | Analog | Analog input 7 |
137139

140+
Note that all pins can be used as GPIO, due to the ESP32's flexibility.
141+
138142
### Digital
139143

140144
The Nano ESP32 has 14 digital pins (D0-D13), that can be read by using `digitalRead()` or written to using `digitalWrite()`.
141145

142146
| Pin | Type | Function |
143147
| -------- | ------- | ------------------------------------ |
148+
| D13/SCK | Digital | **SPI** Serial Clock / LED Built in |
144149
| D12/CIPO | Digital | **SPI** Controller In Peripheral Out |
145150
| D11/COPI | Digital | **SPI** Controller Out Peripheral In |
146151
| D10 | Digital | GPIO |
@@ -155,38 +160,57 @@ The Nano ESP32 has 14 digital pins (D0-D13), that can be read by using `digitalR
155160
| D1/RX | Digital | GPIO 1 / **UART** Receiver (RX) |
156161
| D0/TX | Digital | GPIO 0 / **UART** Transmitter (TX) |
157162

163+
Note that all analog pins can be used as digital pins as well, but not vice versa.
164+
158165
### Analog
159166

160-
| Pin | Type | Function |
161-
| --- | ------ | ------------------------------------------- |
162-
| A0 | Analog | Analog input 0 |
163-
| A1 | Analog | Analog input 1 |
164-
| A2 | Analog | Analog input 2 |
165-
| A3 | Analog | Analog input 3 |
166-
| A4 | Analog | Analog input 4 / **I2C** Serial Datal (SDA) |
167-
| A5 | Analog | Analog input 5 / **I2C** Serial Clock (SCL) |
168-
| A6 | Analog | Analog input 6 |
169-
| A7 | Analog | Analog input 7 |
167+
There are 8 analog input pins on the Nano ESP32, with 2 reserved for I2C communication (A4/A5). The ESP32-S3 embeds two SAR ADCs, `ADC1` and `ADC2`, where each ADC uses 4 channels each.
168+
169+
| Pin | Type | Function | ADC channel |
170+
| --- | ------ | ------------------------------------------- | ----------- |
171+
| A0 | Analog | Analog input 0 | `ADC1_CH0` |
172+
| A1 | Analog | Analog input 1 | `ADC1_CH1` |
173+
| A2 | Analog | Analog input 2 | `ADC1_CH2` |
174+
| A3 | Analog | Analog input 3 | `ADC1_CH3` |
175+
| A4 | Analog | Analog input 4 / **I2C** Serial Datal (SDA) | `ADC2_CH1` |
176+
| A5 | Analog | Analog input 5 / **I2C** Serial Clock (SCL) | `ADC2_CH2` |
177+
| A6 | Analog | Analog input 6 | `ADC2_CH3` |
178+
| A7 | Analog | Analog input 7 | `ADC2_CH4` |
179+
180+
***Please note that `ADC2` is also used for Wi-Fi® communication and can fail if used simultanenously.***
181+
182+
For more details, see [Analog to Digital Converter (link to Espressif docs)](https://docs.espressif.com/projects/esp-idf/en/v4.4/esp32s3/api-reference/peripherals/adc.html).
170183

171184
### PWM
172185

173-
Pulse width modulation (PWM) is supported on all digital pins (D0-D13).
186+
Pulse width modulation (PWM) is supported on **all digital pins (D0-D13)** as well **as all analog pins (A0-A7)**, where the output is controlled via the `analogWrite()` method.
187+
188+
```arduino
189+
analogWrite(pin,value);
190+
```
191+
192+
***Due to timer restrictions, only 4 PWM signals can be generated simultaneously.***
174193

175194
### Boot Pins
176195

177-
To enter bootloader mode (chip boot mode), you can use either the BOOT0 or BOOT1 pins, which are connected to the ESP32-S3's `GPIO0` and `GPIO46`.
196+
To enter bootloader mode (chip boot mode), you can use either the BOOT0 (B0) or BOOT1 (B1) pins, which are connected to the ESP32-S3's `GPIO0` and `GPIO46`.
197+
198+
![Boot pins.](assets/nano-esp32-boot.png)
178199

179-
Shorting these to GND + pressing the reset button will enter a bootloader mode. Note that while shorting these pins, a corresponding LED will
200+
Shorting these to GND + pressing the reset button will enter a bootloader mode. Note that while shorting these pins, a corresponding LED will light up (blue for )
180201

181202
You can read more about different this in the [Strapping Pins section](https://www.espressif.com/sites/default/files/documentation/esp32-s3_datasheet_en.pdf#page=23) in the ESP32-S3's datasheet.
182203

183204
## I2C
184205

206+
![I2C Pins](assets/nano-esp32-i2c.png)
207+
185208
The default pins used for I2C on the Nano ESP32 are the following:
186-
- SDA - A4
187-
- SCL - A5
188209

189-
![I2C Pins]()
210+
| Pin | Function | Description |
211+
| --- | -------- | -------------------- |
212+
| A4 | SDA | **I2C** Serial Data |
213+
| A5 | SCL | **I2C** Serial Clock |
190214

191215
To connect I2C devices you will need to include the [Wire](https://www.arduino.cc/reference/en/language/functions/communication/wire/) library at the top of your sketch.
192216

@@ -211,22 +235,21 @@ Wire.endTransmission(); //stop transmit
211235

212236
## SPI
213237

214-
![SPI Pins]()
238+
![SPI Pins](assets/nano-esp32-spi.png)
215239

216240
The Nano ESP32's SPI pins are listed below:
217241

218-
| Pin | Type | Function |
219-
| -------- | ---- | ----------------------------- |
220-
| D11 | COPI | Controller In, Peripheral Out |
221-
| D12 | CIPO | Controller Out, Peripheral In |
222-
| D13 | SCK | Serial Clock |
223-
| Any GPIO | CS | Chip Select |
224-
242+
| Pin | Function | Description |
243+
| ----- | -------- | ----------------------------- |
244+
| D10\* | CS | Chip Select |
245+
| D11 | COPI | Controller In, Peripheral Out |
246+
| D12 | CIPO | Controller Out, Peripheral In |
247+
| D13 | SCK | Serial Clock |
225248

249+
\*Any GPIO can be used for chip select.
226250

227251
The following example shows how to use SPI:
228252

229-
230253
```arduino
231254
#include <SPI.h>
232255
@@ -253,10 +276,10 @@ void loop() {
253276

254277
The pins used for UART on the Nano ESP32 are the following:
255278

256-
| Pin | Function |
257-
| --- | -------- |
258-
| D0 | RX0 |
259-
| D1 | TX0 |
279+
| Pin | Function | Description |
280+
| --- | -------- | -------------------- |
281+
| D0 | RX | Receive Serial Data |
282+
| D1 | TX | Transmit Serial Data |
260283

261284
To send and receive data through UART, we will first need to set the baud rate inside `void setup()`. Note that when using the UART (RX/TX pins), we use the `Serial1` object.
262285

@@ -286,7 +309,7 @@ The ESP32-S3 SoC features an IO mux (input/output multiplexer) and a GPIO matrix
286309

287310
The ESP32-S3 chip has 45 physical GPIOs, but many more digital peripherals. The IO mux provides the flexibility of routing the signals to different GPIOs, thus changing the function of a specific pin.
288311

289-
![](assets/IO_MUX.png)
312+
![](assets/nano-esp32-iomux.png)
290313

291314
This technique is well known and applied within ESP32 boards, but on the Nano ESP32 we use a set of default pins for the I2C, SPI & UART peripherals to remain consistent with previous designs.
292315

@@ -320,6 +343,8 @@ digitalWrite(45, STATE); //green
320343
digitalWrite(0, STATE); //blue
321344
```
322345

346+
347+
323348
## USB HID
324349

325350
Nano ESP32 can be used to emulate an HID device by using e.g. `Mouse.move(x,y)` or `Keyboard.press('w')`. The API documentation can be found in Arduino's language reference:
@@ -329,99 +354,6 @@ Nano ESP32 can be used to emulate an HID device by using e.g. `Mouse.move(x,y)`
329354

330355
Several ready to use examples are also available in the core at **Examples > USB**.
331356

332-
## SPI
333-
334-
![SPI Pins](assets/nano-esp32-spi.png)
335-
336-
The **Nano ESP32** SPI peripheral is attached to the following pins:
337-
338-
`SPI` uses the following pins:
339-
340-
- (SCK) - D13
341-
- (CIPO) - D12
342-
- (COPI) - D11
343-
- (CS) - D10\*
344-
345-
\*CS (Chip Select) can be changed to any free GPIO
346-
347-
348-
## I2C
349-
350-
![I2C Pins](assets/nano-esp32-i2c.png)
351-
352-
I2C lets you connect multiple I2C compatible devices in series using only two pins. The controller will send out information through the I2C bus to a 7-bit address, meaning that the technical limit of I2C devices on a single line is 128.
353-
354-
The pins used for I2C on the **Nano ESP32** are the following:
355-
- SDA - A4
356-
- SCL - A5
357-
358-
To connect I2C devices you will need to include the [Wire](https://www.arduino.cc/reference/en/language/functions/communication/wire/) library at the top of your sketch.
359-
360-
```arduino
361-
#include <Wire.h>
362-
```
363-
364-
Inside `void setup()` you need to initialize the library, and initialize the I2C port you want to use.
365-
366-
```arduino
367-
Wire.begin(); //initialize library
368-
```
369-
370-
And to write something to a device connected via I2C, we can use the following commands:
371-
372-
```arduino
373-
Wire.beginTransmission(1); //begin transmit to device 1
374-
Wire.write(byte(0x00)); //send instruction byte
375-
Wire.write(val); //send a value
376-
Wire.endTransmission(); //stop transmit
377-
```
378-
379-
## Serial/UART Pins
380-
381-
The **Nano ESP32** supports hardware serial communication with UART (Universal Asynchronous, Receiver-Transmitter).
382-
383-
The default UART pins are the following:
384-
385-
- RX0 - D0
386-
- TX0 - D1
387-
388-
Serial communication is handled via the `Serial` API, where `Serial` handles communication over USB, and `Serial1` over D0/D1.
389-
390-
```arduino
391-
Serial //serial over USB
392-
Serial1 //serial over D0/D1
393-
```
394-
395-
To send and receive data through UART, we will first need to set the baud rate inside `void setup()`.
396-
397-
```arduino
398-
Serial.begin(9600); //serial over USB
399-
Serial1.begin(9600); //serial using D0/D1
400-
```
401-
402-
To print something to the computer over USB, we use the `print()` / `println()` function.
403-
404-
```arduino
405-
Serial.print(); //prints content
406-
Serial.println(); //prints content + new line
407-
```
408-
409-
And to write something using D0/D1 (UART), we can use the following command:
410-
411-
```arduino
412-
Serial1.write("Hello world!");
413-
```
414-
415-
To read incoming data, we can use a while loop() to read each individual character and add it to a string.
416-
417-
```arduino
418-
while(Serial1.available()){
419-
delay(2);
420-
char c = Serial1.read();
421-
incoming += c;
422-
}
423-
```
424-
425357
## Test Pads
426358

427359
There are several test pads on the bottom side of the Nano ESP32. See the image below:

0 commit comments

Comments
 (0)