Datenlogger auf TXT SD-Karte

Alles rund um TX(T) und RoboPro, mit ft-Hard- und Software
Computing using original ft hard- and software
Forumsregeln
Bitte beachte die Forumsregeln!
chehr
Beiträge: 177
Registriert: 07 Apr 2015, 21:07
Wohnort: Friedrichshafen

Re: Datenlogger auf TXT SD-Karte

Beitrag von chehr » 21 Feb 2021, 11:02

hier ein kleiner update:
Neues Feature in ROBOPro:
- TXT Supply Voltage kann in ROBOPro angezeigt werden
ROBOPro Oszillograph von TXT Supply Voltage
ROBOPro Oszillograph von TXT Supply Voltage
TXTSupplyVoltage.png (62.99 KiB) 895 mal betrachtet
oder (nicht und!) die TXT Spannung in [V] kann auf die SD-Karte geschrieben werden mit einer Datenrate die von ROROPro eingestellt werden kann.
Es war möglich eine Samplingrate bis max 58,8kHz zu erreichen, jedoch nicht stabil.
Empfohlen für die "TXT Spannung" ist max 1 kHz einzustellen.

Das Aufzeichnungsformat ist nun so geändert mit Trennzeichen ";", so dass es in Excel einfacher importiert werden kann:

Code: Alles auswählen

Thread id; Date; Time [us]; Elapsed time [us];  RoboPro floating value; 
1428; 21-02-2021; 09:14:02.546377; 9925; 10.248; 
1428; 21-02-2021; 09:14:02.556319; 9942; 10.3119; 
1428; 21-02-2021; 09:14:02.566274; 9955; 10.3002; 
1428; 21-02-2021; 09:14:02.576724; 10450; 10.3083; 
1428; 21-02-2021; 09:14:02.586670; 9945; 10.3245; 
1428; 21-02-2021; 09:14:02.596623; 9953; 10.3164; 
1428; 21-02-2021; 09:14:02.606569; 9945; 10.3164; 
1428; 21-02-2021; 09:14:02.616510; 9941; 10.3281; 
1428; 21-02-2021; 09:14:02.626450; 9939; 10.3362; 
1428; 21-02-2021; 09:14:02.636832; 10382; 10.3362; 
1428; 21-02-2021; 09:14:02.646777; 9944; 10.356; 
1428; 21-02-2021; 09:14:02.656709; 9931; 10.356; 
1428; 21-02-2021; 09:14:02.666763; 10054; 10.3164; 
1428; 21-02-2021; 09:14:02.676694; 9930; 10.3281; 
1428; 21-02-2021; 09:14:02.686619; 9925; 10.32; 
1428; 21-02-2021; 09:14:02.696574; 9954; 10.3317; 
1428; 21-02-2021; 09:14:02.706501; 9927; 10.3317; 
1428; 21-02-2021; 09:14:02.716454; 9953; 10.3317; 
1428; 21-02-2021; 09:14:02.726348; 9893; 10.3317; 
1428; 21-02-2021; 09:14:02.736283; 9935; 10.3398; 
1428; 21-02-2021; 09:14:02.746210; 9926; 10.3398; 
1428; 21-02-2021; 09:14:02.756156; 9945; 10.3317; 
Wie man sieht ist die Sampling rate hier im Beispiel nich ganz stabil bei 100Hz, aber ganz ok. Für den TXT 4.0 erhoffe ich mir eine Verbesserung.

Video auf SD-Karte zu schreiben ist noch nicht implementiert.

der Quellcode ist hier:
https://github.com/chehr/TxtSliSDlogger

chrichr
Beiträge: 4
Registriert: 18 Feb 2021, 12:19

Re: Datenlogger auf TXT SD-Karte

Beitrag von chrichr » 24 Mär 2021, 11:30

This is very impressive! It seems similar to what I am trying to accomplish but in a more sophisticated way! I am not sure how to use the TxtSliSDlogger library. Any help would be very much appreciated! I have trouble figuring out how to use it. First, should I copy only the "libTxtSliSDlogger.so" library to the TXT path "/opt/knobloch/libs"? Second, how do I change the SD card permissions on Windows? In Github shows the terminal command for Linux, which I don't have access to.

Now, I should explain what I would like to accomplish! I want the TXT Discovery truck and the TXT Gripper Robots (vacuum and 3-axis) to create a log entry on their SD cards (with timestamp and a distinctive word instead of any measured values) every time they execute particular tasks. For example, when the truck stops as programmed, I would like it to create a log entry dd-mm-yyy; hh:mm:ss; STOP; and a similar when it starts moving again. The distinctive word should change according to the task on different TXT controllers. At the moment, I have created the programs for each individual piece (truck, cranes) but I need to add the logging functionality.

I checked both TxtSliSDlogger.rpp example programs from Github https://github.com/chehr/TxtSliSDlogger but I don't understand how to install the library and modify the example to perform what I described. Any recommendations?

Best,
Christos

chehr hat geschrieben:
21 Feb 2021, 11:02
hier ein kleiner update:
Neues Feature in ROBOPro:
- TXT Supply Voltage kann in ROBOPro angezeigt werden
TXTSupplyVoltage.png
oder (nicht und!) die TXT Spannung in [V] kann auf die SD-Karte geschrieben werden mit einer Datenrate die von ROROPro eingestellt werden kann.
Es war möglich eine Samplingrate bis max 58,8kHz zu erreichen, jedoch nicht stabil.
Empfohlen für die "TXT Spannung" ist max 1 kHz einzustellen.

Das Aufzeichnungsformat ist nun so geändert mit Trennzeichen ";", so dass es in Excel einfacher importiert werden kann:

Code: Alles auswählen

Thread id; Date; Time [us]; Elapsed time [us];  RoboPro floating value; 
1428; 21-02-2021; 09:14:02.546377; 9925; 10.248; 
1428; 21-02-2021; 09:14:02.556319; 9942; 10.3119; 
1428; 21-02-2021; 09:14:02.566274; 9955; 10.3002; 
1428; 21-02-2021; 09:14:02.576724; 10450; 10.3083; 
1428; 21-02-2021; 09:14:02.586670; 9945; 10.3245; 
1428; 21-02-2021; 09:14:02.596623; 9953; 10.3164; 
1428; 21-02-2021; 09:14:02.606569; 9945; 10.3164; 
1428; 21-02-2021; 09:14:02.616510; 9941; 10.3281; 
1428; 21-02-2021; 09:14:02.626450; 9939; 10.3362; 
1428; 21-02-2021; 09:14:02.636832; 10382; 10.3362; 
1428; 21-02-2021; 09:14:02.646777; 9944; 10.356; 
1428; 21-02-2021; 09:14:02.656709; 9931; 10.356; 
1428; 21-02-2021; 09:14:02.666763; 10054; 10.3164; 
1428; 21-02-2021; 09:14:02.676694; 9930; 10.3281; 
1428; 21-02-2021; 09:14:02.686619; 9925; 10.32; 
1428; 21-02-2021; 09:14:02.696574; 9954; 10.3317; 
1428; 21-02-2021; 09:14:02.706501; 9927; 10.3317; 
1428; 21-02-2021; 09:14:02.716454; 9953; 10.3317; 
1428; 21-02-2021; 09:14:02.726348; 9893; 10.3317; 
1428; 21-02-2021; 09:14:02.736283; 9935; 10.3398; 
1428; 21-02-2021; 09:14:02.746210; 9926; 10.3398; 
1428; 21-02-2021; 09:14:02.756156; 9945; 10.3317; 
Wie man sieht ist die Sampling rate hier im Beispiel nich ganz stabil bei 100Hz, aber ganz ok. Für den TXT 4.0 erhoffe ich mir eine Verbesserung.

Video auf SD-Karte zu schreiben ist noch nicht implementiert.

der Quellcode ist hier:
https://github.com/chehr/TxtSliSDlogger

chehr
Beiträge: 177
Registriert: 07 Apr 2015, 21:07
Wohnort: Friedrichshafen

Re: Datenlogger auf TXT SD-Karte

Beitrag von chehr » 24 Mär 2021, 20:51

Dear Christos,
your Idea is interesting and feasible.
For that you should know that ROBOPro can transfer via SLI either Integer or Floating value but not a string.
In accordance with your explanation I would propose to use the Integer, means the Subprogram "INT16->SD-save" in ROBOPro.
Finally in C++ you can then store a pre-defined string on the SD--Card with the timestamp after receiving from ROPOPro a dedicated INT16 number.

But first of all you need to perform following two steps:
Copy the library to the TXT with i.e. FileZilla.
A good explanation is given by Carel in Step 3 on following link:
https://github.com/fischertechnik/txt_d ... YouNeed.md

The next step is to give the permission to ROPOPro user for read/write access to the SD-Card:
Start PuTTy and create a new SSH-session with the general user ROBOPro. The user name: ROBOPro, the password: ROBOPro
The following link gives the explanation how to get Administrator rights on the TXT:
https://www.fischertechnik.de/-/media/f ... 43_en.ashx

Code: Alles auswählen

chown -cR ROBOPro:ROBOPro /opt/knobloch/ExternalSD/
After this two steps, the most demanding part is now outstanding:
Installation of the C++ Toolchain on the PC with Eclipse IDE for C/C++ and gcc-linaro-7.2.1-2017.11-i686-mingw32_arm-linux-gnueabihf.
Again the first link in this post gives a good explanation of this task.

When all is running and you are testing your own TXT library the remote console via PuTTy (screen -r) is very useful for testing and debugging.

Have fun
Regards
Christian

chrichr
Beiträge: 4
Registriert: 18 Feb 2021, 12:19

Re: Datenlogger auf TXT SD-Karte

Beitrag von chrichr » 25 Mär 2021, 13:47

Dear Christian,

Thank you for your detailed reply! I think I might have sent a DM to you twice. I am sorry about that.

I have now successfully copied the library in TXT (with PuTTY and FileZilla) and I can use your .rpp to store values in the SD card!

I ran your program and experimented a bit with different inputs from TXT (NTC, ultrasonic distance sensor) and was able to save their measured values! I tried though to change the sample rate to 1 measurement per second (I don't really need 100 samples per second, maybe a few) but I was not successful. Specifically, I added a subprogram SampleRate [Hz] as shown in the example .rpp and changed its input value to 1. I also changed the .cpp file (in src local folder) so the "SamplingRate" variable has a value of 1 ("static short SamplingRate=1;") but both attempts failed.

I have very limited knowledge in programming and I find it difficult to comprehend the procedure to create my own library. Do you think it is feasible to use Integer values instead of Strings for different events? For example, instead of "stop" it could save "1", "start -> 2", "obstacle -> 3" and so forth.
Maybe in that way, I can avoid programming which would take long to learn and do it correctly.

If the above alternative is feasible, how could I use the SD card saving program and implement it in another .rpp program I have created? Is it as simple as creating the subprograms and the required blocks in the Main program? Sorry for the stupid questions.

chehr
Beiträge: 177
Registriert: 07 Apr 2015, 21:07
Wohnort: Friedrichshafen

Re: Datenlogger auf TXT SD-Karte

Beitrag von chehr » 28 Mär 2021, 21:46

I have now successfully copied the library in TXT (with PuTTY and FileZilla) and I can use your .rpp to store values in the SD card!
Very good to know that it is working. Did you changed the permission via Admin?
I ran your program and experimented a bit with different inputs from TXT (NTC, ultrasonic distance sensor) and was able to save their measured values! I tried though to change the sample rate to 1 measurement per second (I don't really need 100 samples per second, maybe a few) but I was not successful. Specifically, I added a subprogram SampleRate [Hz] as shown in the example .rpp and changed its input value to 1. I also changed the .cpp file (in src local folder) so the "SamplingRate" variable has a value of 1 ("static short SamplingRate=1;") but both attempts failed.
This is as expected. Since with the ROBOPro SP "INT16->SD-save" or "FP48->SD-save" the sampling rate is defined in ROBOPro, means in each loop of this modul one value will be transfered to SD Card. The reason is that the loop is done via ROBOPro and not in the C++ and therefore the sampling rate is limited by ROBOPro speed, usually approx lower than 1-10 ms depends how many parallel tasks are running, in case no time delay is included in ROBOPro.

With the SP "SupplyV->SD [V]", the loop is in outside of ROBOPro and much quicker, without any time delay the SD-Card would be quickly full (also 16 GB and more), therefore it is required to define the sampling rate.

In your application you can use a time delay symbol in ROBOPro to define any sampling rate, eg 1s for 1 Hz, or just run once this SP for one value.
I have very limited knowledge in programming ....

Similar for me...
Do you think it is feasible to use Integer values instead of Strings for different events? For example, instead of "stop" it could save "1", "start -> 2", "obstacle -> 3" and so forth.
Yes

If the above alternative is feasible, how could I use the SD card saving program and implement it in another .rpp program I have created? Is it as simple as creating the subprograms and the required blocks in the Main program? Sorry for the stupid questions.
Just copy the SP "SubProgramms" per copy /paste.
- InitSpdlLog (run ones for init)
- init (run ones for init)
- INT16->SD-save (run each time when you want to save a value to SD-Card, the input value is i.e. 0,1,2,3,4....)

chrichr
Beiträge: 4
Registriert: 18 Feb 2021, 12:19

Re: Datenlogger auf TXT SD-Karte

Beitrag von chrichr » 29 Mär 2021, 12:27

Very good to know that it is working. Did you changed the permission via Admin?
Thanks for that! I used PuTTY to access TXT as ROBOPro, changed the root password and then access it as root. I ran the command "chown -cR ROBOPro:ROBOPro /opt/knobloch/ExternalSD/" and used Filezilla to copy the library file in the specified folder, namely "/opt/knobloch/libs".
This is as expected. Since with the ROBOPro SP "INT16->SD-save" or "FP48->SD-save" the sampling rate is defined in ROBOPro, means in each loop of this modul one value will be transfered to SD Card. The reason is that the loop is done via ROBOPro and not in the C++ and therefore the sampling rate is limited by ROBOPro speed, usually approx lower than 1-10 ms depends how many parallel tasks are running, in case no time delay is included in ROBOPro.

With the SP "SupplyV->SD [V]", the loop is in outside of ROBOPro and much quicker, without any time delay the SD-Card would be quickly full (also 16 GB and more), therefore it is required to define the sampling rate.

In your application you can use a time delay symbol in ROBOPro to define any sampling rate, eg 1s for 1 Hz, or just run once this SP for one value.
I would prefer to run the SP once, only when an input value is to be saved. Can I disregard the SP "sampling_rate [Hz]" then?
Just copy the SP "SubProgramms" per copy /paste.
- InitSpdlLog (run ones for init)
- init (run ones for init)
- INT16->SD-save (run each time when you want to save a value to SD-Card, the input value is i.e. 0,1,2,3,4....)
My .rpp structure is as follows. At some point in the Main program, a SP runs ("Subprogram 1") which saves the value to the SD card in the beginning (value=1) and at the end of it (value=2).
https://prnt.sc/10ywpvr
However, I cannot make it work. It doesn't save "1" or "2" but instead it saves something like that
1447; 29-03-2021; 11:06:01.384773; 160021742; flush ;
What I am doing wrong?

chehr
Beiträge: 177
Registriert: 07 Apr 2015, 21:07
Wohnort: Friedrichshafen

Re: Datenlogger auf TXT SD-Karte

Beitrag von chehr » 30 Mär 2021, 20:28

I found the reason of your problem in the ROBOPro, as the sampling time is above 5s and therefore the ROBOPro "5s" bug stops the Programm.
I included in the library the "StayAwake" function as workaround and updated ROBOPRo accordingly. I corrected also some other small issues.
ROBOPro example update
ROBOPro example update
ROBOPro SD-Karte update.png (160.19 KiB) 542 mal betrachtet
Setting corrected:
UP Setting updated
UP Setting updated
UP-Settings.png (31.38 KiB) 542 mal betrachtet
I will update the files in git after your feedback

It should work now...

chehr
Beiträge: 177
Registriert: 07 Apr 2015, 21:07
Wohnort: Friedrichshafen

Re: Datenlogger auf TXT SD-Karte

Beitrag von chehr » 24 Jun 2021, 21:12

Bzgl der zweiten Frage hier im Forum (die dort nicht beantwortet werden kann):
viewtopic.php?f=21&t=6863
2. In welche Einheiten sind CPU Temperatur und die Spannungen angegeben?
Die Frage wurde bereits an ft gestellt, jedoch bisher fehlt die Antwort.

Deshalb hierzu meine kallibierte Formel bzl TXT Versorgungsspannung:

Code: Alles auswählen

SupplyVoltage = (pTArea->sTxtInputs.u16TxtPower)*0.0009 + 1.5; // SupplyVoltage [V]
Weitere infos siehe weiter oben....

Bzgl LED Farben (die erste Frage), das hat bei mir auch nicht geklappt, eventuell kann da vleeuwen weiterhelfen....

Antworten