Page 1 of 1

ESP32 Configuration File

Posted: Tue Jun 25, 2019 11:29 pm
by tomcat2900
Can you tell me if it is possible to store a configuration file (text file) on a ESP32 module using Arduino IDE?
In this file I want to write custom data such as WIFI SSID, WIFI FIXED IP,WIFI PASSWORD.
And in every code I will write for the module, I will write a function to read the data from the configuration file.
Thank You !

Re: ESP32 Configuration File

Posted: Wed Jun 26, 2019 9:11 am
by rodmcm
You may be able to do this through storage to the onboard EEPROM.. Search programs to asses this

Re: ESP32 Configuration File

Posted: Thu Jul 18, 2019 1:34 pm
by muller59
you can do that thru SPIFFS

Code: Select all

if (!SPIFFS.begin(true)) {        
  Serial.println("ERROR: Failed to mount file system");

//* saveConfig - save WiFi parameters to config.txt in SPIFFS

bool saveConfig() {
  // Open config file for writing.
  Serial.println("saveConfig starts");

  File configFile ="/config.txt", FILE_MODE_W);
  if (!configFile) {
    Serial.println("Failed to open config.txt for writing");
    return false;

  // Save data.

  return true;

have fun

Re: ESP32 Configuration File

Posted: Mon Jul 22, 2019 3:24 pm
by lbernstone
For configuration parameters, it is usually more appropriate to use the nvs keystore. That way you won't need to open and parse the whole file every time you need to read or modify a parameter. It is implemented in arduino as the Preferences library ... ferences.h