EEPROM GUI development guidance

Hiya Guys,

It goes without saying I think (given my post count) that I am very much an arduino beginner. I have googled for several weeks regarding a project I would like to begin. Im positive that the information is out there (and lots of it) but I'm not sure what I should be googling for.

To get me started:
I would like my arduino uno to control several LEDS. I would like a windows based GUI that is able to change EEPROM values that would allow me to change an LED pattern as well as change the default pin state. So when the program is initiated the default status of the LEDS is determined by the EEPROM values.

For starters, I don't really know what a GUI which changes EEPROM values is called? Is is an EEPROM EDITOR?

Are there any good guides which cover similar simple projects?

I have come across JAVA SWING. It seems to be a GUI creator. Are there any other tools that would allow me to make a windows based GUI in a simple user friendly manor.

Ultimately I would like to make a more complex sketch that reads current/temperate and time information from a mosfet driver via a voltage sense resistor and shuts down the gate if the mosfet goes over temp, current or the gate is held on for too long. (I know that smart fets are available that would do this however not in the ratings I need). The drivers are potentially dual use, and I would like to be able to change the current cut off and gate time cut off.

Further, on the PCB I will have various pull up resistors which will need to be connected or disconnected due to different configurations. I really want to control these various configurations using a simple GUI.

Could any one write me a simple project tasks guide, not necessarily a how to but the different topics that I will need to research in order to achieve my goal.

Thanks very much :slight_smile:

Rob,

You write to the EEPROM while a sketch is running, I don't know of a program that can directly write the data ( it may well exist though ). You could either use a custom sketch to preset the data, or add in a one time function that will add the values if say an eeprom value is not set ( by the initial setup ).

If you like the hardware way, you could add a button to do a 'factory reset' which defaults the eeprom.

Here is some reading and a library that might help simplify access.

http://playground.arduino.cc/Code/EEPROMWriteAnything

You can create a PC GUI to control the Arduino through the serial port ( or other comms ) using processing:
www.processing.org/?

Any specific electrical questions can be directed to the General Electronics forum.
http://forum.arduino.cc/index.php?board=5.0

Thanks very much :slight_smile:

I'll start having a read.

As another example: I have a megasquirt ecu, I can change the fuel table values using the tuning program (tuner studio) these table changes get sent to the ecu.

How do these changes get made to the ecu? The software interface can read and write values to the ecu and im not sure how any of this works. Perhaps the software interface which updates the microcontroller in the ecu has a specific name that I can google for? Flash editor etc.

Sorry for the very specific example, it was the only thing I could think of whilst writing.

Rob,

Had a good read through your links, I had read the EEPROM stuff before but a refresher was helpful.

www.processing.org/? is of great help.

Any thoughts regarding how to make changes using a PC gui? Maybe if any one has read any books which discuss it they could let me know. They don't even have to be arduino based as long as they discus the theory which would allow me to better understand what to search for.

Cheers
Rob,

It's unlikely the choice of GUI will have anything whatsoever to do with the Arduino, unless you're hosting the GUI on a directly-connected display device.
Normally, you'll just have a simple serial protocol between PC and Arduino to read/write given values from/to the EEPROM, with a simple sketch on the Arduino to intepret it.

Thanks very much.

I understand what you are saying with regard to the GUI however the item is being designed to be used with the pc gui so I really wanted a bit of a design process overview.

But your explanation does help me to understand this a little better. Perhaps you have come across some good examples. I have searched and either get an overwhelming number of hits or hits which don't match what I'm looking for.

Am I correct in thinking. The GUI (PC based) will initiate serial coms with the arduino, the PC GUI will request an image of the current EEPROM, the GUI will be used to re-write the EEPROM and send it back to the arduino.

The arduino sketch upon start up will call the EEPROM for either the entire sketch of part of the sketch.

Also, as a side note. Can the EEPROM be used to give the void setup () part of the sketch or just for the main.

Cheers

Rob,

Simple way is to have your sketch read a message coming in and update the EEPROM as commanded.
Uno has 1024 bytes of EEPROM, 0x0000 to 0x03ff, so you could send in a 4 byte message:
command - 0xAA = read an address, 0xBB = write an address
upper address = address bits 0x00 to 0x03
lower address = address bits 0x00 to 0xff
data, 0x00 to 0xff - send 0x00 for a read

and let the Uno act on it:

// call out EEPROM library, declare variables, etc.
void setup(){
// declare any pinModes, Serial.begin, etc.
// You can also read the EEPROM here and make some decisions about how the program will act
}
// now the fun can start
void loop(){
if (Serial.available() >3){ // 4 bytes received?
command = Serial.read();
if ( (command == 0xAA) || (command == 0xBB) ){
int upperAddress = Serial.read();
int lowerAddress = Serial.read();
int addressTotal = (upperAddress << 8) + lowerAddress; 
// read
if ((addressTotal <=0x3ff) && (command == 0xAA)){
dataRead = EEPROM.read(addressTotal);
Serial.write (dataRead);
}
if ((addressTotal <= 0x3ff) && (command == 0xBB)){
dataWrite = Serial.read();
EEPROM.write (addressTotal, dataWrite);
}
} // end command test
} // end serial data check
// do other stuff when  there's no Serial input
} // end loop

Formatting may need some tweaking, but you can get the idea of a method from this.

Great stuff thank you Crossroads. I will read it until it makes sense.

All the best

Rob,

Hello_World_ROB:
How do these changes get made to the ecu? The software interface can read and write values to the ecu and im not sure how any of this works.

The application running on the PC and the code running inside the ECU exchange messages to send commands to the ECU and get status information back from it. If you want to configure your Arduino from the PC then you could implement something similar, using messages sent and received via the Arduino’s USB serial port. It would be up to you to define the message format and implement the code in the Arduino to receive the messages and carry out the corresponding commands. You would need to implement code in your PC application to handle the other side of the communication. I suggest you keep knowledge of the layout of the EEPROM within the Arduino and use the commands to send abstract commands to the Arduino; where the commands require the Arduino to update configuration data in EEPROM, the Arduino would know how and where that is stored. Note that the EEPROM is not very big so you won’t be able to store a lot of configuration data anyway. Also, while you’re developing and testing this capability bear in mind that each time you write to EEPROM you wear it out a little bit, and it has a finite life; make sure your code doesn’t ever write to very frequently because you could wear the EEPROM out within a few seconds.

There is another way to update the EEPROM using the bootloader, but this is probably not what you want. Here is a description of that in case you’re interested, but I’m not proposing you use this approach:

http://www.ladyada.net/learn/avr/avrdude.html