User editable look up table

This is an application where the MCU has to control a DAC to output varying voltage levels based on a look up table. I am planning to use a MCU with on board DAC like the Teensy3.2 or similar. ( The pattern is very random and hence cannot be made into a transfer function … easier is the look up table )

The total duration is 2 sec and this is divided into 200 nos of 10ms intervals. All the MCU has to do is to wait for a start command and then when it arrives, step through this look up table and update the DAC accordingly.

Now up to this it is a simple application. The problem starts when the user wants to modify the look up table. If it was a small LUT with few values I would have given a LCD interface to step through it.

Of course easy way is to directly edit the values in the code and do a download. But expecting a user to do this is a bit awkward to say the least. But I can always create a PC app ( in LabVIEW or C ) for editing the array and then link with the MCU via Serial.

Some how I am not able to visualize how to go about this further. Any ideas welcome. Thanks

Why would the human want to change the lookup table?

How does the human create the first version of the lookup table?

Will the human be changing the lookup table while the device is running?

Because the human will want the same code to run on different versions of the same machine.

Based on the requirement given to the human.

The human will not change the LUT when the device is running.

I assume from the reasonable command of English and the painfully terse answers that you be believe my questions lack merit. I won't waste any more of my time or yours. Good luck.

There was no such intention at all.

In fact I wondered if there was a hint of sarcasm by the repeated use of human in the questions. But even then I was keen to answer all questions raised by you.

I am very sorry if my response sounded otherwise.

The joy of written communication and interpretation of intent - always hard one.

Would you consider reading the LUT from an SD card? it’s easy for “humans” to create a table and save it in a tabulated file under a CSV format for example.
Usage would be:

  • turn device off
  • eject SD card
  • update LUT
  • insert SD card back
  • Boot up Arduino

In the setup() you read the LUT from SD card to dynamically build your transfer function

===

Alternative:

use a serial/web (if you take a WiFi arduino) custom interface and command language to update the data. Store the LUT in EEPROM to survive reboots

Command language would typically support:

  • List all table
  • update entry #N
  • delete entry #N
  • insert entry #N
  • bulk upload (delete and replace)

===

Of course with a rotary encoder with push button and LCD you can also interact with the data. No bulk option there but if modification are sparse, why not

Mogaraghu:
Of course easy way is to directly edit the values in the code and do a download. But expecting a user to do this is a bit awkward to say the least. But I can always create a PC app ( in LabVIEW or C ) for editing the array and then link with the MCU via Serial.

Some how I am not able to visualize how to go about this further.

The concept in the first paragraph I have quoted seems sensible and practical. But based on the last line I have no idea what you want help with.

Do want advice about how to create a PC App? If so, this is not the proper Forum.

Based on the little you have told us I think I would make a GUI that has sliders to represent the values in LUT so that the user can just push and pull to get the shape s/he wants - like the things you see for varying the amplitude at different frequencies for a music player.

I don't know anything about Labview and I suspect building a GUI in C would be tedious. Many Arduino users use Processing for the PC end of things. I make my GUIs with HTML, javascript and CSS and the Python Bottle web framework

...R

@J-M-L

Excellent brain storming. Thanks. Yes the CSV file … some how this was the one I was after but could not bring it up. Of course a SD card would be a overkill for storing about 200 odd three digit values. Since the Vcc will be3.3V , its enough if I provide for 000 to 300 mV as the possible range of variations. For this a suitable EEPORM would suffice.

I guess I will have to provide for a interactive mode, that can be invoked maybe when a serial app connects to the MCU and the MCU will dump the existing array data over the serial for the user to edit. Once done the whole new array can be written back to the EEPROM.

Since I program machine code in LabVIEW, providing this interface over Serial is easy.

@Robin

Sorry if my original post was brief. But then this is a requirement to profile the voltage command of a Hydraulic Proportional amplifier, that eventually controlled the current drive to a solenoid coil. The end application is a auto transmission control setup. Once the command to shift gears is given two such units swing into action - the first one is the gear that is engaged which needs to disengaged after the clutch is released and the second one is the selected gear which needs to engage. And all this happens in about 1550ms with precise control on the shift cylinder pressure. Idea is to complete the shifting with minimum or no jerks in between.

I was from beginning thinking on lines of the Over the Air firmware update like the ESP8266 does. Once instructed the code replaces the active portion by itself. Anyway I think that is a bit far fetched for this requirement.

OK - yes a Serial command line interface is "easy" enough to implement and storing in EEPROM (if you don't update thousands time a day) or SPIFFS easy as well

J-M-L:
OK - yes a Serial command line interface is "easy" enough to implement and storing in EEPROM (if you don't update thousands time a day) or SPIFFS easy as well

Of course it pays to keep the EEPROM Write cycles in control. As I said there exists a basic profile and depending on the type of machine there is slight variation to this profile. Maybe during the initial try out phases the number of Writes will be about max 50 and once proved the profile will be saved for that machine. So this is not an issue.

Mogaraghu:
Of course it pays to keep the EEPROM Write cycles in control. As I said there exists a basic profile and depending on the type of machine there is slight variation to this profile. Maybe during the initial try out phases the number of Writes will be about max 50 and once proved the profile will be saved for that machine. So this is not an issue.

yeah 50 is very safe on a new board :slight_smile:

Mogaraghu:
Sorry if my original post was brief. But then this is a requirement to profile the voltage command of a Hydraulic Proportional amplifier, that eventually controlled the current drive to a solenoid coil. The end application is a auto transmission control setup. Once the command to shift gears is given two such units swing into action - the first one is the gear that is engaged which needs to disengaged after the clutch is released and the second one is the selected gear which needs to engage. And all this happens in about 1550ms with precise control on the shift cylinder pressure. Idea is to complete the shifting with minimum or no jerks in between.

I was from beginning thinking on lines of the Over the Air firmware update like the ESP8266 does. Once instructed the code replaces the active portion by itself. Anyway I think that is a bit far fetched for this requirement.

I still can't get a mental picture of what you want help with.

If all you want is to be able to replace one set of data with another set that is sent from a PC then some code to receive the new data and store it in EEPROM memory should be sufficient. You could do that with any Arduino.

I thought you were looking for advice for a convenient means for a user with a PC to generate the new set of data.

...R

If I understood correctly :

  • OP wants to have only one binary code which embeds in an array "default" values for the transfer function.

  • This code will be uploaded to various Arduinos to drive an external system. Each system might be a bit different so might require some fine tuning of the transfer function.

--> OP wants to be able to offer an interface so that the operator of the system can perform the fine-tuning of the transfer function without having to recompile the source code and re-upload

just a guess

J-M-L:
→ OP wants to be able to offer an interface so that the operator of the system can perform the fine-tuning of the transfer function without having to recompile the source code and re-upload

just a guess

I have got that bit of the picture.

What I am unclear about is how the OP expects the operator to interact with the system. Originally I thought he wanted to create a PC based GUI that would allow the operator to create or modify a transfer function and then send it to an Arduino or embed it in new version of the program to be uploaded to the Arduino. With Reply #7 I got the sense that all the operator needed to do is send (or embed) a selected transfer function (wherever it might come from). All of which are possible.

…R

Indeed - unclear

Mogaraghu:
And all this happens in about 1550ms with precise control on the shift cylinder pressure.

That sounds like an extremely long shift.

I'm pretty sure that I'm well under a second even double-clutching a vintage Cadillac (without rushing) , and a fraction of second on a modern transmission. And automatics shift faster than humans.

dochawk:
That sounds like an extremely long shift.

I’m pretty sure that I’m well under a second even double-clutching a vintage Cadillac (without rushing) , and a fraction of second on a modern transmission. And automatics shift faster than humans.

Yes it is pretty long by normal standards. As its a massive off the road wheel loader.

I guess I have got the idea to proceed on this.

This is an intensive hydraulic control subject and the MCU has just a very small role to play - namely profile a voltage within about 2 second. And I must provide a easy means to alter the profile to fine tune. That's it.

I can understand all of your keenness to understand the full subject and help out, but then me trying to explain the whole thing will take the focus away from the specific clarification I wanted. That was my worry and maybe I am 100% wrong in that.

Sincere thanks to all those who helped out !!

Take a look at spline/quadratic/whatever functions that can likely track such a function with two to four variables . . .

hawk

But I can always create a PC app ( in LabVIEW or C ) for editing the array and then link with the MCU via Serial.

The Teensy has gobs of memory for a RAM-based look-up of ~600 bytes. If you want these changes to be "sticky" (available on the next boot/reset) I'd use an external I2C flash to hold the pattern and have a default in the Teensy flash. On boot:

  • check the external flash; if valid, load the table into RAM
  • if the external flash is invalid, load the internal default

Include some serial functionality to allow download from a PC to program the external flash.

If you don't need the changes to be sticky, omit the flash and load the default each boot while still allowing serial updates.

Doesn't seem terribly complicated but maybe I'm missing something.