From 292ca9c918e42f31ca142df40e8d507caee86e85 Mon Sep 17 00:00:00 2001 From: "Matthias@Dell" Date: Tue, 27 Jun 2023 15:22:48 +0200 Subject: [PATCH 1/7] fixed import --- m_teng/backends/keithley/measure.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/m_teng/backends/keithley/measure.py b/m_teng/backends/keithley/measure.py index 37d0e22..41133ec 100644 --- a/m_teng/backends/keithley/measure.py +++ b/m_teng/backends/keithley/measure.py @@ -3,7 +3,7 @@ import numpy as np from matplotlib import pyplot as plt import pyvisa -from m_teng.backends.keithley import reset +from m_teng.backends.keithley.keithley import reset from m_teng.utility import testing as _testing def measure_count(instr, count=100, interval=0.05, update_func=None, update_interval=0.5, beep_done=True, verbose=True): From 83457661a3ebd00be5037e722068a889d8d49167 Mon Sep 17 00:00:00 2001 From: "Matthias@Dell" Date: Tue, 27 Jun 2023 15:23:48 +0200 Subject: [PATCH 2/7] added udev rule --- 99-usbtmc.rules | 8 ++++++++ readme.md | 7 +++++++ 2 files changed, 15 insertions(+) create mode 100644 99-usbtmc.rules diff --git a/99-usbtmc.rules b/99-usbtmc.rules new file mode 100644 index 0000000..b3ba074 --- /dev/null +++ b/99-usbtmc.rules @@ -0,0 +1,8 @@ +# Rule for Keithley 2611B + +# take vendor and product id from lsusb +SUBSYSTEMS=="usb", ACTION=="add", ATTRS{idVendor}=="05e6", ATTRS{idProduct}=="2614", GROUP="usbtmc", MODE="0660" RUN+="/bin/touch /tmp/05e6-2611-connected" + +# Devices +KERNEL=="usbtmc/*", MODE="0660", GROUP="usbtmc" +KERNEL=="usbtmc[0-9]*", MODE="0660", GROUP="usbtmc" diff --git a/readme.md b/readme.md index e5755ec..f917a4b 100644 --- a/readme.md +++ b/readme.md @@ -37,3 +37,10 @@ ipython -i k_teng_interactive.py -- -*X* Substitute *X* for `-k` for keithley backend, `-a` for arduino backend or `-t` for testing backend. In the shell, run `help()` to get a list of available commands + + +## Installation +### Keithley +On linux: +Install the udev rule in `/etc/udev/rules.d/` and run `sudo udevadm control --reload` to force the usbtmc driver to be used with the Keithley SMU. +The `ATTRS{product_id} ` needs to match the id shown by `lsusb`. From 93f41d8e1ba701f84e3975aa27fff3f03cd72de1 Mon Sep 17 00:00:00 2001 From: "Matthias@Dell" Date: Wed, 28 Jun 2023 10:48:09 +0200 Subject: [PATCH 3/7] change smu --- readme.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/readme.md b/readme.md index f917a4b..da2fd7b 100644 --- a/readme.md +++ b/readme.md @@ -1,5 +1,5 @@ # m-TENG -Helper scripts and shell for measuring **T**ribo**e**lectric **N**ano**g**enerator-based sensor output with a Keithley 2611B SMU or an Arduino +Helper scripts and shell for measuring **T**ribo**e**lectric **N**ano**g**enerator-based sensor output with a Keithley 2600B SMU or an Arduino ## Features @@ -17,9 +17,10 @@ Helper scripts and shell for measuring **T**ribo**e**lectric **N**ano**g**enerat - Run lua script on Keithley SMU - Auto-filenames + ## Available backends ### keithley - Use a Keithley 2611B Source-Measure-Unit via *pyvisa*. This backend allows measuring both voltage and current simultaneously. + Use a Keithley 2600B Source-Measure-Unit via *pyvisa*. This backend allows measuring both voltage and current simultaneously. *Tested with 2611B and 2614B* ### arduino Use a Bluetooth capable Arduino with [https://git.quintern.xyz/MatthiasQuintern/teng-arduino](this software on the arduino). From 73fe34ee04d77ae5ce44d45306daaea96f877571 Mon Sep 17 00:00:00 2001 From: "Matthias@Dell" Date: Sat, 1 Jul 2023 16:58:33 +0200 Subject: [PATCH 4/7] added bep --- m_teng/keithley_scripts/smua_reset.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/m_teng/keithley_scripts/smua_reset.lua b/m_teng/keithley_scripts/smua_reset.lua index 2938651..66a46ac 100644 --- a/m_teng/keithley_scripts/smua_reset.lua +++ b/m_teng/keithley_scripts/smua_reset.lua @@ -2,6 +2,7 @@ smua.reset() smua.measure.autorangev = smua.AUTORANGE_ON smua.measure.autorangei = smua.AUTORANGE_ON +-- smua.measure.autozero = smua.AUTOZERO_AUTO smua.measure.autozero = smua.AUTOZERO_AUTO -- smua.measure.autozero = smua.AUTOZERO_ONCE -- set output to 0A DC From cc01663be2f4727105a90173116a9598dad4271b Mon Sep 17 00:00:00 2001 From: "Matthias@Dell" Date: Sat, 1 Jul 2023 16:59:05 +0200 Subject: [PATCH 5/7] fix keithley beep --- m_teng/m_teng_interactive.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/m_teng/m_teng_interactive.py b/m_teng/m_teng_interactive.py index 863c4e0..4b56d32 100644 --- a/m_teng/m_teng_interactive.py +++ b/m_teng/m_teng_interactive.py @@ -230,7 +230,7 @@ def repeat(measure_func: callable, count: int, repeat_delay=0): sleep(repeat_delay) except KeyboardInterrupt: pass - if settings["beep"]: _backend.beep() + if settings["beep"]: _backend.beep(dev) def get_dataframe(): From a1b21cb26e203e9dde9507c84f39b18c49687f8f Mon Sep 17 00:00:00 2001 From: "Matthias@Dell" Date: Sat, 1 Jul 2023 16:59:54 +0200 Subject: [PATCH 6/7] added beep --- m_teng/backends/keithley/keithley.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/m_teng/backends/keithley/keithley.py b/m_teng/backends/keithley/keithley.py index 84e6831..bc846f8 100644 --- a/m_teng/backends/keithley/keithley.py +++ b/m_teng/backends/keithley/keithley.py @@ -30,6 +30,8 @@ def init(beep_success=True): if beep_success: keithley.write("beeper.beep(0.5, 1000)") return keithley +def beep(instr, length=0.5, pitch=1000): + instr.write(f"beeper.beep({length}, {pitch})") def exit(instr): instr.close() From 095ee19722706c13f9d3d0160b3547b24d4979d8 Mon Sep 17 00:00:00 2001 From: "Matthias@Dell" Date: Sat, 1 Jul 2023 17:01:09 +0200 Subject: [PATCH 7/7] start add plot --- m_teng/utility/data.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/m_teng/utility/data.py b/m_teng/utility/data.py index 1980429..6ba5eda 100644 --- a/m_teng/utility/data.py +++ b/m_teng/utility/data.py @@ -1,6 +1,7 @@ import pandas as pd import numpy as np from os import path +import matplotlib.pyplot def buffer2dataframe(buffer): df = pd.DataFrame(buffer) @@ -30,3 +31,23 @@ def load_dataframe(p:str): else: df = pd.read_pickle(p) return df + + +def plot(data): + if type(data) == str: + data = load_dataframe(data) + if type(data) == pd.Dataframe: + data = data.to_numpy() + fig1, (vax, iax) = plt.subplots(2, 1, figsize=(8, 5)) + # todo + + + vline, = vax.plot(index, vdata, color="m") + vax.set_ylabel("Voltage [V]") + vax.grid(True) + + vax.plot() + + iline, = iax.plot(index, idata, color="m") + iax.set_ylabel("Current [A]") + iax.grid(True)