jupyterpidaq.Boards.PiGPIO.DAQC2

  1# Utility sampling routines for using the ADC block of the
  2# Pi-Plates DAQC2plate RPI HAT.
  3# J. Gutow <gutow@uwosh.edu> June 2020
  4# license GPL V3 or greater
  5import time
  6import numpy as np
  7
  8import logging
  9
 10try:
 11    from piplates import DAQC2plate
 12except Exception as e:
 13    print("\nDAQC2plate: "+str(e), end='')
 14    DAQC2plate = None
 15
 16from jupyterpidaq.Boards import Board
 17
 18logger = logging.getLogger(__name__)
 19
 20# Optimized for Pi 3B+ for an installed ADS1115 ADC PiHAT. This is
 21# actually ignored by this board, but necessary for ADC call
 22# compatibility.
 23RATE = 475
 24
 25def find_boards():
 26    """
 27    A rountine like this must be implemented by all board packages.
 28
 29    :return: list of DAQC2 board objects (maximum of 8 boards)
 30    """
 31    boards = []
 32    tmpmod = None
 33    if DAQC2plate:
 34        for addr in range(len(DAQC2plate.daqc2sPresent)):
 35            if DAQC2plate.daqc2sPresent[addr] == 1:
 36                boards.append(Board_DAQC2(addr))
 37    return boards
 38
 39
 40class Board_DAQC2(Board):
 41    """
 42    Class defining the properties of the analog-to-digital block of the
 43    pi-Plates DAQC2 board. Key characteristics:
 44
 45    * 8 channels (0 - 7) with pseudo 16 bit resolution (oversampled 14 bit) and
 46      a range of +/- 12 V.
 47    * 1 channel (8) dedicated to monitoring Vdd.
 48    * Programmable RGB LED to use as indicator.
 49    * Other available facilities are Digital I/O, Digital-to-Analog and
 50      2-channel o-scope modes. These are not supported by this class.
 51    """
 52    def __init__(self, addr):
 53        super().__init__()
 54        self.name = 'DAQC2'
 55        self.vendor = 'Pi-Plates'
 56        # Note: channel 8 is wired to Vdd so cannot be used for measurements.
 57        self.channels = (0, 1, 2, 3, 4, 5, 6, 7, 8)
 58        self.addr = addr
 59        # Flash light green and then off to indicated found and set up.
 60        DAQC2plate.setLED(self.addr,'green')
 61        Vddcheck = float(self.V_oversampchan(8,1,5)[0])
 62        self.Vdd = Vddcheck
 63        DAQC2plate.setLED(self.addr,'off')
 64
 65    def getsensors(self):
 66        """
 67        Return a list of valid sensor object names for this board.
 68        :return: list of classnames
 69        """
 70        sensorlist = ['RawAtoD',
 71                      'VernierSSTemp',
 72                      'VernierGasP',
 73                      'VernierGasP_OLD',
 74                      'VernierpH',
 75                      'VernierFlatpH'
 76                      ]
 77        # TODO: extend this list as appropriate. You can get a full list
 78        #  using the `Sensors.sensors.listSensors()` call.
 79        # The main program will use this list to access the actual sensor
 80        # objects when converting the raw board voltage and for producing
 81        # a menu of valid options for this particular board.
 82        return sensorlist
 83
 84    def V_oversampchan(self, chan, gain, avg_sec, data_rate=RATE):
 85        """
 86        This routine returns the average voltage for the channel
 87        averaged at the default rate for the board and returns an
 88        average and observed range.
 89
 90        Returns a tuple of the following 5 objects:
 91            V_avg -- float, the averaged voltage
 92
 93            V_min -- float, the minimum voltage read during
 94            the interval
 95
 96            V_max -- float, the maximum voltage read during the
 97            interval
 98
 99            time_stamp -- float, the time at halfway through the averaging
100            interval in seconds since the beginning of the epoch (OS
101            dependent begin time)
102
103            Vdd_avg -- float, the reference voltage (Vdd) collected
104            simultaneously.
105
106        :param int chan: the channel number (0, 1, 2, 3, 4, 5, 6, 7,
107         8). NOTE: channel 8 returns a measurement of Vdd.
108
109        :param gain: ignored by board. Defaults to 1.
110
111        :param int data_rate: ignored by board.
112
113        :param float avg_sec: seconds to average for, actual
114         averaging interval will be as close as possible for an integer
115         number of samples
116
117        :returns: V_avg, V_min, V_max, time_stamp, Vdd_avg
118        :return float V_avg: description
119        :return float V_min:
120        :return float V_max:
121        :return float time_stamp:
122        :return float Vdd_avg:
123        """
124        value = []
125        ref = []
126        starttime = time.time()
127        endtime = starttime + avg_sec
128        while time.time() < endtime:
129            value.append(DAQC2plate.getADC(self.addr, chan))
130            ref.append(DAQC2plate.getADC(self.addr, 8))
131        time_stamp = (endtime + endtime) / 2
132        ndata = len(value)
133        V_avg = sum(value) / ndata
134        Vdd_avg = sum(ref) / ndata
135        V_min = min(value)
136        V_max = max(value)
137        return V_avg, V_min, V_max, time_stamp, Vdd_avg
138
139    def V_oversampchan_stats(self, chan, gain, avg_sec, data_rate=RATE):
140        '''
141        This routine returns the average voltage for the channel
142        averaged at the maximum rate for the board. The standard
143        deviation and the estimated deviation of the mean are also
144        returned.
145
146        Returns a tuple of the following 5 objects:
147            V_avg -- float, the averaged voltage
148
149            stdev -- float, the standard deviation of the measured values
150            during the averaging interval
151
152            stdev_avg -- float, the estimated standard deviation of the
153            returned average
154
155            time_stamp -- float, the time at halfway through the averaging
156            interval in seconds since the beginning of the epoch (OS
157            dependent begin time)
158
159            Vdd_avg -- float, the reference voltage (Vdd) collected
160            simultaneously.
161
162        :param int chan: the channel number (0, 1, 2, 3, 4, 5, 6, 7,
163         8). NOTE: channel 8 returns a measurement of Vdd.
164
165        :param gain: ignored by board. Defaults to 1.
166
167        :param int data_rate: ignored by board.
168
169        :param float avg_sec: seconds to average for, actual
170         averaging interval will be as close as possible for an integer
171         number of samples
172
173        :returns: V_avg, stdev, stdev_avg, time_stamp, Vdd_avg
174        :return float V_avg: description
175        :return float stdev:
176        :return float stdev_avg:
177        :return float time_stamp:
178        :return float Vdd_avg:
179        '''
180        value = []
181        ref = []
182        starttime = time.time()
183        endtime = starttime + avg_sec
184        while time.time() < endtime:
185            value.append(DAQC2plate.getADC(self.addr, chan))
186            ref.append(DAQC2plate.getADC(self.addr, 8))
187        time_stamp = (starttime + endtime) / 2
188        ndata = len(value)
189        logging.debug('channel:'+str(chan)+', starttime:'+str(starttime)+', '
190                      'endtime:'+str(endtime)+', ndata:'+str(ndata)+'.')
191        V_avg = sum(value) / ndata
192        Vdd_avg = sum(ref) / ndata
193        stdev = np.std(value, ddof=1, dtype=np.float64)
194        stdev_avg = stdev / np.sqrt(float(ndata))
195        return V_avg, stdev, stdev_avg, time_stamp, Vdd_avg
196
197    def V_sampchan(self, chan, gain, data_rate=RATE):
198        '''
199        This routine returns a single reading of the voltage for the channel.
200
201        Returns a tuple of the following 5 objects:
202            V -- float, the measured voltage
203
204            time_stamp -- float, the time of the measurement in seconds since
205            the beginning of the epoch (OS dependent begin time)
206
207            ref -- float, the reference voltage (Vdd) collected
208            simultaneously.
209
210        :param int chan: the channel number (0, 1, 2, 3, 4, 5, 6, 7,
211         8). NOTE: channel 8 returns a measurement of Vdd.
212
213        :param gain: ignored by board. Defaults to 1.
214
215        :param int data_rate: ignored by board.
216
217        :returns: V_avg, stdev, stdev_avg, time_stamp, Vdd_avg
218        :return float V:
219        :return float time_stamp:
220        :return float ref:
221        '''
222        start = time.time()
223        value = DAQC2plate.getADC(self.addr, chan)
224        ref = DAQC2plate.getADC(self.addr, 8)
225        end = time.time()
226        time_stamp = (start + end) / 2
227        return value, time_stamp, ref
def find_boards():
26def find_boards():
27    """
28    A rountine like this must be implemented by all board packages.
29
30    :return: list of DAQC2 board objects (maximum of 8 boards)
31    """
32    boards = []
33    tmpmod = None
34    if DAQC2plate:
35        for addr in range(len(DAQC2plate.daqc2sPresent)):
36            if DAQC2plate.daqc2sPresent[addr] == 1:
37                boards.append(Board_DAQC2(addr))
38    return boards

A rountine like this must be implemented by all board packages.

Returns

list of DAQC2 board objects (maximum of 8 boards)

class Board_DAQC2(jupyterpidaq.Boards.boards.Board):
 41class Board_DAQC2(Board):
 42    """
 43    Class defining the properties of the analog-to-digital block of the
 44    pi-Plates DAQC2 board. Key characteristics:
 45
 46    * 8 channels (0 - 7) with pseudo 16 bit resolution (oversampled 14 bit) and
 47      a range of +/- 12 V.
 48    * 1 channel (8) dedicated to monitoring Vdd.
 49    * Programmable RGB LED to use as indicator.
 50    * Other available facilities are Digital I/O, Digital-to-Analog and
 51      2-channel o-scope modes. These are not supported by this class.
 52    """
 53    def __init__(self, addr):
 54        super().__init__()
 55        self.name = 'DAQC2'
 56        self.vendor = 'Pi-Plates'
 57        # Note: channel 8 is wired to Vdd so cannot be used for measurements.
 58        self.channels = (0, 1, 2, 3, 4, 5, 6, 7, 8)
 59        self.addr = addr
 60        # Flash light green and then off to indicated found and set up.
 61        DAQC2plate.setLED(self.addr,'green')
 62        Vddcheck = float(self.V_oversampchan(8,1,5)[0])
 63        self.Vdd = Vddcheck
 64        DAQC2plate.setLED(self.addr,'off')
 65
 66    def getsensors(self):
 67        """
 68        Return a list of valid sensor object names for this board.
 69        :return: list of classnames
 70        """
 71        sensorlist = ['RawAtoD',
 72                      'VernierSSTemp',
 73                      'VernierGasP',
 74                      'VernierGasP_OLD',
 75                      'VernierpH',
 76                      'VernierFlatpH'
 77                      ]
 78        # TODO: extend this list as appropriate. You can get a full list
 79        #  using the `Sensors.sensors.listSensors()` call.
 80        # The main program will use this list to access the actual sensor
 81        # objects when converting the raw board voltage and for producing
 82        # a menu of valid options for this particular board.
 83        return sensorlist
 84
 85    def V_oversampchan(self, chan, gain, avg_sec, data_rate=RATE):
 86        """
 87        This routine returns the average voltage for the channel
 88        averaged at the default rate for the board and returns an
 89        average and observed range.
 90
 91        Returns a tuple of the following 5 objects:
 92            V_avg -- float, the averaged voltage
 93
 94            V_min -- float, the minimum voltage read during
 95            the interval
 96
 97            V_max -- float, the maximum voltage read during the
 98            interval
 99
100            time_stamp -- float, the time at halfway through the averaging
101            interval in seconds since the beginning of the epoch (OS
102            dependent begin time)
103
104            Vdd_avg -- float, the reference voltage (Vdd) collected
105            simultaneously.
106
107        :param int chan: the channel number (0, 1, 2, 3, 4, 5, 6, 7,
108         8). NOTE: channel 8 returns a measurement of Vdd.
109
110        :param gain: ignored by board. Defaults to 1.
111
112        :param int data_rate: ignored by board.
113
114        :param float avg_sec: seconds to average for, actual
115         averaging interval will be as close as possible for an integer
116         number of samples
117
118        :returns: V_avg, V_min, V_max, time_stamp, Vdd_avg
119        :return float V_avg: description
120        :return float V_min:
121        :return float V_max:
122        :return float time_stamp:
123        :return float Vdd_avg:
124        """
125        value = []
126        ref = []
127        starttime = time.time()
128        endtime = starttime + avg_sec
129        while time.time() < endtime:
130            value.append(DAQC2plate.getADC(self.addr, chan))
131            ref.append(DAQC2plate.getADC(self.addr, 8))
132        time_stamp = (endtime + endtime) / 2
133        ndata = len(value)
134        V_avg = sum(value) / ndata
135        Vdd_avg = sum(ref) / ndata
136        V_min = min(value)
137        V_max = max(value)
138        return V_avg, V_min, V_max, time_stamp, Vdd_avg
139
140    def V_oversampchan_stats(self, chan, gain, avg_sec, data_rate=RATE):
141        '''
142        This routine returns the average voltage for the channel
143        averaged at the maximum rate for the board. The standard
144        deviation and the estimated deviation of the mean are also
145        returned.
146
147        Returns a tuple of the following 5 objects:
148            V_avg -- float, the averaged voltage
149
150            stdev -- float, the standard deviation of the measured values
151            during the averaging interval
152
153            stdev_avg -- float, the estimated standard deviation of the
154            returned average
155
156            time_stamp -- float, the time at halfway through the averaging
157            interval in seconds since the beginning of the epoch (OS
158            dependent begin time)
159
160            Vdd_avg -- float, the reference voltage (Vdd) collected
161            simultaneously.
162
163        :param int chan: the channel number (0, 1, 2, 3, 4, 5, 6, 7,
164         8). NOTE: channel 8 returns a measurement of Vdd.
165
166        :param gain: ignored by board. Defaults to 1.
167
168        :param int data_rate: ignored by board.
169
170        :param float avg_sec: seconds to average for, actual
171         averaging interval will be as close as possible for an integer
172         number of samples
173
174        :returns: V_avg, stdev, stdev_avg, time_stamp, Vdd_avg
175        :return float V_avg: description
176        :return float stdev:
177        :return float stdev_avg:
178        :return float time_stamp:
179        :return float Vdd_avg:
180        '''
181        value = []
182        ref = []
183        starttime = time.time()
184        endtime = starttime + avg_sec
185        while time.time() < endtime:
186            value.append(DAQC2plate.getADC(self.addr, chan))
187            ref.append(DAQC2plate.getADC(self.addr, 8))
188        time_stamp = (starttime + endtime) / 2
189        ndata = len(value)
190        logging.debug('channel:'+str(chan)+', starttime:'+str(starttime)+', '
191                      'endtime:'+str(endtime)+', ndata:'+str(ndata)+'.')
192        V_avg = sum(value) / ndata
193        Vdd_avg = sum(ref) / ndata
194        stdev = np.std(value, ddof=1, dtype=np.float64)
195        stdev_avg = stdev / np.sqrt(float(ndata))
196        return V_avg, stdev, stdev_avg, time_stamp, Vdd_avg
197
198    def V_sampchan(self, chan, gain, data_rate=RATE):
199        '''
200        This routine returns a single reading of the voltage for the channel.
201
202        Returns a tuple of the following 5 objects:
203            V -- float, the measured voltage
204
205            time_stamp -- float, the time of the measurement in seconds since
206            the beginning of the epoch (OS dependent begin time)
207
208            ref -- float, the reference voltage (Vdd) collected
209            simultaneously.
210
211        :param int chan: the channel number (0, 1, 2, 3, 4, 5, 6, 7,
212         8). NOTE: channel 8 returns a measurement of Vdd.
213
214        :param gain: ignored by board. Defaults to 1.
215
216        :param int data_rate: ignored by board.
217
218        :returns: V_avg, stdev, stdev_avg, time_stamp, Vdd_avg
219        :return float V:
220        :return float time_stamp:
221        :return float ref:
222        '''
223        start = time.time()
224        value = DAQC2plate.getADC(self.addr, chan)
225        ref = DAQC2plate.getADC(self.addr, 8)
226        end = time.time()
227        time_stamp = (start + end) / 2
228        return value, time_stamp, ref

Class defining the properties of the analog-to-digital block of the pi-Plates DAQC2 board. Key characteristics:

  • 8 channels (0 - 7) with pseudo 16 bit resolution (oversampled 14 bit) and a range of +/- 12 V.
  • 1 channel (8) dedicated to monitoring Vdd.
  • Programmable RGB LED to use as indicator.
  • Other available facilities are Digital I/O, Digital-to-Analog and 2-channel o-scope modes. These are not supported by this class.
Board_DAQC2(addr)
53    def __init__(self, addr):
54        super().__init__()
55        self.name = 'DAQC2'
56        self.vendor = 'Pi-Plates'
57        # Note: channel 8 is wired to Vdd so cannot be used for measurements.
58        self.channels = (0, 1, 2, 3, 4, 5, 6, 7, 8)
59        self.addr = addr
60        # Flash light green and then off to indicated found and set up.
61        DAQC2plate.setLED(self.addr,'green')
62        Vddcheck = float(self.V_oversampchan(8,1,5)[0])
63        self.Vdd = Vddcheck
64        DAQC2plate.setLED(self.addr,'off')

Should be overridden by each board and define at minimum: self.name = 'board name/adc name/type' Short an useful to end user self.vendor = 'Vendor/Manufacturer name` self.channels = tuple of available channel IDs self.gains = list of gains self.Vdd = voltage provided by board to sensors

def getsensors(self):
66    def getsensors(self):
67        """
68        Return a list of valid sensor object names for this board.
69        :return: list of classnames
70        """
71        sensorlist = ['RawAtoD',
72                      'VernierSSTemp',
73                      'VernierGasP',
74                      'VernierGasP_OLD',
75                      'VernierpH',
76                      'VernierFlatpH'
77                      ]
78        # TODO: extend this list as appropriate. You can get a full list
79        #  using the `Sensors.sensors.listSensors()` call.
80        # The main program will use this list to access the actual sensor
81        # objects when converting the raw board voltage and for producing
82        # a menu of valid options for this particular board.
83        return sensorlist

Return a list of valid sensor object names for this board.

Returns

list of classnames

def V_oversampchan(self, chan, gain, avg_sec, data_rate=475):
 85    def V_oversampchan(self, chan, gain, avg_sec, data_rate=RATE):
 86        """
 87        This routine returns the average voltage for the channel
 88        averaged at the default rate for the board and returns an
 89        average and observed range.
 90
 91        Returns a tuple of the following 5 objects:
 92            V_avg -- float, the averaged voltage
 93
 94            V_min -- float, the minimum voltage read during
 95            the interval
 96
 97            V_max -- float, the maximum voltage read during the
 98            interval
 99
100            time_stamp -- float, the time at halfway through the averaging
101            interval in seconds since the beginning of the epoch (OS
102            dependent begin time)
103
104            Vdd_avg -- float, the reference voltage (Vdd) collected
105            simultaneously.
106
107        :param int chan: the channel number (0, 1, 2, 3, 4, 5, 6, 7,
108         8). NOTE: channel 8 returns a measurement of Vdd.
109
110        :param gain: ignored by board. Defaults to 1.
111
112        :param int data_rate: ignored by board.
113
114        :param float avg_sec: seconds to average for, actual
115         averaging interval will be as close as possible for an integer
116         number of samples
117
118        :returns: V_avg, V_min, V_max, time_stamp, Vdd_avg
119        :return float V_avg: description
120        :return float V_min:
121        :return float V_max:
122        :return float time_stamp:
123        :return float Vdd_avg:
124        """
125        value = []
126        ref = []
127        starttime = time.time()
128        endtime = starttime + avg_sec
129        while time.time() < endtime:
130            value.append(DAQC2plate.getADC(self.addr, chan))
131            ref.append(DAQC2plate.getADC(self.addr, 8))
132        time_stamp = (endtime + endtime) / 2
133        ndata = len(value)
134        V_avg = sum(value) / ndata
135        Vdd_avg = sum(ref) / ndata
136        V_min = min(value)
137        V_max = max(value)
138        return V_avg, V_min, V_max, time_stamp, Vdd_avg

This routine returns the average voltage for the channel averaged at the default rate for the board and returns an average and observed range.

Returns a tuple of the following 5 objects: V_avg -- float, the averaged voltage

V_min -- float, the minimum voltage read during
the interval

V_max -- float, the maximum voltage read during the
interval

time_stamp -- float, the time at halfway through the averaging
interval in seconds since the beginning of the epoch (OS
dependent begin time)

Vdd_avg -- float, the reference voltage (Vdd) collected
simultaneously.
Parameters
  • int chan: the channel number (0, 1, 2, 3, 4, 5, 6, 7, 8). NOTE: channel 8 returns a measurement of Vdd.

  • gain: ignored by board. Defaults to 1.

  • int data_rate: ignored by board.

  • float avg_sec: seconds to average for, actual averaging interval will be as close as possible for an integer number of samples

:returns: V_avg, V_min, V_max, time_stamp, Vdd_avg

Returns

description

Returns

Returns

Returns

Returns
def V_oversampchan_stats(self, chan, gain, avg_sec, data_rate=475):
140    def V_oversampchan_stats(self, chan, gain, avg_sec, data_rate=RATE):
141        '''
142        This routine returns the average voltage for the channel
143        averaged at the maximum rate for the board. The standard
144        deviation and the estimated deviation of the mean are also
145        returned.
146
147        Returns a tuple of the following 5 objects:
148            V_avg -- float, the averaged voltage
149
150            stdev -- float, the standard deviation of the measured values
151            during the averaging interval
152
153            stdev_avg -- float, the estimated standard deviation of the
154            returned average
155
156            time_stamp -- float, the time at halfway through the averaging
157            interval in seconds since the beginning of the epoch (OS
158            dependent begin time)
159
160            Vdd_avg -- float, the reference voltage (Vdd) collected
161            simultaneously.
162
163        :param int chan: the channel number (0, 1, 2, 3, 4, 5, 6, 7,
164         8). NOTE: channel 8 returns a measurement of Vdd.
165
166        :param gain: ignored by board. Defaults to 1.
167
168        :param int data_rate: ignored by board.
169
170        :param float avg_sec: seconds to average for, actual
171         averaging interval will be as close as possible for an integer
172         number of samples
173
174        :returns: V_avg, stdev, stdev_avg, time_stamp, Vdd_avg
175        :return float V_avg: description
176        :return float stdev:
177        :return float stdev_avg:
178        :return float time_stamp:
179        :return float Vdd_avg:
180        '''
181        value = []
182        ref = []
183        starttime = time.time()
184        endtime = starttime + avg_sec
185        while time.time() < endtime:
186            value.append(DAQC2plate.getADC(self.addr, chan))
187            ref.append(DAQC2plate.getADC(self.addr, 8))
188        time_stamp = (starttime + endtime) / 2
189        ndata = len(value)
190        logging.debug('channel:'+str(chan)+', starttime:'+str(starttime)+', '
191                      'endtime:'+str(endtime)+', ndata:'+str(ndata)+'.')
192        V_avg = sum(value) / ndata
193        Vdd_avg = sum(ref) / ndata
194        stdev = np.std(value, ddof=1, dtype=np.float64)
195        stdev_avg = stdev / np.sqrt(float(ndata))
196        return V_avg, stdev, stdev_avg, time_stamp, Vdd_avg

This routine returns the average voltage for the channel averaged at the maximum rate for the board. The standard deviation and the estimated deviation of the mean are also returned.

Returns a tuple of the following 5 objects: V_avg -- float, the averaged voltage

stdev -- float, the standard deviation of the measured values
during the averaging interval

stdev_avg -- float, the estimated standard deviation of the
returned average

time_stamp -- float, the time at halfway through the averaging
interval in seconds since the beginning of the epoch (OS
dependent begin time)

Vdd_avg -- float, the reference voltage (Vdd) collected
simultaneously.
Parameters
  • int chan: the channel number (0, 1, 2, 3, 4, 5, 6, 7, 8). NOTE: channel 8 returns a measurement of Vdd.

  • gain: ignored by board. Defaults to 1.

  • int data_rate: ignored by board.

  • float avg_sec: seconds to average for, actual averaging interval will be as close as possible for an integer number of samples

:returns: V_avg, stdev, stdev_avg, time_stamp, Vdd_avg

Returns

description

Returns

Returns

Returns

Returns
def V_sampchan(self, chan, gain, data_rate=475):
198    def V_sampchan(self, chan, gain, data_rate=RATE):
199        '''
200        This routine returns a single reading of the voltage for the channel.
201
202        Returns a tuple of the following 5 objects:
203            V -- float, the measured voltage
204
205            time_stamp -- float, the time of the measurement in seconds since
206            the beginning of the epoch (OS dependent begin time)
207
208            ref -- float, the reference voltage (Vdd) collected
209            simultaneously.
210
211        :param int chan: the channel number (0, 1, 2, 3, 4, 5, 6, 7,
212         8). NOTE: channel 8 returns a measurement of Vdd.
213
214        :param gain: ignored by board. Defaults to 1.
215
216        :param int data_rate: ignored by board.
217
218        :returns: V_avg, stdev, stdev_avg, time_stamp, Vdd_avg
219        :return float V:
220        :return float time_stamp:
221        :return float ref:
222        '''
223        start = time.time()
224        value = DAQC2plate.getADC(self.addr, chan)
225        ref = DAQC2plate.getADC(self.addr, 8)
226        end = time.time()
227        time_stamp = (start + end) / 2
228        return value, time_stamp, ref

This routine returns a single reading of the voltage for the channel.

Returns a tuple of the following 5 objects: V -- float, the measured voltage

time_stamp -- float, the time of the measurement in seconds since
the beginning of the epoch (OS dependent begin time)

ref -- float, the reference voltage (Vdd) collected
simultaneously.
Parameters
  • int chan: the channel number (0, 1, 2, 3, 4, 5, 6, 7, 8). NOTE: channel 8 returns a measurement of Vdd.

  • gain: ignored by board. Defaults to 1.

  • int data_rate: ignored by board.

:returns: V_avg, stdev, stdev_avg, time_stamp, Vdd_avg

Returns

Returns

Returns