diff --git a/config.py b/config.py
index 2029a9ded78c8f80527d216d1236acb6b83de16e..5b0febb24a9321493317707013324975f925ec32 100644
--- a/config.py
+++ b/config.py
@@ -1,3 +1,5 @@
+import logging
+
 from paho.mqtt.client import MQTTv31
 
 # OhmPi configuration
@@ -21,8 +23,8 @@ CONTROL_CONFIG = {
 }
 # Execution logging configuration
 EXEC_LOGGING_CONFIG = {
-    'debug_mode': True,
-    'logging_to_console': False,
+    'logging_level': logging.DEBUG,
+    'logging_to_console': True,
     'file_name': 'ohmpi_log',
     'max_bytes': 262144,
     'backup_count': 30,
@@ -32,6 +34,8 @@ EXEC_LOGGING_CONFIG = {
 
 # Data logging configuration
 DATA_LOGGING_CONFIG = {
+    'logging_level': logging.INFO,
+    'logging_to_console': True,
     'file_name': 'data_log',
     'logging_to_console': False,
     'max_bytes': 16777216,
diff --git a/doc/source/Ohmpi_V2_00/step_n_3/a/MUX_07.jpg b/doc/source/Ohmpi_V2_00/step_n_3/a/MUX_07.jpg
index 1086d5ab36c451047701fb728d9e5f1fc37f7af8..d09ee226f2097e9dd81b9975e997b09a5a53f466 100644
Binary files a/doc/source/Ohmpi_V2_00/step_n_3/a/MUX_07.jpg and b/doc/source/Ohmpi_V2_00/step_n_3/a/MUX_07.jpg differ
diff --git a/index.html b/index.html
index 822a63843b63062a5e2cfb6045ce7376b333ed55..699fc92488cf2881dd71062c3d69f291010e4755 100644
--- a/index.html
+++ b/index.html
@@ -107,7 +107,13 @@
                             <div class="col-sm-10">
                               <input type="file" class="form-control" id="sequence">
                             </div>
-                          </div>           
+                          </div>
+                          <div class="form-group row">
+                            <label for="elecSpacing" class="col-sm-2 col-form-label">Electrode spacing [m]</label>
+                            <div class="col-sm-10">
+                              <input type="number" class="form-control" id="elecSpacing", value="1">
+                            </div>
+                          </div>
                       </form>
                 </div>
                 <div class="modal-footer">
diff --git a/logging_setup.py b/logging_setup.py
index 8ca053992e1446afb5c42b8e0584710903187f5e..0aa20ccf8c8d6f42940e6d3e4e72a0606cfa57ee 100644
--- a/logging_setup.py
+++ b/logging_setup.py
@@ -5,6 +5,7 @@ from time import gmtime
 import logging
 from mqtt_logger import MQTTHandler
 from compressed_sized_timed_rotating_logger import CompressedSizedTimedRotatingFileHandler
+import sys
 
 
 def setup_loggers(mqtt=True):
@@ -26,13 +27,6 @@ def setup_loggers(mqtt=True):
     data_log_filename = path.join(data_path, 'data_log')
     data_logger = logging.getLogger('data_logger')
 
-    # Debug and logging
-    debug = EXEC_LOGGING_CONFIG['debug_mode']
-    if debug:
-        logging_level = logging.DEBUG
-    else:
-        logging_level = logging.INFO
-
     # Set message logging format and level
     log_format = '%(asctime)-15s | %(process)d | %(levelname)s: %(message)s'
     logging_to_console = EXEC_LOGGING_CONFIG['logging_to_console']
@@ -46,10 +40,14 @@ def setup_loggers(mqtt=True):
     exec_formatter.datefmt = '%Y/%m/%d %H:%M:%S UTC'
     exec_handler.setFormatter(exec_formatter)
     exec_logger.addHandler(exec_handler)
-    exec_logger.setLevel(logging_level)
+    exec_logger.setLevel(MQTT_LOGGING_CONFIG['logging_level'])
 
     if logging_to_console:
-        exec_logger.addHandler(logging.StreamHandler())
+        console_exec_handler = logging.StreamHandler(sys.stdout)
+        console_exec_handler.setLevel(MQTT_LOGGING_CONFIG['logging_level'])
+        console_exec_handler.setFormatter(exec_formatter)
+        exec_logger.addHandler(console_exec_handler)
+
     if mqtt:
         mqtt_settings = MQTT_LOGGING_CONFIG.copy()
         [mqtt_settings.pop(i) for i in ['client_id', 'exec_topic', 'data_topic', 'soh_topic']]
diff --git a/mqtt_controller.py b/mqtt_controller.py
index 13b6a086ee8bdc9408288617a27ebb97fe8cc490..df30e2a045c29bded19790a1ec5872722748c20d 100644
--- a/mqtt_controller.py
+++ b/mqtt_controller.py
@@ -31,6 +31,11 @@ cmd_id = uuid.uuid4().hex
 payload = json.dumps({'cmd_id': cmd_id, 'cmd': 'set_sequence', 'args': sequence})
 print(f'Set sequence message: {payload} to {publisher_config["topic"]} with config {publisher_config}')
 publish.single(payload=payload, **publisher_config)
+cmd_id = uuid.uuid4().hex
+payload = json.dumps({'cmd_id': cmd_id, 'cmd': 'rs_check'})
+print(f'Run rs_check: {payload} to {publisher_config["topic"]} with config {publisher_config}')
+publish.single(payload=payload, **publisher_config)
+
 for i in range(4):
     cmd_id = uuid.uuid4().hex
     payload = json.dumps({'cmd_id': cmd_id, 'cmd': 'start'})
diff --git a/ohmpi.py b/ohmpi.py
index bddcfae9b89af51f44ec6bcd8045104f6e9fa491..152e12fac3b90c2ec0ab2e8264d7704af12cdef7 100644
--- a/ohmpi.py
+++ b/ohmpi.py
@@ -66,8 +66,6 @@ class OhmPi(object):
         self.run = False  # flag is True when measuring
         self.thread = None  # contains the handle for the thread taking the measurement
         # self.path = 'data/'  # where to save the .csv
-        #self.cmd_thread = threading.Thread(
-        #    target=self.process_commands)  # thread handling commands received on tcp port
 
         # set loggers
         config_exec_logger, _, config_data_logger, _, _ = setup_loggers(mqtt=mqtt)  # TODO: add SOH
@@ -572,19 +570,17 @@ class OhmPi(object):
             # measure current and voltage
             current = AnalogIn(self.ads_current, ads.P0).voltage / (50 * self.r_shunt)
             voltage = -AnalogIn(self.ads_voltage, ads.P0, ads.P1).voltage * 2.5
-            resistance = voltage / current
-
             # compute resistance measured (= contact resistance)
-            resist = abs(resistance / 1000)
-            msg = 'Contact resistance {:s}: {:.3f} kOhm'.format(
-                str(quad), resist)
+            resistance = np.abs(voltage / current)
+            msg = f'Contact resistance {str(quad):s}: I: {current * 1000.:>10.3f} mA, V: {voltage * 1000.:>10.3f} mV, ' \
+                  f'R: {resistance /1000.:>10.3f} kOhm'
+
             print(msg)
             self.exec_logger.debug(msg)
 
             # if contact resistance = 0 -> we have a short circuit!!
-            if resist < 1e-5:
-                msg = '!!!SHORT CIRCUIT!!! {:s}: {:.3f} kOhm'.format(
-                    str(quad), resist)
+            if resistance < 1e-2:
+                msg = f'!!!SHORT CIRCUIT!!! {str(quad):s}: {resistance / 1000.:.3f} kOhm'
                 self.exec_logger.warning(msg)
                 print(msg)
 
@@ -592,7 +588,7 @@ class OhmPi(object):
             self.append_and_save(export_path_rs, {
                 'A': quad[0],
                 'B': quad[1],
-                'RS [kOhm]': resist,
+                'RS [kOhm]': resistance / 1000.,
             })
 
             # close mux path and put pin back to GND
diff --git a/run.sh b/run.sh
index 76b58dca433be66edff7bd1c39cb4323939ede9a..f0886f0aa8512771cecf32c7a5c4667f05e0e75c 100644
--- a/run.sh
+++ b/run.sh
@@ -1,2 +1,4 @@
+#!bin/bash
+
 source ./ohmpy/bin/activate
 python webserver.py
diff --git a/runOnStart.sh b/runOnStart.sh
deleted file mode 100755
index 801ecbaa9986b26597ce0e4facb98326cf3e5225..0000000000000000000000000000000000000000
--- a/runOnStart.sh
+++ /dev/null
@@ -1,2 +0,0 @@
-echo "# start OhmPi web interface" >> $HOME/.bashrc
-echo "(cd $HOME/OhmPi; ./run.sh)" >> $HOME/.bashrc
diff --git a/runOnStart.txt b/runOnStart.txt
new file mode 100755
index 0000000000000000000000000000000000000000..7485654252054b9fbff35fa403af4b7f4b494e98
--- /dev/null
+++ b/runOnStart.txt
@@ -0,0 +1,6 @@
+# to automatically start the webserver on start, you need to place the
+# following line just before the line with 'exit 0' in the /etc/rc.local.
+
+(cd /home/jkl/OhmPi; bash run.sh > startup.log) &
+
+
diff --git a/webserver.py b/webserver.py
index ca7f593acc1be88d1a3c0c0dfa9cf61748e2f1be..dabf2130bd238c6ff70a84df501505c932a98c61 100644
--- a/webserver.py
+++ b/webserver.py
@@ -1,31 +1,30 @@
 from http.server import SimpleHTTPRequestHandler, HTTPServer
-# import time
+import time
 import os
 import json
 from ohmpi import OhmPi
-# import threading
+import threading
 import pandas as pd
 import shutil
 
-hostName = "raspberrypi.local"  # works for AP-STA
-# hostName = "192.168.50.1"  # fixed IP in AP-STA mode
-# hostName = "0.0.0.0"  # for AP mode (not AP-STA)
+#hostName = "raspberrypi.local" # works for AP-STA
+#hostName = "192.168.50.1"  # fixed IP in AP-STA mode
+hostName = "0.0.0.0"  # for AP mode (not AP-STA)
 serverPort = 8080
 
 # https://gist.github.com/MichaelCurrie/19394abc19abd0de4473b595c0e37a3a
 
 with open('ohmpi_param.json') as json_file:
-    settings = json.load(json_file)
+    pardict = json.load(json_file)
 
-ohmpi = OhmPi(settings, sequence='breadboard.txt')
-
-# ohmpi = OhmPi(settings, sequence='dd16s0no8.txt')
+ohmpi = OhmPi(pardict, sequence='dd.txt')
+#ohmpi = OhmPi(pardict, sequence='dd16s0no8.txt')
 
 
 class MyServer(SimpleHTTPRequestHandler):
     # because we use SimpleHTTPRequestHandler, we do not need to implement
     # the do_GET() method (if we use the BaseHTTPRequestHandler, we would need to)
-
+   
     # def do_GET(self):
     #     # normal get for wepages (not so secure!)
     #     print(self.command)
@@ -36,7 +35,7 @@ class MyServer(SimpleHTTPRequestHandler):
     #     self.end_headers()
     #     with open(os.path.join('.', self.path[1:]), 'r') as f:
     #         self.wfile.write(bytes(f.read(), "utf-8"))
-
+        
     def do_POST(self):
         global ohmpiThread, status, run
         dic = json.loads(self.rfile.read(int(self.headers['Content-Length'])))
@@ -50,9 +49,9 @@ class MyServer(SimpleHTTPRequestHandler):
             fnames = [fname for fname in os.listdir('data/') if fname[-4:] == '.csv']
             ddic = {}
             for fname in fnames:
-                if (fname.replace('.csv', '') not in dic['surveyNames']
-                        and fname != 'readme.txt'
-                        and '_rs' not in fname):
+                if (fname.replace('.csv', '') not in dic['surveyNames'] 
+                    and fname != 'readme.txt'
+                    and '_rs' not in fname):
                     df = pd.read_csv('data/' + fname)
                     ddic[fname.replace('.csv', '')] = {
                         'a': df['A'].tolist(),
@@ -68,17 +67,17 @@ class MyServer(SimpleHTTPRequestHandler):
         elif dic['command'] == 'setConfig':
             ohmpi.stop()
             cdic = dic['config']
-            ohmpi.settings['nb_electrodes'] = int(cdic['nbElectrodes'])
-            ohmpi.settings['injection_duration'] = float(cdic['injectionDuration'])
-            ohmpi.settings['nbr_meas'] = int(cdic['nbMeasurements'])
-            ohmpi.settings['nb_stack'] = int(cdic['nbStack'])
-            ohmpi.settings['sequence_delay'] = int(cdic['sequenceDelay'])
+            ohmpi.pardict['nb_electrodes'] = int(cdic['nbElectrodes'])
+            ohmpi.pardict['injection_duration'] = float(cdic['injectionDuration'])
+            ohmpi.pardict['nbr_meas'] = int(cdic['nbMeasurements'])
+            ohmpi.pardict['nb_stack'] = int(cdic['nbStack'])
+            ohmpi.pardict['sequence_delay'] = int(cdic['sequenceDelay'])
             if cdic['sequence'] != '':
                 with open('sequence.txt', 'w') as f:
                     f.write(cdic['sequence'])
                 ohmpi.read_quad('sequence.txt')
                 print('new sequence set.')
-            print('setConfig', ohmpi.settings)
+            print('setConfig', ohmpi.pardict)
         elif dic['command'] == 'invert':
             pass
         elif dic['command'] == 'getResults':
@@ -103,7 +102,7 @@ class MyServer(SimpleHTTPRequestHandler):
         else:
             # command not found
             rdic['response'] = 'command not found'
-
+        
         rdic['status'] = ohmpi.status
         self.send_response(200)
         self.send_header('Content-Type', 'text/json')
@@ -111,7 +110,7 @@ class MyServer(SimpleHTTPRequestHandler):
         self.wfile.write(bytes(json.dumps(rdic), 'utf8'))
 
 
-if __name__ == "__main__":
+if __name__ == "__main__":        
     webServer = HTTPServer((hostName, serverPort), MyServer)
     print("Server started http://%s:%s" % (hostName, serverPort))