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:
@@ -1,19 +1,34 @@
|
|||||||
import frappy.core as fc
|
import frappy.core as fc
|
||||||
|
|
||||||
|
enabled_modules = [ 'TNMR', 'Razorbill', 'Capacitance', 'NetAnalyser' ] # default
|
||||||
|
#enabled_modules = [ 'Capacitance' ]
|
||||||
|
|
||||||
Node('uniaxial_nmr.psi.ch',
|
Node('uniaxial_nmr.psi.ch',
|
||||||
'The NMR system running the Scout and controlled with TNMR. Also contains a uniaxial cell (Razorbill RP100), and a network analyser (ZVL)',
|
'The NMR system running the Scout and controlled with TNMR. Also contains a uniaxial cell (Razorbill RP100), a network analyser (ZVL), and a capacitance reader (for more direct measurements of the strain cell\'s status) (TSSOP16 with Arduino Nano V3)',
|
||||||
interface='tcp://5000')
|
interface='tcp://5000')
|
||||||
|
|
||||||
# TNMR
|
# TNMR
|
||||||
#Mod('tnmr_otf_module', 'frappy_psi.tnmr.OTFModule.ProgrammedSequence', 'NMR Sequence')
|
if('TNMR' in enabled_modules):
|
||||||
|
Mod('tnmr_otf_module', 'frappy_psi.tnmr.OTFModule.ProgrammedSequence', 'NMR Sequence')
|
||||||
|
|
||||||
# Razorbill RP100
|
# Razorbill RP100
|
||||||
Mod('io1',
|
if('Razorbill' in enabled_modules):
|
||||||
'frappy_psi.uniaxial_cell.RP100.RP100IO',
|
Mod('io_razorbill',
|
||||||
'communication',
|
'frappy_psi.uniaxial_cell.RP100.RP100IO',
|
||||||
uri='serial://COM10?baudrate=9600+bytesize=8+parity=none+stopbits=1')
|
'communication',
|
||||||
Mod('RP100Node_CH1', 'frappy_psi.uniaxial_cell.RP100.VoltageChannel', 'Razorbill RP100 PSU (CH1)', channel=1, io='io1')
|
uri='serial://COM10?baudrate=9600+bytesize=8+parity=none+stopbits=1')
|
||||||
Mod('RP100Node_CH2', 'frappy_psi.uniaxial_cell.RP100.VoltageChannel', 'Razorbill RP100 PSU (CH2)', channel=2, io='io1')
|
Mod('RP100Node_CH1', 'frappy_psi.uniaxial_cell.RP100.VoltageChannel', 'Razorbill RP100 PSU (CH1)', channel=1, io='io_razorbill')
|
||||||
|
Mod('RP100Node_CH2', 'frappy_psi.uniaxial_cell.RP100.VoltageChannel', 'Razorbill RP100 PSU (CH2)', channel=2, io='io_razorbill')
|
||||||
|
|
||||||
|
# Capacitance readings (TSSOP16 with Arduino Nano V3)
|
||||||
|
if('Capacitance' in enabled_modules):
|
||||||
|
Mod('io_capacitance',
|
||||||
|
'frappy_psi.capacitance_readings.TSSOP16.TSSOP16_IO',
|
||||||
|
'communication',
|
||||||
|
uri='serial://COM11?baudrate=9600+bytesize=8+parity=none+stopbits=1')
|
||||||
|
|
||||||
|
Mod('TSSOP16', 'frappy_psi.capacitance_readings.TSSOP16.TSSOP16', 'Capacitance-reading Arduino (with TSSOP16)', io='io_capacitance')
|
||||||
|
|
||||||
# ZVL Network Analyser
|
# ZVL Network Analyser
|
||||||
#Mod('ZVLNode', 'frappy_psi.network_analysers.ZVL.ZVLNode.ZVLNode', 'ZVL Network Analyser', analyser_ip=Param('169.254.150.182')) # must be connected on the same ethernet network
|
if('NetAnalyser' in enabled_modules):
|
||||||
|
Mod('ZVLNode', 'frappy_psi.network_analysers.ZVL.ZVLNode.ZVLNode', 'ZVL Network Analyser', analyser_ip=Param('169.254.150.182')) # must be connected on the same ethernet network
|
||||||
11
cfg/tssop16_cfg.py
Normal file
11
cfg/tssop16_cfg.py
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
import frappy.core as fc
|
||||||
|
import serial
|
||||||
|
|
||||||
|
Node('example_TSSOP16.psi.ch', 'A demo system showing how to connect the TSSOP16 Arduino', interface='tcp://5000')
|
||||||
|
|
||||||
|
Mod('io1',
|
||||||
|
'frappy_psi.capacitance_readings.TSSOP16.TSSOP16_IO',
|
||||||
|
'communication',
|
||||||
|
uri='serial://COM11?baudrate=9600+bytesize=8+parity=none+stopbits=1')
|
||||||
|
|
||||||
|
Mod('TSSOP16', 'frappy_psi.capacitance_readings.TSSOP16.TSSOP16', 'Capacitance-reading Arduino (with TSSOP16)', io='io1')
|
||||||
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]
|
||||||
@@ -232,6 +232,7 @@ class ProgrammedSequence(fc.Readable):
|
|||||||
filename = filepath + '/sequences/' + filename.replace('.','')
|
filename = filepath + '/sequences/' + filename.replace('.','')
|
||||||
seq_gen.save_sequence(filename, seq)
|
seq_gen.save_sequence(filename, seq)
|
||||||
seq_gen.save_sequence_cfg(filename, seq)
|
seq_gen.save_sequence_cfg(filename, seq)
|
||||||
|
print(filename)
|
||||||
|
|
||||||
dashboard_params = { 'Observe Freq.': self.read_obs_freq(),
|
dashboard_params = { 'Observe Freq.': self.read_obs_freq(),
|
||||||
'Scans 1D': self.read_num_scans(),
|
'Scans 1D': self.read_num_scans(),
|
||||||
@@ -247,6 +248,7 @@ class ProgrammedSequence(fc.Readable):
|
|||||||
|
|
||||||
# then, load the thing into TNMR
|
# then, load the thing into TNMR
|
||||||
self.tnmr().load_sequence(filename)
|
self.tnmr().load_sequence(filename)
|
||||||
|
print(filename)
|
||||||
|
|
||||||
# load some parameters back to TNMR
|
# load some parameters back to TNMR
|
||||||
for key, val in dashboard_params.items():
|
for key, val in dashboard_params.items():
|
||||||
|
|||||||
Reference in New Issue
Block a user