I'm literally as green of a noob as I can be at this moment. Been watching a ton of tuts as I plan my project, but can't seem to find anything about settings being uploaded from an external source, and then stored on the arduino.

I want to create a board with multiple buttons. I want these buttons to then transmit MIDI PC/CC based on customizable settings uploaded via a computer. So, I'll create an app that can "create" the settings (json?) for each button. Ideally, I'd just connect the board, create the settings, then upload it to the device.

I've been reading about storing things like this in EEPROM, but that has a limited life span (which scares me). So, do I store these variables in EEPROM, or do I just compile and upload the app that has the new values in the variables?

I'm just looking for a possible direction and links for research.

Thanks in advance.

  • interesting project .... perhaps you can store the settings in a file on an SD card
    – jsotola
    Commented Apr 24, 2019 at 20:40
  • Re “or do I just compile and upload the app”: that would store the settings with the app, in the flash memory, which has a shorter life span than the EEPROM. Commented Apr 25, 2019 at 9:36
  • wow!? a downvote for wanting guidance?
    – TSNev
    Commented Apr 25, 2019 at 13:12
  • arduino.stackexchange.com/tour
    – Juraj
    Commented Apr 25, 2019 at 14:13

1 Answer 1


Your question is quite broad, so I will give you some directions for the different parts.

  1. Communication with the PC to receive settings: For the Arduino Uno you are basically left with the Serial (UART) interface to communicate with the PC. For wired communication you can simply use the USB port. On your PC you need a program to send the settings over the serial com port to the Arduino. You can either use any serial terminal program or you can write your own. That depends on your needs. On the Arduino you need code to parse the serial communication to get the settings. It seems, that your can be rather complex (not just simple numbers of the same type). So you should implement a basic message protocol. It is common to use the newline character (\n) as the delimiter at the end of a message. In your code you read the serial data into a buffer, until you read a newline character. Then you start to process the message in a whole. You can see the implementation of this protocol in the SerialEvent example that comes with the Arduino IDE. Then you can use JSON as text based data format to transmit it to the Arduino. There you can use the Arduino JSON library to decode the data and get the settings. If you don't want to use JSON, you can also use a simpler protocol.

  2. Saving the received settings: Without any further hardware the EEPROM is the way to go. The "life span", that you mention, are the possible number of write cycles, until a cell is not longer garanteed to work correctly. Read cycles don't do any harm here. Atmel gives a number of 100.000 write cycles, but notice, that this is the minimum garanteed number. (Have a look at this question for further info) Do you really change the settings this often? Make a short calculation like this: Imagine that you want to change the settings 10 times a day on every day in the year. Even then you get about 27 years with the EEPROM write cycles, far enough for other components to break. But if you really want to go safe here, you can use wear leveling. With this technique you rotate through different EEPROM cells to save your settings. You use more space in EEPROM, but each individual cell will get only a fraction of the write load. There are even libraries ready to use for this. A quick google search gave me the EEPROMWearLevel library, though I haven't used it myself. Depending on the total size of your settings, you might get a life span multiple times bigger with this. If you still don't want to use EEPROM, you can do as jsotola wrote in his comment: You can by a SD card module for Arduino and a fitting SD card and save the data there. This will lead to more programming overhead, especially, if you want to use a file system to also be able to read and write the SD card on the PC. (Note: The storage chips in SD cards have the same problem with limited write cycles, so they have the wear leveling incorporated into the hardware of the card)

You might as well decide, that you don't need the settings to be persistent between resets. Then you can just use variables and fill them with the settings from the Serial interface code.

You yourself have to decide, what the best way to go is here.

  • Thank you for taking the time to answer my questions. I appreciate it.
    – TSNev
    Commented Apr 25, 2019 at 18:48
  • If you consider my answer as correct/fitting, please accept it as correct :)
    – chrisl
    Commented Apr 25, 2019 at 18:55
  • I think I'm going to go the route of saving to the EEPROM. Here goes nothing...
    – TSNev
    Commented Apr 25, 2019 at 20:09

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