Python Forum

Full Version: display reading sensor data
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am reading data from sensors by micro controller and sending the data through USB port to computer. I can receive and print the data easily with python. I have a problem on displaying the data. I used different GUIs like PY5 and pyqt but all of them are slow and I can not go more than 9600 bit/Sec. I was wondering if there is faster GUI or even sample code. Thanks.
it would be most helpful to show your code.
Quote:I can not go more than 9600 bit/Sec
There is no way your eyes can keep up with anything close to this speed. Would suggest that you display every x value, or t seconds, and keep it in the visible range. Also note that the speed bounds are your processor speed, and graphic card speed, probably not the GUI software (although that depends on how many widgets you have open at any one time as well as other things), so you could get a faster machine but that would be hitting a fly with a bazooka.
I have a decent computer and more than 9600 bit/sec is almost the lowest bitrate you can get from cheapest microcontroller. I can go much more with LabView or MATLAB or even C# but this GUIs are so heavy so I can not go faster.
Quote:but this GUIs are so heavy so I can not go faster
Don't have any idea what this means. In the age of Raspberry Pi's, etc. people are doing this every day so it is something in your code that is causing the problem. Post a simple example of what you want to do.
       while True:
            if not self._ser.is_open:
                break
            temp = self._ser.read()
            if start:
                if iii % 2:
                    xx = int.from_bytes(temp, byteorder='little')
                elif not iii % 2:
                    yy = int.from_bytes(temp, byteorder='little') << 8
                    zz = xx + yy

                    y[int(iii / 2) - 1] = zz
                    if iii == 6:
                        start = False
                        self.data1[:-1] = self.data1[1:]
                        self.data2[:-1] = self.data2[1:]
                        self.data3[:-1] = self.data3[1:]
                        self.data1[-1] = y[0]
                        self.data2[-1] = y[1]
                        self.data3[-1] = y[2]
                        self.curve1.setData(self.data1)
                        self.curve2.setData(self.data2)
                        self.curve3.setData(self.data3)
                        self.xpos1 += 1
                        self.xpos2 += 1
                        self.xpos3 += 1
                        #self.curve1.setPos(self.xpos1, 0)
                        #self.curve2.setPos(self.xpos2, 0)
                        #self.curve3.setPos(self.xpos3, 0)
                        fftCount += 1
                        if fftCount >= self._fftLength:
                            self.fftDataSet1 = self.calculateFFT(self.data1[-self._fftLength:])
                            self.on_PlotButton1_clicked()
                            self.addValuesToTable(self.fftDataSet1, self.FFTTable1, self._FFTPointList1)

                            self.fftDataSet2 = self.calculateFFT(self.data2[-self._fftLength:])
                            self.on_PlotButton2_clicked()
                            self.addValuesToTable(self.fftDataSet2, self.FFTTable2, self._FFTPointList2)

                            self.fftDataSet3 = self.calculateFFT(self.data3[-self._fftLength:])
                            self.on_PlotButton3_clicked()
                            self.addValuesToTable(self.fftDataSet3, self.FFTTable3, self._FFTPointList3)

                            fftCount = 0
                        self._reachedFFT = True
                        self.app.processEvents()

                iii += 1
            if temp == b'y' and not (start):
                tempOld = temp

            if temp == b'z' and not (start):
                if tempOld == b'y':
                    start = True
                    iii = 1