Skip to content

Commit 4424372

Browse files
committed
Add Waveshare ESP32-C3-Zero DIY variant
Add an extra build target for the ESP32-C3-Zero paired with an Ai-Thinker Ra-02 SX1278 radio. Define the radio, I2C, GPS, and button pins, enable native USB CDC, and document wiring and frequency constraints.
1 parent a4ea55f commit 4424372

4 files changed

Lines changed: 130 additions & 0 deletions

File tree

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Waveshare ESP32-C3-Zero with Ai-Thinker Ra-02
2+
3+
This variant connects a [Waveshare ESP32-C3-Zero](https://docs.waveshare.com/ESP32-C3-Zero) to an Ai-Thinker Ra-02
4+
(SX1278) LoRa module.
5+
6+
## Wiring
7+
8+
| Ra-02 pin | ESP32-C3-Zero pin |
9+
| --------- | ----------------- |
10+
| 3.3V | 3V3 |
11+
| GND | GND |
12+
| SCK | GPIO4 |
13+
| MISO | GPIO5 |
14+
| MOSI | GPIO6 |
15+
| NSS | GPIO7 |
16+
| RESET | GPIO8 |
17+
| DIO0 | GPIO3 |
18+
| DIO1 | Not connected |
19+
| DIO2 | Not connected |
20+
21+
The Ra-02 is a 3.3 V device. Do not connect its VCC or signal pins to 5 V. Attach a suitable antenna before powering
22+
the module; transmitting without an antenna can damage its RF output stage.
23+
24+
The SX1278-based Ra-02 operates from 410 to 525 MHz. Configure Meshtastic for a legal regional band within that
25+
range; this module cannot operate on 868 or 915 MHz networks.
26+
27+
## Optional peripherals
28+
29+
| Peripheral | ESP32-C3-Zero pin |
30+
| ----------- | ----------------- |
31+
| I2C SDA | GPIO1 |
32+
| I2C SCL | GPIO0 |
33+
| GPS RX | GPIO20 |
34+
| GPS TX | GPIO21 |
35+
| BOOT button | GPIO9 |
36+
37+
Connect the GPS module's TX output to GPIO20 and its RX input to GPIO21.
38+
39+
## Build
40+
41+
From the firmware repository root, run:
42+
43+
```sh
44+
pio run -e esp32c3_zero
45+
```
46+
47+
Native USB CDC is enabled for flashing and serial logging through the board's USB-C connector.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#ifndef Pins_Arduino_h
2+
#define Pins_Arduino_h
3+
4+
#include <stdint.h>
5+
6+
static const uint8_t TX = 21;
7+
static const uint8_t RX = 20;
8+
9+
static const uint8_t SDA = 1;
10+
static const uint8_t SCL = 0;
11+
12+
static const uint8_t SS = 7;
13+
static const uint8_t MOSI = 6;
14+
static const uint8_t MISO = 5;
15+
static const uint8_t SCK = 4;
16+
17+
static const uint8_t A0 = 0;
18+
static const uint8_t A1 = 1;
19+
static const uint8_t A2 = 2;
20+
static const uint8_t A3 = 3;
21+
static const uint8_t A4 = 4;
22+
static const uint8_t A5 = 5;
23+
24+
#endif /* Pins_Arduino_h */
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
; Waveshare ESP32-C3-Zero Development Board
2+
; https://docs.waveshare.com/ESP32-C3-Zero
3+
[env:esp32c3_zero]
4+
extends = esp32c3_base
5+
board = esp32-c3-devkitm-1
6+
build_flags =
7+
${esp32c3_base.build_flags}
8+
-D PRIVATE_HW
9+
-I variants/esp32c3/diy/esp32c3_zero
10+
-D ARDUINO_USB_MODE=1
11+
-D ARDUINO_USB_CDC_ON_BOOT=1
12+
custom_meshtastic_support_level = 3
13+
board_level = extra
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#ifndef _VARIANT_ESP32C3_ZERO_
2+
#define _VARIANT_ESP32C3_ZERO_
3+
4+
/*----------------------------------------------------------------------------
5+
* Headers
6+
*----------------------------------------------------------------------------*/
7+
8+
#ifdef __cplusplus
9+
extern "C" {
10+
#endif // __cplusplus
11+
12+
// I2C (Wire)
13+
#define I2C_SDA (1)
14+
#define I2C_SCL (0)
15+
16+
#define HAS_SCREEN 0
17+
18+
// GPS
19+
#undef GPS_RX_PIN
20+
#undef GPS_TX_PIN
21+
#define GPS_RX_PIN (20)
22+
#define GPS_TX_PIN (21)
23+
24+
// Button
25+
#define BUTTON_PIN (9) // BOOT button
26+
27+
// Ai-Thinker Ra-02 (SX1278)
28+
#define USE_RF95
29+
#define LORA_SCK (4)
30+
#define LORA_MISO (5)
31+
#define LORA_MOSI (6)
32+
#define LORA_CS (7)
33+
#define LORA_RESET (8)
34+
#define LORA_DIO0 (3)
35+
#define LORA_DIO1 RADIOLIB_NC
36+
#define LORA_DIO2 RADIOLIB_NC
37+
38+
#ifdef __cplusplus
39+
}
40+
#endif
41+
42+
/*----------------------------------------------------------------------------
43+
* Arduino objects - C++ only
44+
*----------------------------------------------------------------------------*/
45+
46+
#endif

0 commit comments

Comments
 (0)