Breaking UART serial data string - Raspberry Pi

36 views
asked Apr 26 in System Integration by Auto.eng
Hi Embedded Wizard and fellow users,

I'm new to Embedded Wizard and have been evaluating it for a little while now and slowly progressing through all the hurdles to learn this software, but I am a bit unsure how to get past something and hopefully you can help me. My hardware quite simply is an Arduino-type board reading multiple analog inputs and I am sending the data via USB serial to a Raspberry Pi.

I am trying to figure out what is the "best practice" method is to send multiple data? I have Device Integration working where i am using a basic simple text viewer in my Embedded Wizard GUI to view the UART coming in as a continuous string. Eg a234b567c4568a235b566......

I am able to format what i am sending quite easily from the Arduino end, but i really can't figure out to do with the string. Obviously i only need the digits and not the letters, then i would like to put these in an array or individual variables so i can access within the GUI. I have used the example Manfred suggested on https://ask.embedded-wizard.de/433/how-to-send-string-from-usart-and-show-it-textviewer-in-the-gui which has helped me get it working.

Your help here would be very much appreciated

Regards,

Jonathan

1 Answer

0 votes
answered Apr 27 by Manfred Schweyer

Hi Jonathan,

it seems that you already have most parts running and only a few things are missing...

In principle, there are different solutions possible and sometimes "best practice" is a question of personal favorites. I assume that you have an Arduino (or similar) that is aquiring different data and sending a kind of data stream to the Raspberry Pi on a regular basis.

For example the Arduino board measures a voltage in mV, a pressure in mBar and a temperature in 1/10 degrees. These values are then sent in a serial protocol to the Raspberry Pi board, e.g. "Axxxx - Bxxxx - Cxxxx;" On the Raspberry Pi board you can receive and analyze the protocol and assign the received values to properties of the GUI application.

Let me refer to the article Assign variables from Hardware to GUI - it describes exactly how to get the data from UART and how to provide it to the GUI application.

I think this will answer your questions. If there is still something missing, please let us know.

Happy coding!

Manfred.

Ask Embedded Wizard

Welcome to the question and answer site for Embedded Wizard users and UI developers.

Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!

Embedded Wizard Website | Privacy Policy | Imprint

...