Beetle ESP32 - C3 (RISC-V Core Development Board) Documentation
The Beetle ESP32 - C3 is a powerful and versatile development board featuring the ESP32-C3 system-on-chip (SoC) with a RISC-V core. This board provides a robust platform for IoT development, offering Wi-Fi and Bluetooth 5 connectivity, ample storage, and a range of peripherals. The ESP32-C3 SoC integrates a 32-bit RISC-V processor, 4MB of flash memory, and 520KB of SRAM.
ESP32-C3 RISC-V SoC
4MB Flash Memory
520KB SRAM
Wi-Fi 802.11 b/g/n
Bluetooth 5.0
USB Type-C interface
22 GPIO pins
2x 12-bit ADC channels
2x 8-bit DAC channels
I2C, I2S, SPI, UART interfaces
The Beetle ESP32 - C3 is supported by the ESP32-C3 IoT Development Framework, which provides a comprehensive set of APIs and tools for developing IoT applications. The board can be programmed using C/C++ or MicroPython.
### Example 1: Wi-Fi Connectivity and HTTP GET Request
This example demonstrates how to connect to a Wi-Fi network and perform an HTTP GET request using the Beetle ESP32 - C3.
```c
#include <WiFi.h>
#include <HTTPClient.h>
// Wi-Fi credentials
const char ssid = "your_ssid";
const char password = "your_password";
// HTTP client
HTTPClient http;
void setup() {
Serial.begin(115200);
// Connect to Wi-Fi
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.println("Connecting to Wi-Fi...");
}
Serial.println("Connected to Wi-Fi");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
}
void loop() {
// Perform HTTP GET request
http.begin("http://example.com");
int httpResponseCode = http.GET();
if (httpResponseCode > 0) {
String response = http.getString();
Serial.println("HTTP Response: ");
Serial.println(response);
} else {
Serial.println("Error on HTTP request");
}
http.end();
delay(10000);
}
```
### Example 2: Bluetooth Low Energy (BLE) Peripheral Mode
This example demonstrates how to use the Beetle ESP32 - C3 as a BLE peripheral device, advertising a custom service and characteristic.
// BLE device name
const char deviceName = "Beetle ESP32 - C3";
// BLE service and characteristic UUIDs
const char serviceUUID = "00001812-0000-1000-8000-00805f9b34fb";
const char charUUID = "00002a4a-0000-1000-8000-00805f9b34fb";
BLEServer server;
BLEService service;
BLECharacteristic characteristic;
void setup() {
Serial.begin(115200);
// Initialize BLE
BLEDevice::init(deviceName);
server = BLEDevice::createServer();
// Create BLE service and characteristic
service = server->createService(serviceUUID);
characteristic = service->createCharacteristic(charUUID, BLECharacteristic::PROPERTY_READ | BLECharacteristic::PROPERTY_WRITE);
// Start BLE advertising
server->startAdvertising();
Serial.println("BLE advertising started");
}
void loop() {
delay(1000);
}
```
### Example 3: ADC Readings and UART Output
This example demonstrates how to read analog values from the ADC channels and output the results over the UART interface.
```c
#include <analogRead.h>
// ADC channel 0
const int adcChannel = 0;
void setup() {
Serial.begin(115200);
}
void loop() {
// Read ADC value
int adcValue = analogRead(adcChannel);
float voltage = (adcValue 3.3) / 4095.0;
// Print ADC value and voltage over UART
Serial.print("ADC Channel 0: ");
Serial.print(adcValue);
Serial.print(" (");
Serial.print(voltage);
Serial.println("V)");
These examples showcase the capabilities of the Beetle ESP32 - C3 development board and demonstrate how to utilize its various features, including Wi-Fi connectivity, BLE peripheral mode, and ADC readings with UART output.