I'm a teacher, working on eliminating some difficulties of Arduino in the name of getting to the fun stuff. Namely, I am building a small Arduino powered device that will collect simple data from sensors like a DHT11, or an accelerometer. That being said, I want to pass simple settings (sample rate, sensor type, etc.) into the device with out reprogramming the board out right. I'm worried I'm over thinking the challenge. Initially, I wanted to pass the settings over serial in Python script, then save the settings to EEPROM and read them when rebooting...but sending strings over serial from Python is proving to be challenging, let alone the EEPROM.

Long term, this will run on an ESP8266 and I'd try to make a simple interface for entering the SSID and password for the Wifi network we want to connect to. Simply plug in the board over USB, run some simple little Python app that asks for SSID, password, maybe sample rate, sensor type and hit configure.

Is there an easier way to build a user interface for adjusting variables in code already running on an Arduino?

  • You could just make a library that ran everything with only the 3 parameters you describe appearing in the top level sketch.
    – BrettAM
    May 23, 2015 at 0:37

3 Answers 3


If the number of choices is limited (device types, a few selections of sample rate), you might consider a bank or two of DIP switches.

enter image description here


Take a look at firmata, which allows you to remotely set pins. There are some robotic frameworks built around it such as as Cylon.JS that are doing similar things, but you are not over thinking it. If anything probably under thinking it.

The Arduino programming environment is about as simple as it gets. It would be hard to have something easier. Perhaps some of the Graphic interfaces like those with a LEGO robotics set would be closer to what you want?

enter image description here


To avoid the serial input and hit the ground running; you could add a simple hardware input like a potentiometer, rotary encoder, or push button that cycled through settings. I would use the Arduino Serial Library to make the configuration viewable on a computer in the IDE serial monitor or terminal. As long as you pull up/down the buttons and separate the inputs properly, a push button and rotary encoder would be easy to keep modular so that it could be safely plugged in and unplugged without an issue. You could also make an interactive menu over the serial interface which asks you for each parameter. The simplest way would be to detect a button press in your application which would take you to 'config mode', which prompts the user for input via the serial monitor. Once everything is entered, save to EEPROM and restart.

If you are determined to take the Serial scripted approach for programming, and are having difficulty with Python, you could repost or update your question to include your code and explain where you are having trouble, or use a different language. I prefer C#, because I use it for so many different things (From websites to XBOX games), and it lends itself well to rapid development. Java would be another good choice particularly if you would like to integrate with Android ;). All of these are easy to integrate with a GUI.

It sounds like you are having difficulty dealing with strings - and don't feel bad about this, strings can be a complex thing because of how they are construed and work. Check out some examples, and re-implement them to suit your application. Try breaking your strings up into characters (which are a byte in size, easy to fit in EEPROM!) and send them byte by byte - this might be simpler.

Saving to EEPROM is trivial and well covered in the Arduino documentation. One thing to keep in mind is that the EEPROM is accessed and used in bytes! What does this mean? - Well, if a larger variable is to be stored, like an int (16 bit on Arduino Uno) it must first be split in half. To do this you would use bit shifting. To give you a quick idea on how this is done, see functions below - note this assumes you only ever save integers to EEPROM (this is in the way I choose to address the memory):

// Include EEPROM library
#include <EEPROM.h>

// location is an int from 0-511 using Arduino Uno with 1KB of EEPROM
void SaveValue(unsigned int location, unsigned int value)
    // Find addresses to store each half of the integer
    unsigned int saveLocationLower = location * 2;
    unsigned int saveLocationUpper = saveLocationLower + 1;

    // Split the integer into two parts
    byte lowerValue = value;
    byte upperValue = (value >> 8);

    // Save both parts
    EEPROM.write(saveLocationLower, lowerValue);
    EEPROM.write(saveLocationUpper, upperValue);

int LoadValue(unsigned int location) 
    // Find both locations to read using same method as above
    unsigned int saveLocationLower = location * 2;
    unsigned int saveLocationUpper = saveLocationLower + 1;

    // Read both locations
    byte lowerValue = EEPROM.read(saveLocationLower);
    byte upperValue = EEPROM.read(saveLocationUpper);

    // Assemble both halves and return value
    return lowerValue + (upperValue << 8);

If you are feeling really outgoing and adventurous, and have good luck with the C# route - you could check out Microsoft's latest Arduino offerings - they are pretty cool. It makes it easy to integrate Arduino devices with Windows 10 and Phone apps.

  • Windows 10 IoT for Arduino uses ... drum roll please ... firmata :)
    – user6569
    May 23, 2015 at 2:59

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.