Added the capacitance reading device (based on TSSOP16, paired with an Arduino Nano V3, communication over serial) to the PSI NMR setup
This commit is contained in:
20
frappy_psi/capacitance_readings/TSSOP16.py
Normal file
20
frappy_psi/capacitance_readings/TSSOP16.py
Normal file
@@ -0,0 +1,20 @@
|
||||
import serial
|
||||
|
||||
from frappy.core import Readable, Parameter, FloatRange, HasIO, StringIO, Property, IntRange, IDLE, BUSY, WARN, ERROR, Drivable, BoolType, Attached
|
||||
|
||||
class TSSOP16_IO(StringIO):
|
||||
end_of_line = '\r'
|
||||
identification = [ ('*IDN?', r'0x48,ACM1219,.*') ]
|
||||
|
||||
class TSSOP16(HasIO, Readable):
|
||||
'''only configured for channel 1'''
|
||||
|
||||
ioClass = TSSOP16_IO
|
||||
value = Parameter('capacitance', FloatRange(unit='pF'), readonly=True)
|
||||
pollinterval = Parameter(default=0.1)
|
||||
|
||||
def read_value(self):
|
||||
l = self.communicate('readCVT')
|
||||
vals = l.split(',')
|
||||
vals = [ float(v) for v in vals ]
|
||||
return vals[0]
|
||||
Reference in New Issue
Block a user