Skip to content

Firmware Setup

One-time setup for compiling and flashing the WeSense firmware to your ESP32 board.

Install Arduino IDE

  1. Download and install the Arduino IDE (version 2.x recommended)
  2. Add ESP32 board support: File → Preferences → Additional Board Manager URLs, add:
    https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
  3. Install the ESP32 boards package: Tools → Board → Boards Manager, search "esp32" and install esp32 by Espressif Systems

Select Your Board

Go to Tools → Board → ESP32 Arduino and select your board:

Physical BoardArduino Board Selection
ESP32 DevKit / WROOM-32ESP32 Dev Module
ESP32-C3 GenericESP32C3 Dev Module
ESP32-C6 Beetle / GenericESP32C6 Dev Module
ESP32-S3 GenericESP32S3 Dev Module
T-Beam v1.xESP32 Dev Module
T-Beam T3 S3 v1.2ESP32S3 Dev Module

USB CDC On Boot (C3, C6, S3 boards)

ESP32-C3, C6, and S3 boards use native USB (no external USB-Serial chip). You need to enable USB CDC for the serial monitor to work:

Tools → USB CDC On Boot → Enabled

Without this, you won't see any output in the serial monitor after flashing. This is one of the most common gotchas with newer ESP32 boards.

Set Partition Scheme

Tools → Partition Scheme → Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS)

Required

The default partition is too small for the WeSense firmware (which includes WiFi, MQTT, TLS, protobuf, LoRaWAN, and all sensor drivers). If you see "Sketch too big" errors, this is the first thing to check. You must set this every time you change board type — the setting is per-board.

Select Port

Tools → Port → [Your USB port]

Connect your board via USB. The port will appear as:

  • macOS: /dev/cu.usbmodem* or /dev/cu.SLAB_USBtoUART
  • Windows: COM3, COM4, etc.
  • Linux: /dev/ttyUSB0 or /dev/ttyACM0

If the port doesn't appear:

  • Try a different USB cable (some are charge-only with no data lines)
  • On C3/C6/S3 boards, you may need to hold the BOOT button while plugging in
  • Install the CP2102 driver if using a board with an external USB-Serial chip

Install Libraries

The firmware requires several Arduino libraries. Install them via Sketch → Include Library → Manage Libraries:

LibraryUsed For
SensirionI2cSht4xSHT40/41/45 temperature & humidity
Adafruit AHTX0AHT20 temperature & humidity
SparkFun SCD30 Arduino LibrarySCD30 CO2 sensor
SparkFun SCD4x Arduino LibrarySCD40/41 CO2 sensor
SensirionI2CSgp41SGP41 VOC/NOx sensor
Adafruit BME680 LibraryBME680 environmental sensor
Adafruit BMP280 LibraryBMP280 pressure sensor
Adafruit BMP3XX LibraryBMP390 pressure sensor
Adafruit INA219INA219 power monitor
Adafruit INA226INA226 power monitor
Adafruit TSL2591 LibraryTSL2591 light sensor
Adafruit LTR390 LibraryLTR-390UV UV sensor
Adafruit BH1750BH1750 light sensor
NanopbProtobuf encoding
PubSubClientMQTT client
ArduinoJsonJSON parsing for MQTT commands
RadioLibLoRaWAN (only needed for LoRa boards)

The Arduino IDE will also prompt you to install dependencies when you first open the firmware sketch.

Download and Flash

  1. Clone or download the firmware: github.com/wesense-earth/wesense-sensor-firmware
  2. Open wesense-sensor-firmware.ino in Arduino IDE
  3. Edit your configuration (see Firmware Configuration)
  4. Click Upload (→ button)
  5. Open Serial Monitor (115200 baud) to verify it's working

Summary Checklist

Before uploading, verify these Arduino IDE settings:

  • [ ] Board type matches your hardware
  • [ ] Partition Scheme set to Minimal SPIFFS
  • [ ] USB CDC On Boot enabled (C3/C6/S3 boards only)
  • [ ] Port selected
  • [ ] Required libraries installed
  • [ ] Configuration edited (credentials.h and wesense-sensor-firmware.ino)

All WeSense data is free and open, forever.