YARA ESP32 Sensor is a comprehensive ESP32 sensor development platform that provides multiple hardware interfaces, web configuration interface, MQTT communication, and OTA update capabilities.
- ADC (Analog-to-Digital Converter): 12-bit ADC support for reading analog sensor values
- I2C: I2C Master mode supporting multiple I2C devices
- SPI: SPI Master/Slave mode for high-speed data transmission
- UART: Serial communication interface supporting multiple UART channels
- PWM: LEDC PWM output with breathing LED effects
- GPIO: General-purpose input/output control
- WiFi AP+STA Mode: Simultaneous support for Access Point and Station modes
- Web Server: Built-in web configuration interface supporting WiFi setup, OTA updates, and more
- MQTT: Support for MQTT over TLS (MQTTS) secure communication
- SNTP: Automatic network time synchronization
- OTA Updates: Support for HTTPS OTA firmware updates
- NVS Storage: Non-volatile storage for saving WiFi configuration and other settings
- Authentication System: Web interface login authentication mechanism
- ESP-IDF v5.2.6 or newer
- Python 3.8+
- Supported development board: ESP32-S3-WROOM-1 (ESP32-S3-DevKitC-1 4MB/8MB/16MB)
# Set ESP-IDF environment variables
. ~/esp/v5.2.6/esp-idf/export.shcd /path/to/yara_esp32_ota_std
idf.py build# Flash all required files
idf.py -p /dev/ttyUSB0 flash
# Or use the complete flash command
idf.py -p /dev/ttyUSB0 flash monitor| Offset Address | File | Description |
|---|---|---|
| 0x1000 | bootloader.bin | Bootloader |
| 0x8000 | partition-table.bin | Partition table |
| 0xe000 | ota_data_initial.bin | OTA data initial file |
| 0x270000 | yara_esp32_ota_std.bin | Application firmware |
idf.py -p /dev/ttyUSB0 monitorAfter device startup, it will automatically create a WiFi Access Point:
- SSID:
ESP32_Config(configurable in NVS) - Password:
12345678(configurable in NVS) - IP Address:
192.168.4.1
Connect your phone or computer to this WiFi network, then open a browser and visit http://192.168.4.1
First-time access will show the login page:
- Default Username:
admin - Default Password:
admin123
After successful login, you will enter the main control panel:
You can configure WiFi Station mode in the web interface to connect the device to an existing WiFi network:
- Navigate to the WiFi Settings page
- Enter the WiFi SSID and password to connect
- Click Save
- The device will automatically restart and connect to the configured WiFi
Note:
- WiFi configuration is stored in NVS and automatically loaded after restart
- If connection fails, the device will return to AP mode
- AP mode will automatically close after 5 minutes (only STA mode remains)
The system supports OTA updates via HTTPS:
- Navigate to the OTA Update page
- Enter the firmware download URL (HTTPS)
- Click Start Update
- The system will automatically download and install the new firmware
OTA Update Process:
- Automatically check version number
- Download new firmware to OTA partition
- Verify firmware integrity
- Automatically restart and switch to new firmware
All interface GPIO configurations are defined in main/interface/interface_config.h.
By default, CHIP_NAME is set to CHIP_ESP32_S3_WROOM, which corresponds to ESP32-S3-WROOM-1 (ESP32-S3-DevKitC-1):
// I2C Configuration (ESP32-S3-WROOM-1)
#define I2C_SDA_PIN GPIO_NUM_8 // SDA
#define I2C_SCL_PIN GPIO_NUM_9 // SCL
#define I2C_CLOCK_SPEED_HZ 100000
// SPI Configuration (ESP32-S3-WROOM-1, FSPI)
#define SPI_MOSI_PIN GPIO_NUM_11 // MOSI
#define SPI_MISO_PIN GPIO_NUM_13 // MISO
#define SPI_SCLK_PIN GPIO_NUM_12 // SCLK
#define SPI_CS_PIN GPIO_NUM_10 // CS
// UART Configuration (ESP32-S3-WROOM-1, USB-to-UART)
#define UART_TX_PIN GPIO_NUM_43 // TX
#define UART_RX_PIN GPIO_NUM_44 // RX
#define UART_BAUD_RATE 115200
// PWM Example Pins (ESP32-S3-WROOM-1)
#define PWM_PIN_0 GPIO_NUM_2
#define PWM_PIN_1 GPIO_NUM_4
#define PWM_PIN_2 GPIO_NUM_5
#define PWM_PIN_3 GPIO_NUM_12
// ADC Example Pins (ESP32-S3-WROOM-1)
#define ADC_PIN_0 GPIO_NUM_1
#define ADC_PIN_1 GPIO_NUM_2For detailed interface usage examples, please refer to:
main/interface/README.md- Complete interface API documentationmain/examples/- Various usage examples
#include "interface/adc_interface.h"
adc_oneshot_unit_handle_t adc_handle;
adc_interface_init(ADC_UNIT_1, ADC_BITWIDTH_12, &adc_handle);
int adc_value;
adc_interface_read(adc_handle, ADC_CHANNEL_0, &adc_value);#include "interface/i2c_interface.h"
i2c_master_bus_handle_t bus_handle;
i2c_interface_init_default(I2C_NUM_0, &bus_handle);
i2c_master_dev_handle_t dev_handle;
i2c_interface_device_add(bus_handle, 0x48, &dev_handle);
uint8_t data[2] = {0x00, 0x01};
i2c_interface_write(dev_handle, data, 2, 1000);#include "interface/uart_interface.h"
uart_interface_init_default(UART_NUM_1);
uint8_t tx_data[] = "Hello";
uart_interface_write(UART_NUM_1, tx_data, sizeof(tx_data)-1);
uint8_t rx_data[64];
int len = uart_interface_read(UART_NUM_1, rx_data, sizeof(rx_data), 1000);The system includes a built-in MQTT over TLS (MQTTS) client with support for:
- Secure Connection: TLS/SSL encrypted communication
- Message Queues: RX/TX message queue mechanism
- Auto Reconnect: Automatic reconnection on connection loss
- QoS Support: Support for QoS 0/1
Refer to main/examples/mqtts_example.c for complete usage instructions.
yara_esp32_ota_std/
├── main/
│ ├── interface/ # Hardware interface modules
│ │ ├── adc_interface.c/h
│ │ ├── i2c_interface.c/h
│ │ ├── spi_interface.c/h
│ │ ├── uart_interface.c/h
│ │ ├── pwm_interface.c/h
│ │ ├── gpio_interface.c/h
│ │ └── interface_config.h
│ ├── helper/ # Helper modules
│ │ ├── my_nvs.c/h # NVS quick operations
│ │ └── my_queue.c/h # Message queue
│ ├── examples/ # Usage examples
│ ├── web_server.c/h # Web server
│ ├── wifi_manager.c/h # WiFi management
│ ├── mqtts_client.c/h # MQTT client
│ ├── ota_update.c/h # OTA update
│ └── main.c # Main program
├── document/ # Documentation images
└── README.md # This file
idf.py -p /dev/ttyUSB0 monitoridf.py fullclean
idf.py buildIf you need to clear all stored settings (WiFi configuration, etc.), you can call in your code:
my_nvs_clear_namespace("wifi_config");
my_nvs_clear_namespace("web_auth");Or use idf.py erase-flash to erase the entire Flash.
- Check if SSID and password are correct
- Ensure WiFi signal strength is sufficient
- Check serial output logs to understand the error
- Verify HTTPS URL is accessible
- Check if certificate is valid
- Ensure partition table has sufficient space
- Check if GPIO configuration matches hardware
- Ensure no GPIO conflicts
- Review settings in
interface_config.h
- Ensure you are connected to the device's WiFi AP
- Check if IP address is
192.168.4.1 - Clear browser cache and try again
- ESP-IDF Documentation: https://docs.espressif.com/projects/esp-idf/
- ESP32 Forum: https://esp32.com/
This project is developed based on ESP-IDF and follows the corresponding open source license terms.
- Firmware Version: Check build output or
version.md - ESP-IDF Version: v5.2.6
- Supported Platform: ESP32-S3-WROOM-1 (ESP32-S3-DevKitC-1)
Note: When using for the first time, ensure that the ESP-IDF environment is properly configured and use the correct serial port for flashing and monitoring.
Simple example showing how sensor data can be displayed on a 0.96" SSD1306 OLED via I2C.
Example wiring and setup of the Sensirion SCD30 CO₂ / temperature / humidity sensor over I2C.