[AmpeROSE] User Interface

Hello everyone,

Lately I was working on the User Interface. The software that will run on the PC must receive measurements from AmpeRose, send commands to AmpeRose (through Ethernet or USB) and display the received measurements in the UI. The user can decide if he wants to display all the data he received, display the data that satisfies a certain trigger, display the spectrum … Another critical role of the PC software is data correction. During the initial phase, all the calibration data will be sent to PC and during the normal stream of measurements, the software will correct the received measurements accordingly.

In a previous post, we presented the class diagrams that will be implemented. As a first step, Michel & I implemented the skeleton (with some modifications judged necessary). As discussed in the mentioned post, the software has 3 main components:


The back-end will handle all the connections with AmpeRose. It must implement 2 main methods: Send Command and Receive Measurement.

In order to implement these methods, I had to implement first the Ethernet Connection class. Since AmpeRose will be the server of two TCP connections (Data – Commands), the PC software will then implement 2 TCP clients that run in 2 different threads. Ethernet receiver will read packets of measurements and place them in a queue. Ethernet sender will read from the commands queue and send them to AmpeRose.

The words sent / received in the connection component of the back-end are raw 32 bit words that currently have no significance. That’s why we have to implement a command translator and a data translator. The command translator will make a mapping between 32 bit words and commands we defined in our protocol. The data translator will take the 32 bit words and extract the value, caliber and GPIO status.

The final component of the back-end is the Data Corrector. The data corrector implements 2 methods. The first will add calibration measurements and the second will apply the correction on a given measurement. We are planning to use a linear regression for correction however this component is not implemented yet.

To sum up, in order to send a command we will have to translate it first (using Command Translator) and send it then to AmpeRose using the chosen connection (by placing it in the commands queue in the Ethernet case and the Ethernet sender thread will then get the command from the queue and send it). In order to receive a measurement, we will read a value from the chosen connection (in the Ethernet case, we will read from the queue filled by the Ethernet receiver thread). The read value will be then expanded into useful information and the correction will be applied. In order to test these functionalities, I wrote a simple AmpeRose emulator and we can successfully send commands and receive measurements (generated with a frequency of 100KHz).

Data View

Data view is an intermediary layer between back-end and the main UI. It handles how this data will be viewed. In this class we can chose the view mode: Normal View Mode where data are viewed as a normal continuous stream – Trigger View Mode where only data that obey to a certain trigger are shown. (We can also chose the trigger that will be applied: a threshold – a certain slope …). The main thread of the data view calls the receive measurement of the back-end and store the data in a data container with a capacity specified by the user.

User Interface

Unlike what I thought, the graph display of the received measurements turned out to be the trickiest part of the PC software. The UI is composed of 2 main parts: Control and Graph (as planned in this post). The user will control when he wants to start and stop the acquisition and how the data will be displayed. Initially, in the case of many connected components AmpeRose, the user will also chose to which specific one he wants to connect.

The tricky part is how we are going to display 100,000 points / second. Receiving the measurements at this rate is not a problem however displaying them is. In the current version we are applying a down-sampling and once we zoom in more and more points will be restored. PyQtGraph (the library we are using) supports 3 methods for down-sampling: ‘subsample’ where we take the first of N samples, ‘mean’ where we calculate the mean of N samples and ‘peak’ where we down-sample by drawing a saw wave that follows the min and max of the original data. For now we are using the ‘peak’ method because we are interested in the extreme values.

Next Week

For now, we have a basic working UI ready to be used with the micro-controller. The UI for now can start and stop acquisition, receive measurements and display them. This week I will continue working on the UI. I will start by the implementation of the data correction and statistics. I already implemented the trigger view mode but it needs a lot of improvements that I will work on too. I will try to improve the performance of the graph display (Normally the down-sampling calculations are done in the main thread that may cause lagging when more and more data are received that’s why I will try to implement the down-sampling in a separate thread). Finally, on another note, if we receive our card this week I will also work on testing it.

Until next week 🙂


1 comment to [AmpeROSE] User Interface

Leave a Reply to [AmpeRose] A finger in every pie : ROSE 2018 Cancel reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>




This site uses Akismet to reduce spam. Learn how your comment data is processed.