Articles Hierarchy

Articles Home » RPI » RPI operates ARDUINO PID control

RPI operates ARDUINO PID control

here i try a little bit faster menu

that is not much better
i need to redesign that communication
arduino should learn how to read a CSV line, for set setpoints or set tuning.
i go back to the menu program ( and pls find there V2.4 )
and make a CSV line split ( to a array ( long 11 here ))
and modify the read number tool so it gives back
-1 for empty string or other problems
0 for text string
1 for integer string
2 for float string
there is a ( uncommented ) example for this menu [C] in the download

now i use this to modify PID_google04 arduino project.

as there is still space in arduino
i want try the PID tuning by variables again
even that's only temporary, ( i not again want use EEPROM... )
final setting are still to be set in arduino code.
the tuning and the initial setting for MODE MOUT / RSP.
the arduino should run as standalone PID module, RPI or USB menu terminal only optional.

menu "T" for tuning
PV fil0 addold:PVfil0,0.02
PV fil1 mul:PVfil1,0.98
PID_action -1/1:PID_action,-1
PID_outdir -1/1:PID_outdir,1

menu "t" for show tuning

now, when the RPI is connected, these "T" should not sending anything back
and the "t" will show
PID,0.02,0.98,0.20,0.03,0.00,-1,1,, one CSV line only.
pls adjust //#define manualoperation for this

now i have to think how to deal in arduinostream with that possibilities.
first i wanted to do 2 new files, tuning from arduino and tuning to arduino
but if i use the existing 2 files i must identify the line ( JOB ) by a keyword
so ,pv,sp,output,mode for indication already have the "PCT" word,
for sending RSP, MOUT, MODE i can use also.

for tuning i can use the word "PID" and the longer variable list.
but a tuning display need not only the the new setpoints for the tuning, it needs to show also the actual settings.
menu [t] is for this, but the operation program have to tell the service program first to send this [t],
by putting a ",PID?," in the command file. service then sends the menu key "t" and asynchron ( no wait ) the ",PID," tuning answer will come and put it to the "fromarduino" file.
and in operation that "PID" line is detected and as actual tuning shown in a new window.
so that window will show AFTER arduino answered with the latest tuning and will close after [send] operation. ( that send button in the tuning window i could not make as a image button?? )
so for a new tuning step whole procedure again. press [PID] button, send "t", get "PID", show window

and when i am already about to change the record structure
i will now start all records with a DBI number ( a unique identification number for a loop on the highway )
in this case its ",1,"
,1,PCT,46.03,28.93,0.00,2, menu[t]

so the PID line looks same:
after [t] from arduino, stored in "fromarduino.csv" file and read by operation to show actual tuning
and after tuning stored from operation in "toarduino.csv" file
and send as that string to arduino by service after using menu key [T]

later for the big job, my uPCS, running only in a arduino DUE, there is that "DBI" data base index prepared, with 2 PID, 2 IND, 2 DCD loop point (types).

here it works:

with current trend window

and the logfile, as it is recording each line arduino sends its growing fast and fills up RAMdisk.

pls download this rev as

in case you stop the stream ( by the desktop tool .. )
and try to test / run it from the IDLE there will be a file error.
the 2 files in RAMdisk are owned by root, if you start the service again as pi the files can not be overwritten.
please delete them from terminal
sudo rm /run/shm/* and try start IDLE again
restarting the service is no problem.