Skip to content

Commit 5c7afe2

Browse files
author
GitHub Actions
committed
feat: Comprehensive wireless communication documentation expansion
- Expanded 66_communication.rst with complete ESP32-H2 wireless capabilities - Added detailed Bluetooth 5.0 LE examples (peripheral, central, scanner) - Included IEEE 802.15.4 protocols (Thread, Zigbee, Matter) - Added power management and security considerations - Included practical IoT applications and troubleshooting - Added protocol comparison tables and future expansion roadmap - Updated documentation with English format and technical accuracy - Renamed 55_WS2812.rst to 55_RGB_LED.rst for generic terminology - Updated SPI pin configuration (CS: GPIO11) in 44_spi.rst - Enhanced MicroPython library documentation in 02_lib.rst - Updated index.rst to reference new RGB LED documentation
1 parent 9209672 commit 5c7afe2

File tree

6 files changed

+798
-90
lines changed

6 files changed

+798
-90
lines changed

software/sphinx/src/source/02_lib.rst

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ The firmware is available in the following location:
2828
Installation Methods
2929
~~~~~~~~~~~~~~~~~~~
3030

31-
Method 1: Web-Based Flashing (Recommended for Beginners)
31+
Web-Based Flashing (Recommended for Beginners)
3232
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3333

3434
Using **ESPTool-JS Web Flasher**:
@@ -49,18 +49,7 @@ Using **ESPTool-JS Web Flasher**:
4949
5. **Start Flashing**: Click "Program" button
5050
6. **Wait for completion**: Process takes approximately 2-3 minutes
5151

52-
Method 2: Automatic Flashing Script
53-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
54-
55-
.. code-block:: bash
56-
57-
# Make script executable
58-
chmod +x flash_esp32h2.sh
59-
60-
# Run automatic flashing
61-
./flash_esp32h2.sh
62-
63-
Method 3: Manual Flashing with ESPTool
52+
Manual Flashing with ESPTool
6453
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6554

6655
.. code-block:: bash
@@ -81,23 +70,31 @@ After successful flashing, connect to the MicroPython REPL:
8170

8271
.. tabs::
8372

73+
74+
.. tab:: Windows
75+
76+
.. code-block:: bash
77+
78+
# Using PuTTY or built-in serial terminal
79+
# Port: COM3 (check Device Manager)
80+
# Baud Rate: 115200
81+
82+
8483
.. tab:: Linux/macOS
8584

8685
.. code-block:: bash
8786
87+
# Using picocom
88+
picocom -b 115200 /dev/ttyACM0
89+
8890
# Using screen
8991
screen /dev/ttyACM0 115200
9092
9193
# Using miniterm
9294
python3 -m serial.tools.miniterm /dev/ttyACM0 115200
9395
94-
.. tab:: Windows
9596
96-
.. code-block:: bash
9797
98-
# Using PuTTY or built-in serial terminal
99-
# Port: COM3 (check Device Manager)
100-
# Baud Rate: 115200
10198
10299
.. tab:: Thonny IDE
103100

software/sphinx/src/source/44_spi.rst

Lines changed: 77 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ This table illustrates the connections between the SD card and the GPIO pins on
6969
- ---
7070
* - 2
7171
- D3/CS (Chip Select)
72-
- GPIO25
72+
- GPIO11
7373
- D10/SS
7474
* - 3
7575
- CMD/MOSI
@@ -100,7 +100,7 @@ This table illustrates the connections between the SD card and the GPIO pins on
100100
**MicroSD Connection Notes:**
101101

102102
- The microSD card is connected via SPI interface using **4 wires** (MOSI, MISO, SCK, CS)
103-
- **CS (Chip Select)** is connected to **GPIO25** (D10/SS pin)
103+
- **CS (Chip Select)** is connected to **GPIO11** (D10/SS pin)
104104
- **MOSI** is connected to **GPIO5** (D11/MOSI pin)
105105
- **MISO** is connected to **GPIO0** (D12/MISO pin)
106106
- **SCK** is connected to **GPIO4** (D13/SCK pin)
@@ -113,31 +113,59 @@ This table illustrates the connections between the SD card and the GPIO pins on
113113

114114
.. code-block:: python
115115
116-
import machine
116+
from machine import Pin, SPI
117117
import os
118-
from sdcard import SDCard
118+
import sdcard
119+
import time
119120
120-
# Pines SPI para microSD
121+
# --- Custom pin configuration ---
121122
MOSI_PIN = 5
122123
MISO_PIN = 0
123-
SCK_PIN = 4
124-
CS_PIN = 25
125-
126-
# Inicializar SPI
127-
spi = machine.SPI(1, baudrate=500000, polarity=0, phase=0,
128-
sck=machine.Pin(SCK_PIN),
129-
mosi=machine.Pin(MOSI_PIN),
130-
miso=machine.Pin(MISO_PIN))
131-
132-
# Inicializar tarjeta SD
133-
sd = SDCard(spi, machine.Pin(CS_PIN))
134-
135-
# Montar la SD en el sistema de archivos
136-
os.mount(sd, "/sd")
137-
138-
# Listar archivos y directorios en la SD
139-
print("Archivos en la SD:")
140-
print(os.listdir("/sd"))
124+
SCK_PIN = 4
125+
CS_PIN = 11
126+
127+
# --- Initialize SPI with custom pins ---
128+
spi = SPI(
129+
1, # Bus SPI(1) = HSPI (can use remapped pins)
130+
baudrate=5_000_000, # 5 MHz is more stable with long cables or sensitive SDs
131+
polarity=0,
132+
phase=0,
133+
sck=Pin(SCK_PIN),
134+
mosi=Pin(MOSI_PIN),
135+
miso=Pin(MISO_PIN)
136+
)
137+
138+
# --- Chip Select pin ---
139+
cs = Pin(CS_PIN, Pin.OUT)
140+
141+
# --- Initialize SD card ---
142+
try:
143+
sd = sdcard.SDCard(spi, cs)
144+
vfs = os.VfsFat(sd)
145+
os.mount(vfs, "/sd")
146+
print("microSD mounted successfully at /sd\n")
147+
148+
# --- List contents ---
149+
print("Contents of /sd:")
150+
for fname in os.listdir("/sd"):
151+
print(" -", fname)
152+
153+
# --- Read/write test ---
154+
test_path = "/sd/test.txt"
155+
with open(test_path, "w") as f:
156+
f.write("Hello from ESP32 with custom SPI pins!\n")
157+
print(f"\nFile created: {test_path}")
158+
159+
with open(test_path, "r") as f:
160+
print("\nFile contents:")
161+
print(f.read())
162+
163+
except Exception as e:
164+
print("Error initializing SD card:", e)
165+
166+
# --- Infinite loop ---
167+
while True:
168+
time.sleep(1)
141169
142170
143171
.. tab:: C++
@@ -151,70 +179,70 @@ This table illustrates the connections between the SD card and the GPIO pins on
151179
#define MOSI_PIN 5
152180
#define MISO_PIN 0
153181
#define SCK_PIN 4
154-
#define CS_PIN 25
182+
#define CS_PIN 11
155183

156184
File myFile;
157185

158186
void setup() {
159187
Serial.begin(115200);
160-
while (!Serial) ; // Esperar a que el puerto serie esté listo
188+
while (!Serial) ; // Wait for serial port to be ready
161189

162190
SPI.begin(SCK_PIN, MISO_PIN, MOSI_PIN, CS_PIN);
163191

164-
Serial.println("Inicializando tarjeta SD...");
192+
Serial.println("Initializing SD card...");
165193

166194
if (!SD.begin(CS_PIN)) {
167-
Serial.println("Error al inicializar la tarjeta SD.");
195+
Serial.println("Error initializing SD card.");
168196
return;
169197
}
170198

171-
Serial.println("Tarjeta SD inicializada correctamente.");
199+
Serial.println("SD card initialized successfully.");
172200

173-
// Listar archivos
174-
Serial.println("Archivos en la SD:");
201+
// List files
202+
Serial.println("Files on SD card:");
175203
listDir(SD, "/", 0);
176204

177-
// Crear y escribir en el archivo
205+
// Create and write to file
178206
myFile = SD.open("/test.txt", FILE_WRITE);
179207
if (myFile) {
180-
myFile.println("Hola, Arduino en SD!");
181-
myFile.println("Esto es una prueba de escritura.");
208+
myFile.println("Hello, Arduino on SD!");
209+
myFile.println("This is a write test.");
182210
myFile.close();
183-
Serial.println("Archivo escrito correctamente.");
211+
Serial.println("File written successfully.");
184212
} else {
185-
Serial.println("Error al abrir test.txt para escribir.");
213+
Serial.println("Error opening test.txt for writing.");
186214
}
187215

188-
// Leer el archivo
216+
// Read the file
189217
myFile = SD.open("/test.txt");
190218
if (myFile) {
191-
Serial.println("\nContenido del archivo:");
219+
Serial.println("\nFile contents:");
192220
while (myFile.available()) {
193221
Serial.write(myFile.read());
194222
}
195223
myFile.close();
196224
} else {
197-
Serial.println("Error al abrir test.txt para lectura.");
225+
Serial.println("Error opening test.txt for reading.");
198226
}
199227

200-
// Volver a listar archivos
201-
Serial.println("\nArchivos en la SD después de la escritura:");
228+
// List files again
229+
Serial.println("\nFiles on SD card after writing:");
202230
listDir(SD, "/", 0);
203231
}
204232

205233
void loop() {
206-
// Nada en el loop
234+
// Nothing in the loop
207235
}
208236

209-
// Función para listar archivos y carpetas
237+
// Function to list files and folders
210238
void listDir(fs::FS &fs, const char * dirname, uint8_t levels) {
211239
File root = fs.open(dirname);
212240
if (!root) {
213-
Serial.println("Error al abrir el directorio");
241+
Serial.println("Error opening directory");
214242
return;
215243
}
216244
if (!root.isDirectory()) {
217-
Serial.println("No es un directorio");
245+
Serial.println("Not a directory");
218246
return;
219247
}
220248

@@ -329,3 +357,8 @@ This table illustrates the connections between the SD card and the GPIO pins on
329357
:width: 90%
330358

331359
ESP-IDF Menuconfig SD SPI Configuration
360+
361+
Resources
362+
---------
363+
364+
- `MicroPython SDCard Library <

software/sphinx/src/source/55_WS2812.rst renamed to software/sphinx/src/source/55_RGB_LED.rst

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
WS2812 Control
2-
=================
3-
Harness the power of WS1280 LED strips with the PULSAR H2 board. Learn how to control RGB LED strips and create dazzling lighting effects using MicroPython.
1+
Addressable RGB LED Control
2+
============================
3+
Harness the power of addressable RGB LED strips with the PULSAR H2 board. Learn how to control intelligent RGB LED strips and create dazzling lighting effects using MicroPython.
44

5-
This section describes how to control WS2812 LED strips using the PULSAR H2 board.
6-
The PULSAR H2 board has a GPIO pin embebbed connected to the single WS2812 LED.
5+
This section describes how to control addressable RGB LED strips (WS2812/WS2811 compatible) using the PULSAR H2 board.
6+
The PULSAR H2 board has a GPIO pin embedded connected to a single addressable RGB LED.
77

8-
.. list-table:: Pin Mapping for WS2812
8+
.. list-table:: Pin Mapping for Addressable RGB LED
99
:widths: 10 10
1010
:header-rows: 1
1111
:align: center
@@ -22,12 +22,12 @@ The PULSAR H2 board has a GPIO pin embebbed connected to the single WS2812 LED.
2222
:alt: rgb led
2323
:width: 40%
2424

25-
WS28xx LED Strip
25+
Addressable RGB LED Strip
2626

2727
Code Example
2828
------------
2929

30-
Below is an example that demonstrates how to control WS1280 LED strips using the PULSAR H2 board
30+
Below is an example that demonstrates how to control addressable RGB LED strips using the PULSAR H2 board
3131

3232
.. tabs::
3333

@@ -37,21 +37,32 @@ Below is an example that demonstrates how to control WS1280 LED strips using the
3737
3838
from machine import Pin
3939
from neopixel import NeoPixel
40-
np = NeoPixel(Pin(8), 1)
41-
np[0] = (255, 128, 0) # set to red, full brightness
42-
43-
np.write()
40+
41+
# Initialize addressable RGB LED on GPIO8
42+
rgb_led = NeoPixel(Pin(8), 1)
43+
44+
# Set color (Red, Green, Blue) - orange color
45+
rgb_led[0] = (255, 128, 0)
46+
47+
# Apply the color change
48+
rgb_led.write()
4449
4550
.. tab:: C++
4651

4752
.. code-block:: c++
4853

4954
#include <Adafruit_NeoPixel.h>
50-
#define PIN 8
51-
Adafruit_NeoPixel strip = Adafruit_NeoPixel(1, PIN, NEO_GRB + NEO_KHZ800);
55+
56+
#define RGB_LED_PIN 8
57+
#define NUM_LEDS 1
58+
59+
// Initialize addressable RGB LED strip
60+
Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUM_LEDS, RGB_LED_PIN, NEO_GRB + NEO_KHZ800);
61+
5262
void setup() {
5363
strip.begin();
54-
strip.setPixelColor(0, 255, 128, 0); // set to red, full brightness
64+
// Set color (Red, Green, Blue) - orange color
65+
strip.setPixelColor(0, 255, 128, 0);
5566
strip.show();
5667
}
5768
.. tab:: esp-idf
@@ -118,5 +129,7 @@ Below is an example that demonstrates how to control WS1280 LED strips using the
118129
119130
.. tip::
120131

121-
for more information on the NeoPixel library, refer to the `NeoPixel Library Documentation <https://github.com/lvidarte/esp8266/wiki/MicroPython:-NeoPixels>`_.
132+
**Compatibility Note**: This addressable RGB LED is compatible with WS2812/WS2811 protocols. For more information on the MicroPython implementation, refer to the `NeoPixel Library Documentation <https://github.com/lvidarte/esp8266/wiki/MicroPython:-NeoPixels>`_.
133+
134+
**Supported Protocols**: WS2812, WS2812B, WS2811, SK6812 and other compatible addressable RGB LEDs.
122135

0 commit comments

Comments
 (0)