Skip to main content
Visitor II
October 5, 2022
Solved

STM32cubeMonitor (How to display the waveform of serial port data in real time)

  • October 5, 2022
  • 4 replies
  • 3455 views

I want to use STM32cubemonitor to receive serial port data, the serial port data is four channels. And draw the four-channel data.

I can't find any relevant examples and don't know the implementation to split the data ...

0693W00000UnN78QAF.png

    This topic has been closed for replies.
    Best answer by RomainR.

    Hello @Lep (Community Member)

    I'm happy to helped you, and I think that taking the time to learn Node-Red and Javascript is very a good thing, and it's not a waste of time.

    However, for your question about displaying the dashboard on another device if I remember, it should be:

    http://IP Address:1880/ui

    BR

    Romain

    In order to give better visibility on the answered topics, please click on 'Select as Best' on the reply which solved your issue or answered your question. See also 'Best Answers'

    4 replies

    ST Employee
    October 5, 2022

    Hello Lep (Community Member)

    I don't know how the data of your 4 channels are represented in the payload ?

    If you are able to change this representation on your serial interface side, one of the easiest ways is to format your data in csv.

    After that, you can use a csv node to split each data in a message.

    This resource might inspire you:

    https://discourse.nodered.org/t/splitting-payload-from-serial/9356

    Best regards,

    Romain,

    LepAuthor
    Visitor II
    October 5, 2022

    Thank you.

    I am collecting external ADC data, and then inputting it through serial port. 24bits is one channel data, every four is a group(as figure shows). I want to chart the data for each channel, and have the four channels simultaneously do the waveform drawing in real time.

    Do you have any relevant examples?

    0693W00000UnQHkQAN.jpg

    ST Employee
    October 5, 2022

    Sorry, I do not have any ready-made example.

    I can advise you to use a function node, loop through the elements, store each group into a temporary array, convert the array in JSON format.

    Thank you to mark my post as answered.

    Best regards,

    Romain,

    LepAuthor
    Visitor II
    October 6, 2022

    I'm so sorry to trouble you again, but I really don't know what to do, and I can't find any learning materials for this. :loudly_crying_face:

    I've been watching javascript and node_red tutorials all afternoon, and I'm pretty new to the programming that functions require....so I'm still out of ideas. I changed the serial port input to the form shown in the figure below. The four values ​​in each line represent the data of four channels. Then I can use the chart to make dynamic waveforms. Can you be more detailed?

    0693W00000UnV84QAF.png

    ST Employee
    October 6, 2022

    Hello @Lep (Community Member)

    Here attached a very basic flow. The serial data are split with space character \0x20 (because it is the format of your use case)

    Then using batch (by 4 elements) and join (into array) node you can send it to csv formater node.

    The result is in the debug console in the right.

    Here the serial is configured as 115200, 8, 1, n.

    Best regards,

    Romain

    [
     
     {
     
     "id": "230e0643264be2a6",
     
     "type": "tab",
     
     "label": "Flow 1",
     
     "disabled": false,
     
     "info": "",
     
     "env": []
     
     },
     
     {
     
     "id": "9880c74fb5fd3047",
     
     "type": "serial in",
     
     "z": "230e0643264be2a6",
     
     "name": "",
     
     "serial": "c537768eecb1bf9c",
     
     "x": 150,
     
     "y": 220,
     
     "wires": [
     
     [
     
     "dbe44d7b08bfa87c"
     
     ]
     
     ]
     
     },
     
     {
     
     "id": "9163581ea8fed09e",
     
     "type": "debug",
     
     "z": "230e0643264be2a6",
     
     "name": "",
     
     "active": true,
     
     "tosidebar": true,
     
     "console": false,
     
     "tostatus": false,
     
     "complete": "payload",
     
     "targetType": "msg",
     
     "statusVal": "",
     
     "statusType": "auto",
     
     "x": 830,
     
     "y": 220,
     
     "wires": []
     
     },
     
     {
     
     "id": "d7a21dbe63b020c7",
     
     "type": "csv",
     
     "z": "230e0643264be2a6",
     
     "name": "",
     
     "sep": ",",
     
     "hdrin": false,
     
     "hdrout": "once",
     
     "multi": "mult",
     
     "ret": "
     
    \\n
     
    ",
     
     "temp": "",
     
     "skip": "0",
     
     "strings": true,
     
     "include_empty_strings": "",
     
     "include_null_values": "",
     
     "x": 630,
     
     "y": 220,
     
     "wires": [
     
     [
     
     "9163581ea8fed09e"
     
     ]
     
     ]
     
     },
     
     {
     
     "id": "dbe44d7b08bfa87c",
     
     "type": "batch",
     
     "z": "230e0643264be2a6",
     
     "name": "",
     
     "mode": "count",
     
     "count": "4",
     
     "overlap": "0",
     
     "interval": 10,
     
     "allowEmptySequence": false,
     
     "topics": [],
     
     "x": 310,
     
     "y": 220,
     
     "wires": [
     
     [
     
     "dc238c2f79e7d8d1"
     
     ]
     
     ]
     
     },
     
     {
     
     "id": "dc238c2f79e7d8d1",
     
     "type": "join",
     
     "z": "230e0643264be2a6",
     
     "name": "",
     
     "mode": "custom",
     
     "build": "array",
     
     "property": "payload",
     
     "propertyType": "msg",
     
     "key": "topic",
     
     "joiner": "
     
    \\0x20
     
    ",
     
     "joinerType": "str",
     
     "accumulate": false,
     
     "timeout": "",
     
     "count": "",
     
     "reduceRight": false,
     
     "reduceExp": "",
     
     "reduceInit": "",
     
     "reduceInitType": "",
     
     "reduceFixup": "",
     
     "x": 470,
     
     "y": 220,
     
     "wires": [
     
     [
     
     "d7a21dbe63b020c7"
     
     ]
     
     ]
     
     },
     
     {
     
     "id": "c537768eecb1bf9c",
     
     "type": "serial-port",
     
     "serialport": "COM49",
     
     "serialbaud": "115200",
     
     "databits": "8",
     
     "parity": "none",
     
     "stopbits": "1",
     
     "waitfor": "",
     
     "dtr": "none",
     
     "rts": "none",
     
     "cts": "none",
     
     "dsr": "none",
     
     "newline": "
     
    \\0x20
     
    ",
     
     "bin": "false",
     
     "out": "char",
     
     "addchar": "",
     
     "responsetimeout": "10000"
     
     }
     
    ]

    ST Employee
    October 6, 2022

    it is probably not the best methods, but it can be a starting point for you.

    LepAuthor
    Visitor II
    October 12, 2022

    Thanks again for your help.

    Recently, I learned javascript and node red once, and I have basically completed my functions. You have given me a good start to face these problems.

    0693W00000UnubkQAB.pngAnd I have a new problem. I want to display dashboard in my phone, ipad and computer website. What should I do?

    RomainR.Answer
    ST Employee
    October 12, 2022

    Hello @Lep (Community Member)

    I'm happy to helped you, and I think that taking the time to learn Node-Red and Javascript is very a good thing, and it's not a waste of time.

    However, for your question about displaying the dashboard on another device if I remember, it should be:

    http://IP Address:1880/ui

    BR

    Romain

    In order to give better visibility on the answered topics, please click on 'Select as Best' on the reply which solved your issue or answered your question. See also 'Best Answers'

    LepAuthor
    Visitor II
    October 12, 2022

    Yes, my question is how to find this address or how do I set this address.

    I found a related instructional video on Youtube, but I don't know how he did it and how the address was set.

    (17) STM32CubeMonitor in practice - How to do a remote monitoring - YouTube