From dc581bfcce0d8eea48a7b9cfcbd4c3c834030cb7 Mon Sep 17 00:00:00 2001
From: Berk Silemek <berk.silemek@gmail.com>
Date: Mon, 9 Jan 2023 12:32:10 +0000
Subject: [PATCH] Update Measurement-Devices/Keithley/readme.md

---
 Measurement-Devices/Keithley/readme.md | 24 ++++++++++++++++++++----
 1 file changed, 20 insertions(+), 4 deletions(-)

diff --git a/Measurement-Devices/Keithley/readme.md b/Measurement-Devices/Keithley/readme.md
index 9e59f55..0bc5d64 100644
--- a/Measurement-Devices/Keithley/readme.md
+++ b/Measurement-Devices/Keithley/readme.md
@@ -2,12 +2,28 @@
 
 This folder contains two Python scripts that has been used for thermistor measurements with the Keithley2000 digital multimeter. 
 
-The script **Keithley_Interface_25Hz.py** reads resistance value from the multimeter and saves the to a text file using the system timestamps. The calculated temperature value is calculated and saved as well. Note that this temperature calculation is thermistor specific. Please revisit thermistor parameters for a different product.
+The script **Keithley_Interface_25Hz.py** reads resistance value from the multimeter and saves the to a text file using the system timestamps. The calculated temperature value is calculated and saved as well. Note the following temperature calculation is thermistor (i.e. *beta* value) specific. Please revisit thermistor parameters for a different product.
 
-You can run the script via a terminal or with ide. The measurement parameters of the multimeter were adjusted manually. Therefore, the device must be taken to the resistance measurement manually. The filter and averaging in the device were disabled for faster operations. The LCD is turned off by the script. You can enable it later.
+```python
+def rThermistor(rt):
+    temperature = 1/((1/T0) + ((1/beta) * (math.log(rt/R0))))-(273.15); #Calculate temperature in Celsius using on Stainhart - Hart Equation [1]  
+    return temperature
 
-The serial connection is adjusted to 19200 baudrate. The multimeter should also be adjusted to the same baudrate. In addition, the serial connection port is not automatically adjusted. You should determine the USB port manually and change it in script.
+[1] Steinhart JS, Hart SR. Calibration curves for thermistors. Deep Sea Res Oceanogr Abstr. 1968;15(4):497-503. doi:10.1016/0011-7471(68)90057-0
+```
 
-The timing settings are about the limits of the Keithley2000 in this NPLC settings. The device may give errors, beeps, and sends some incorrect data. Not all of them are handled. You can decrease the reading rate by changing the ‘rate’ parameter. About 13-15Hz is usually ok, when LCD is open and NPLC is in default mode.
+You can run the script via a terminal or with ide. The measurement parameters of the multimeter were adjusted manually. Therefore, the device must be taken to the resistance measurement manually. The filter and averaging in the device were disabled for faster operations. The LCD is turned off by the script: 
+```python 
+serialDev.write("display:enable 0"+'\r\n') 
+```  
+You can enable the LCD. However, the timing settings are about the limits of the Keithley2000 in this NPLC settings. The device may give errors, beeps, and sends some incorrect data. Not all of them are handled. You can decrease the reading rate by changing the *rate* parameter. About 13-15Hz is usually ok, when LCD is open and NPLC is in default mode.
+
+The serial connection is adjusted to 19200 baudrate. The multimeter should also be adjusted to the same baudrate. In addition, the serial connection port is not automatically adjusted. You should determine the USB port manually and change it in script:
+
+```python
+serialDev = serial.Serial(port = '/dev/ttyUSB0',baudrate=19200,parity=serial.PARITY_NONE,stopbits=serial.STOPBITS_ONE,bytesize=serial.EIGHTBITS)
+```
+
+Please note that the RS-232 interface is [Null modem](https://en.wikipedia.org/wiki/Null_modem "see in Wikipedia").  
 
 The other script **Plot_Keithley_v3.py** plots the data for every 3 seconds. The matplotlib backend is adjusted to Tkagg for Linux compatibility. It should also work in Windows. Other backends like Qt can be realized as well.
-- 
GitLab