I am extremely new to Arduino and have searched for this on the web but have not found it.

My project has 2 files, a .ino file with the sketch and another .h file with the secrets and configuration parameters, such as reading intervals, credentials to connect to WiFi, etc.

Now I need in runtime to be able to connect to the arduino, either by serial or by any other way to be able to set these parameters.

My question is: How can I change the parameters after compiling the sketch? For example, how can I specify the credentials for the Arduino to connect to the client's WiFi, since each client has different credentials?


2 Answers 2


It is likely 2 features are desired for this project:

  1. A way to enter WIFI credentials after the program is running.
  2. A way to store the WIFI credentials between power cycles.

The solution for the 2nd requirement is to use non volatile memory. Both problems have been solved before for certain types of Arduinos. Here is a project on GitHub which has solutions for boards using the ESP8266 or ESP32 processors.


You can set parameters, like SSID and password, at run time in several ways. The two most obvious are:

  • a small dialog using the serial monitor or an other serial console;
  • a web interface served by the Arduino that lets you enter parameters.

The idea of the latter is that, when the Arduino can't connect to an available network (because it is unknown, or because it doesn't have the right credentials stored), it sets itself up as an access point with a known SSID, password, and IP address.

You can then (first) connect to the Arduino's access point WiFi network, and then open a HTML page from the Arduino in a webbrowser that lets you enter your WiFi credentials for the "real" WiFi network. This is how the WiFiManager library works (for the ESP8266 and the ESP32).

Once the credentials have been entered, you can store them (permanently) in EEPROM using the EEPROM library or, if the MCU on your Arduino doesn't have EEPROM, using a library that stores in flash, like the FlashStorage library for SAMD21-based Arduinos.

The same mechanisms can be used for other parameters you may want to set at run time.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.