Python Forum
display reading sensor data
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
display reading sensor data
#1
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.
Reply
#2
it would be most helpful to show your code.
Reply
#3
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.
Reply
#4
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.
Reply
#5
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.
Reply
#6
       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
 
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Display MySQL data in QLlineEdit text boxes JayCee 1 4,056 Mar-26-2020, 03:55 PM
Last Post: JayCee
  Display and update the label text which display the serial value jenkins43 5 8,995 Feb-04-2019, 04:36 AM
Last Post: Larz60+
  Display more than one button in GUI to display MPU6000 Sensor readings barry76 4 3,836 Jan-05-2019, 01:48 PM
Last Post: wuf
  [PyQt] How to display multiple data(from 2 different related table) in one cell of QTableWid yangjae 4 4,320 Oct-17-2018, 07:54 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020