Skip to content

Commit b1b9f41

Browse files
committed
Update cheat-sheet.md
1 parent c42d4c7 commit b1b9f41

File tree

1 file changed

+180
-44
lines changed
  • content/hardware/03.nano/boards/nano-esp32/tutorials/cheat-sheet

1 file changed

+180
-44
lines changed

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

Lines changed: 180 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -47,22 +47,33 @@ This board is based on the [Arduino ESP32 Core](https://github.com/arduino/ardui
4747

4848
![ESP32 examples in the IDE.](assets/esp32-examples.png)
4949

50-
To install the core, go the **board manager** and search for **Nano ESP32**. If you need more instructions to install the core, please refer to the [Getting Started with Nano ESP32]() article.
50+
To install the core, go the **board manager** and search for **Nano ESP32**. If you need more instructions to install the core, please refer to the [Getting Started with Nano ESP32](/tutorials/nano-esp32/getting-started-nano-esp32) article.
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

5454
## API
5555

56-
Please refer to the well documented [ESP32-S3 API](https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/api-reference/index.html#) for more information regarding the API and accessing the boards peripherals.
56+
The Nano ESP32 can be programmed using the same API as for other Arduino boards (see [language reference](https://www.arduino.cc/reference/en/)).
5757

58-
To access the ESP32-S3's peripherals (e.g. ADC, I2C, SPI), refer to the [Peripherals API section](https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/api-reference/peripherals/index.html#).
58+
However, the ESP32 platform provides additional libraries and built-in functionalities that may not available in the standard Arduino API.
5959

60+
For more information, see the [ESP32-S3 API](https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/api-reference/index.html#)
61+
62+
### Peripherals API
63+
64+
To learn more about the ESP32-S3's peripherals (e.g. ADC, I2C, SPI, I2S, RTC), refer to the [Peripherals API section](https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/api-reference/peripherals/index.html#).
65+
66+
### Sleep Modes
67+
68+
The Nano ESP32 can be programmed to draw a minimal amount of power, making it suitable for power constrained designs, such as solar/battery powered projects.
69+
70+
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**
6071

6172
## MicroPython
6273

6374
The Nano ESP32 has support for MicroPython, a micro-implementation of Python that can easily be installed on your board.
6475

65-
To get started with MicroPython, please visit [MicroPython 101](), a course dedicated towards learning MicroPython on the Nano ESP32.
76+
To get started with MicroPython, please visit [MicroPython 101](/micropython-course), a course dedicated towards learning MicroPython on the Nano ESP32.
6677

6778
In this course, you will fundamental knowledge to get started, as well as a large selection of examples for popular third-party components.
6879

@@ -97,53 +108,178 @@ This measure is taken to prevent the board's microcontroller from accidentially
97108

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

100-
### Analog Header
101-
| Function | Type | Description |
102-
| -------- | ------ | ------------------------------------------- |
103-
| D13/SCK | NC | **SPI** Serial Clock / LED Built in |
104-
| +3V3 | Power | +3V3 Power Rail |
105-
| BOOT0 | Mode | Board Reset 0 |
106-
| A0 | Analog | Analog input 0 |
107-
| A1 | Analog | Analog input 1 |
108-
| A2 | Analog | Analog input 2 |
109-
| A3 | Analog | Analog input 3 |
110-
| A4 | Analog | Analog input 4 / **I2C** Serial Datal (SDA) |
111-
| A5 | Analog | Analog input 5 / **I2C** Serial Clock (SCL) |
112-
| A6 | Analog | Analog input 6 |
113-
| A7 | Analog | Analog input 7 |
114-
| VUSB | Power | USB power (5V) |
115-
| BOOT1 | Mode | Board Reset 1 |
116-
| GND | Power | Ground |
117-
| VIN | Power | Voltage Input |
118-
119-
### Digital Header
120-
121-
| Pin | Type | Description |
122-
| -------- | -------- | ------------------------------------ |
123-
| D12/CIPO | Digital | **SPI** Controller In Peripheral Out |
124-
| D11/COPI | Digital | **SPI** Controller Out Peripheral In |
125-
| D10 | Digital | GPIO |
126-
| D9 | Digital | GPIO |
127-
| D8 | Digital | GPIO |
128-
| D7 | Digital | GPIO |
129-
| D6 | Digital | GPIO |
130-
| D5 | Digital | GPIO |
131-
| D4 | Digital | GPIO |
132-
| D3 | Digital | GPIO |
133-
| D2 | Digital | GPIO |
134-
| GND | Power | Ground |
135-
| RST | Internal | Reset |
136-
| D1/RX | Digital | GPIO 1 / **UART** Receiver (RX) |
137-
| D0/TX | Digital | GPIO 0 / **UART** Transmitter (TX) |
138-
139-
## Boot Pins
111+
The following pins are available on the board.
112+
113+
| Pin | Type | Function |
114+
| -------- | ------- | ------------------------------------------- |
115+
| D13/SCK | Digital | **SPI** Serial Clock / LED Built in |
116+
| D12/CIPO | Digital | **SPI** Controller In Peripheral Out |
117+
| D11/COPI | Digital | **SPI** Controller Out Peripheral In |
118+
| D10 | Digital | GPIO |
119+
| D9 | Digital | GPIO |
120+
| D8 | Digital | GPIO |
121+
| D7 | Digital | GPIO |
122+
| D6 | Digital | GPIO |
123+
| D5 | Digital | GPIO |
124+
| D4 | Digital | GPIO |
125+
| D3 | Digital | GPIO |
126+
| D2 | Digital | GPIO |
127+
| D1/RX | Digital | GPIO 1 / **UART** Receiver (RX) |
128+
| D0/TX | Digital | GPIO 0 / **UART** Transmitter (TX) |
129+
| A0 | Analog | Analog input 0 |
130+
| A1 | Analog | Analog input 1 |
131+
| A2 | Analog | Analog input 2 |
132+
| A3 | Analog | Analog input 3 |
133+
| A4 | Analog | Analog input 4 / **I2C** Serial Datal (SDA) |
134+
| A5 | Analog | Analog input 5 / **I2C** Serial Clock (SCL) |
135+
| A6 | Analog | Analog input 6 |
136+
| A7 | Analog | Analog input 7 |
137+
138+
### Digital
139+
140+
The Nano ESP32 has 14 digital pins (D0-D13), that can be read by using `digitalRead()` or written to using `digitalWrite()`.
141+
142+
| Pin | Type | Function |
143+
| -------- | ------- | ------------------------------------ |
144+
| D12/CIPO | Digital | **SPI** Controller In Peripheral Out |
145+
| D11/COPI | Digital | **SPI** Controller Out Peripheral In |
146+
| D10 | Digital | GPIO |
147+
| D9 | Digital | GPIO |
148+
| D8 | Digital | GPIO |
149+
| D7 | Digital | GPIO |
150+
| D6 | Digital | GPIO |
151+
| D5 | Digital | GPIO |
152+
| D4 | Digital | GPIO |
153+
| D3 | Digital | GPIO |
154+
| D2 | Digital | GPIO |
155+
| D1/RX | Digital | GPIO 1 / **UART** Receiver (RX) |
156+
| D0/TX | Digital | GPIO 0 / **UART** Transmitter (TX) |
157+
158+
### Analog
159+
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 |
170+
171+
### PWM
172+
173+
Pulse width modulation (PWM) is supported on all digital pins (D0-D13).
174+
175+
### Boot Pins
140176

141177
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`.
142178

143179
Shorting these to GND + pressing the reset button will enter a bootloader mode. Note that while shorting these pins, a corresponding LED will
144180

145181
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.
146182

183+
## I2C
184+
185+
The default pins used for I2C on the Nano ESP32 are the following:
186+
- SDA - A4
187+
- SCL - A5
188+
189+
![I2C Pins]()
190+
191+
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.
192+
193+
```arduino
194+
#include <Wire.h>
195+
```
196+
197+
Inside `void setup()` you need to initialize the library, and initialize the I2C port you want to use.
198+
199+
```arduino
200+
Wire.begin() //SDA & SDL
201+
```
202+
203+
And to write something to a device connected via I2C, we can use the following commands:
204+
205+
```arduino
206+
Wire.beginTransmission(1); //begin transmit to device 1
207+
Wire.write(byte(0x00)); //send instruction byte
208+
Wire.write(val); //send a value
209+
Wire.endTransmission(); //stop transmit
210+
```
211+
212+
## SPI
213+
214+
![SPI Pins]()
215+
216+
The Nano ESP32's SPI pins are listed below:
217+
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+
225+
226+
227+
The following example shows how to use SPI:
228+
229+
230+
```arduino
231+
#include <SPI.h>
232+
233+
const int CS = 10;
234+
235+
236+
void setup() {
237+
pinMode(CS, OUTPUT);
238+
239+
SPI.begin();
240+
241+
digitalWrite(CS, LOW);
242+
243+
SPI.transfer(0x00);
244+
245+
digitalWrite(CS, HIGH);
246+
}
247+
248+
void loop() {
249+
}
250+
```
251+
252+
## UART
253+
254+
The pins used for UART on the Nano ESP32 are the following:
255+
256+
| Pin | Function |
257+
| --- | -------- |
258+
| D0 | RX0 |
259+
| D1 | TX0 |
260+
261+
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.
262+
263+
```arduino
264+
Serial1.begin(9600);
265+
```
266+
267+
To read incoming data, we can use a while loop() to read each individual character and add it to a string.
268+
269+
```arduino
270+
while(Serial1.available()){
271+
delay(2);
272+
char c = Serial1.read();
273+
incoming += c;
274+
}
275+
```
276+
277+
And to write something, we can use the following command:
278+
279+
```arduino
280+
Serial1.write("Hello world!");
281+
```
282+
147283
## IO Mux & GPIO Matrix
148284

149285
The ESP32-S3 SoC features an IO mux (input/output multiplexer) and a GPIO matrix. The IO mux acts as a data selector and allows for different peripherals to be connected to a physical pin.

0 commit comments

Comments
 (0)