Missing measurements on PhidgetBridge 1046

Supporting 2.7 and 3.2+
arnopluk
Fresh meat
Posts: 2
Joined: Wed May 01, 2019 7:46 am
Contact:

Missing measurements on PhidgetBridge 1046

Postby arnopluk » Mon May 13, 2019 1:56 am

Hello,

I'm using the PhidgetBridge 1046 to measure 4 load cells on a Raspberry Pi 3B (and 3B+) in python 2.7. In my software I measure all four channels at 125Hz and store the data into a csv file.
The problem is, that I get a different number of measurements from each channel.
I use the code below (simplified). Since the 'BrideDataHandler' is called for each single measurement (from a single load cell), there is no way to check if all sensors are sampled an equal amount of time.
When reviewing my data, I can see that there is some increasing 'drift' between the channels, which indicates that some samples are missing.

Code: Select all

# Bridge data and functions
class BridgeFunctions():

    # Bridge sensor connection
    bridge = Bridge()
    fileBuffer = [[] for _ in range(4)]
   
    def BridgeData(self, e):
        sensor = e.index
        data = e.value
        self.fileBuffer[sensor].append(data)

    def attachBridge(self, e):
        # Configure
        self.bridge.setDataRate(8)
        self.bridge.setGain(0, BridgeGain.PHIDGET_BRIDGE_GAIN_128)
        self.bridge.setGain(1, BridgeGain.PHIDGET_BRIDGE_GAIN_128)
        self.bridge.setGain(2, BridgeGain.PHIDGET_BRIDGE_GAIN_128)
        self.bridge.setGain(3, BridgeGain.PHIDGET_BRIDGE_GAIN_128)
        # Start measurement
        self.bridge.setEnabled(0, True)
        self.bridge.setEnabled(1, True)
        self.bridge.setEnabled(2, True)
        self.bridge.setEnabled(3, True)
       
    def connectBridge(self):
        self.bridge.setOnBridgeDataHandler(self.BridgeData)
        self.bridge.openPhidget()

Return to “Python”

Who is online

Users browsing this forum: No registered users and 1 guest