How to Use W25Q128JVSIQ with ESP32 and Arduino for Data Logging

Gpin 375 May 30, 2025 May 30, 2025

The W25Q128JVSIQ from Winbond is a 128Mbit SPI NOR flash memory chip ideal for embedded storage. When paired with an ESP32 microcontroller using the Arduino IDE, it provides a low-cost, high-capacity solution for applications like sensor data logging, offline storage, and OTA buffering.

Why Use External SPI Flash?

Although the ESP32 has internal flash, it's limited in capacity and used for the file system and firmware. External flash like the W25Q128JVSIQ offers:

  • Dedicated data logging space (16MBit = 16MB)
  • Non-volatile memory for offline storage
  • SPI interface allows fast, low-pin communication
  • Flexibility for OTA, logs, or large assets

Wiring Diagram

Connect W25Q128JVSIQ to ESP32 using the SPI interface:

  • CS → GPIO5
  • CLK → GPIO18
  • MOSI → GPIO23
  • MISO → GPIO19
  • VCC → 3.3V
  • GND → GND

Required Libraries

Example Code

Below is a basic example using SPIMemory to write and read data:

#include 

SPIFlash flash(5); // CS on GPIO5

void setup() {
  Serial.begin(115200);
  if (flash.begin()) {
    Serial.println("Flash memory initialized");
  } else {
    Serial.println("Flash memory init failed");
    while (1);
  }

  // Write string to memory
  flash.eraseSector(0);
  flash.writeStr(0, "ESP32 data logging test");
}

void loop() {
  String data = flash.readStr(0);
  Serial.println("Read: "   data);
  delay(3000);
}

Applications

  • Sensor data logging in remote environments
  • Firmware and OTA update buffering
  • Audio or image storage for ML/AI projects
  • Offline event or debug logging

FAQ

Q1: Can I use other SPI pins on ESP32?

Yes, ESP32 supports SPI on many GPIOs, but GPIO5/18/19/23 are the most commonly used hardware SPI pins.

Q2: How do I erase the flash?

Use flash.eraseSector(address) to erase 4KB sectors. You must erase before overwriting.

Q3: Is the W25Q128JVSIQ compatible with Quad-SPI?

Yes, but most Arduino libraries use standard SPI mode. QSPI access may require advanced drivers or ESP-IDF.

Conclusion

The W25Q128JVSIQ is a reliable choice for adding external flash to your ESP32 projects. With Arduino IDE and libraries like SPIMemory, you can easily integrate high-capacity, non-volatile storage for data logging and more. For robust applications like remote sensing or OTA buffering, this chip expands your ESP32's potential significantly.

Image Part No Manufacturer Description Inventory Pricing Quantity RoHS Package
W25Q128JVSIQ

Mfr Part No.

W25Q128JVSIQ

Internal Code

Winbond Electronics IC FLASH 128MBIT SPI/QUAD 8SOIC
45958 Available
  • 1 : $1.1704
  • 10 : $1.064
  • 100 : $0.97614
  • 500 : $0.90384
  • 1000 : $0.84471
  • 3000 : $0.7969
Unit Price: $1.1704
8-SOIC (0.209", 5.30mm Width)
W25Q128JVSIQ
W25Q128JVSIQ

Winbond Electronics
RoHS :
Package: 8-SOIC (0.209", 5.30mm Width)
Inventory: 45958
1 : $1.1704
Share