diff --git a/.gitignore b/.gitignore
index 09fd4bd1565c359a0e9ae8966a57b474153c023a..8c469515e45529e882055554f060660fb1f3babf 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
 data/*.csv
 **/.ipynb_notebooks/**
 data.zip
+__pycache__
diff --git a/Ohmpi.py b/Ohmpi.py
index df36b9266f95eb0177053f28699abb0097205868..c0fe2fdae2ed16ec11ebb6ec1c7296e48b1b603e 100644
--- a/Ohmpi.py
+++ b/Ohmpi.py
@@ -24,19 +24,23 @@ import pandas as pd
 import time
 from datetime import datetime
 from termcolor import colored
+import threading
 
-"""
-import board, busio,adafruit_tca9548a
-import adafruit_ads1x15.ads1115 as ADS
-from adafruit_ads1x15.analog_in import AnalogIn
-from adafruit_mcp230xx.mcp23008 import MCP23008
-from adafruit_mcp230xx.mcp23017 import MCP23017
-import digitalio
-from digitalio import Direction
-from gpiozero import CPUTemperature
-"""
 current_time = datetime.now()
 print(current_time.strftime("%Y-%m-%d %H:%M:%S"))
+
+onpi = False  # set to True if running on raspberrypi
+
+if onpi:
+  import board, busio,adafruit_tca9548a
+  import adafruit_ads1x15.ads1115 as ADS
+  from adafruit_ads1x15.analog_in import AnalogIn
+  from adafruit_mcp230xx.mcp23008 import MCP23008
+  from adafruit_mcp230xx.mcp23017 import MCP23017
+  import digitalio
+  from digitalio import Direction
+  from gpiozero import CPUTemperature
+
 """
 Hardware parameters
 """
@@ -58,181 +62,181 @@ Import parameters
 #with open('ohmpi_param.json') as json_file:
 #    pardict = json.load(json_file)
 
-"""
-i2c = busio.I2C(board.SCL, board.SDA) #activation du protocle I2C
-mcp = MCP23008(i2c, address=0x20) #connexion I2C MCP23008, injection de courant
-ads_current = ADS.ADS1115(i2c, gain=16,data_rate=860, address=0X48)# connexion ADS1115, pour la mesure de courant
-ads_voltage = ADS.ADS1115(i2c, gain=2/3,data_rate=860, address=0X49)# connexion ADS1115, pour la mesure de courant
-#initialisation desvoie pour la polarité
-pin0 = mcp.get_pin(0)
-pin0.direction = Direction.OUTPUT
-pin1 = mcp.get_pin(1)
-pin1.direction = Direction.OUTPUT
-pin0.value = False
-pin1.value = False
-
-
-# Initialisation MUX
-Elec_A= adafruit_tca9548a.TCA9548A(i2c, 0X76)
-Elec_B= adafruit_tca9548a.TCA9548A(i2c, 0X71)
-Elec_M= adafruit_tca9548a.TCA9548A(i2c, 0X74)
-Elec_N= adafruit_tca9548a.TCA9548A(i2c, 0X70)
-"""    
+if onpi:
+  i2c = busio.I2C(board.SCL, board.SDA) #activation du protocle I2C
+  mcp = MCP23008(i2c, address=0x20) #connexion I2C MCP23008, injection de courant
+  ads_current = ADS.ADS1115(i2c, gain=16,data_rate=860, address=0X48)# connexion ADS1115, pour la mesure de courant
+  ads_voltage = ADS.ADS1115(i2c, gain=2/3,data_rate=860, address=0X49)# connexion ADS1115, pour la mesure de courant
+  #initialisation desvoie pour la polarité
+  pin0 = mcp.get_pin(0)
+  pin0.direction = Direction.OUTPUT
+  pin1 = mcp.get_pin(1)
+  pin1.direction = Direction.OUTPUT
+  pin0.value = False
+  pin1.value = False
 
 
-"""
-functions
-"""
-"""
-# function swtich_mux select the right channels for the multiplexer cascade for electrodes A, B, M and N.
-def switch_mux_on(quadripole):
-    elec_adress=[0x76,0X71,0x74,0x70]
-      
-    for i in range(0,4):
-        tca= adafruit_tca9548a.TCA9548A(i2c, elec_adress[i]) #choose MUX A B M or N
+  # Initialisation MUX
+  Elec_A= adafruit_tca9548a.TCA9548A(i2c, 0X76)
+  Elec_B= adafruit_tca9548a.TCA9548A(i2c, 0X71)
+  Elec_M= adafruit_tca9548a.TCA9548A(i2c, 0X74)
+  Elec_N= adafruit_tca9548a.TCA9548A(i2c, 0X70)
+
+
+
+  """
+  functions
+  """
+
+  # function swtich_mux select the right channels for the multiplexer cascade for electrodes A, B, M and N.
+  def switch_mux_on(quadripole):
+      elec_adress=[0x76,0X71,0x74,0x70]
         
-        if quadripole[i] < 17:
-            nb_i2C=7
-            a=quadripole[i]
-        elif quadripole[i] > 16 and quadripole[i] < 33:    
-            nb_i2C=6
-            a=quadripole[i]-16
-        elif quadripole[i] > 32 and quadripole[i] < 49:    
-            nb_i2C=5
-            a=quadripole[i]-32
-        elif quadripole[i] > 48 and quadripole[i] < 65:    
-            nb_i2C=4
-            a=quadripole[i]-48
-              
-        mcp2 = MCP23017(tca[nb_i2C])     
-        mcp2.get_pin(a-1).direction=digitalio.Direction.OUTPUT
-        mcp2.get_pin(a-1).value=True
- 
-def switch_mux_off(quadripole):
-    elec_adress=[0x76,0X71,0x74,0x70]
-      
-    for i in range(0,4):
-        tca= adafruit_tca9548a.TCA9548A(i2c, elec_adress[i]) #choose MUX A B M or N
+      for i in range(0,4):
+          tca= adafruit_tca9548a.TCA9548A(i2c, elec_adress[i]) #choose MUX A B M or N
+          
+          if quadripole[i] < 17:
+              nb_i2C=7
+              a=quadripole[i]
+          elif quadripole[i] > 16 and quadripole[i] < 33:    
+              nb_i2C=6
+              a=quadripole[i]-16
+          elif quadripole[i] > 32 and quadripole[i] < 49:    
+              nb_i2C=5
+              a=quadripole[i]-32
+          elif quadripole[i] > 48 and quadripole[i] < 65:    
+              nb_i2C=4
+              a=quadripole[i]-48
+                
+          mcp2 = MCP23017(tca[nb_i2C])     
+          mcp2.get_pin(a-1).direction=digitalio.Direction.OUTPUT
+          mcp2.get_pin(a-1).value=True
+   
+  def switch_mux_off(quadripole):
+      elec_adress=[0x76,0X71,0x74,0x70]
         
-        if quadripole[i] < 17:
-            nb_i2C=7
-            a=quadripole[i]
-        elif quadripole[i] > 16 and quadripole[i] < 33:    
-            nb_i2C=6
-            a=quadripole[i]-16
-        elif quadripole[i] > 32 and quadripole[i] < 49:    
-            nb_i2C=5
-            a=quadripole[i]-32
-        elif quadripole[i] > 48 and quadripole[i] < 65:    
-            nb_i2C=4
-            a=quadripole[i]-48
-              
-        mcp2 = MCP23017(tca[nb_i2C])     
-        mcp2.get_pin(a-1).direction=digitalio.Direction.OUTPUT
-        mcp2.get_pin(a-1).value=False
-       
+      for i in range(0,4):
+          tca= adafruit_tca9548a.TCA9548A(i2c, elec_adress[i]) #choose MUX A B M or N
+          
+          if quadripole[i] < 17:
+              nb_i2C=7
+              a=quadripole[i]
+          elif quadripole[i] > 16 and quadripole[i] < 33:    
+              nb_i2C=6
+              a=quadripole[i]-16
+          elif quadripole[i] > 32 and quadripole[i] < 49:    
+              nb_i2C=5
+              a=quadripole[i]-32
+          elif quadripole[i] > 48 and quadripole[i] < 65:    
+              nb_i2C=4
+              a=quadripole[i]-48
+                
+          mcp2 = MCP23017(tca[nb_i2C])     
+          mcp2.get_pin(a-1).direction=digitalio.Direction.OUTPUT
+          mcp2.get_pin(a-1).value=False
+         
+
+  #function to switch  off mux
+  def ZERO_mux(nb_elec):
+      elec_adress=[0x76,0X71,0x74,0x70]
+      for i in range(0,4):
+          tca= adafruit_tca9548a.TCA9548A(i2c, elec_adress[i]) #choose MUX A B M or N
+          for y in range(0,nb_elec):
+              qd=y+1
+              if qd < 17:
+                  nb_i2C=7
+                  a=qd
+              elif qd > 16 and qd < 33:    
+                  nb_i2C=6
+                  a=qd-16
+              elif qd > 32 and qd < 49:    
+                  nb_i2C=5
+                  a=qd-32
+              elif qd > 48 and qd < 65:    
+                  nb_i2C=4
+                  a=qd-48
+                    
+              mcp2 = MCP23017(tca[nb_i2C])     
+              mcp2.get_pin(a-1).direction=digitalio.Direction.OUTPUT
+              mcp2.get_pin(a-1).value= False
 
-#function to switch  off mux
-def ZERO_mux(nb_elec):
-    elec_adress=[0x76,0X71,0x74,0x70]
-    for i in range(0,4):
-        tca= adafruit_tca9548a.TCA9548A(i2c, elec_adress[i]) #choose MUX A B M or N
-        for y in range(0,nb_elec):
-            qd=y+1
-            if qd < 17:
-                nb_i2C=7
-                a=qd
-            elif qd > 16 and qd < 33:    
-                nb_i2C=6
-                a=qd-16
-            elif qd > 32 and qd < 49:    
-                nb_i2C=5
-                a=qd-32
-            elif qd > 48 and qd < 65:    
-                nb_i2C=4
-                a=qd-48
-                  
-            mcp2 = MCP23017(tca[nb_i2C])     
-            mcp2.get_pin(a-1).direction=digitalio.Direction.OUTPUT
-            mcp2.get_pin(a-1).value= False
-
-
-def run_measurement(nb_stack, injection_deltat, R_shunt, coefp2, coefp3, elec_array):
-    start_time=time.time()
-    # inner variable initialization
-    sum_I=0
-    sum_Vmn=0
-    sum_Ps=0
-    # injection courant and measure
-    mcp = MCP23008(i2c, address=0x20)
-    pin0 = mcp.get_pin(0)
-    pin0.direction = Direction.OUTPUT
-    pin1 = mcp.get_pin(1)
-    pin1.direction = Direction.OUTPUT
-    pin0.value = False
-    pin1.value = False
-    for n in range(0,3+2*nb_stack-1) :        
-        # current injection
-        
-        if (n % 2) == 0:
-            
-            pin1.value = True
-            pin0.value = False # current injection polarity n°1        
-        else:
-            pin0.value = True
-            pin1.value = False# injection de courant polarity n°2
-        start_delay=time.time()
-        time.sleep(injection_deltat) # delay depending on current injection duration
 
+  def run_measurement(nb_stack, injection_deltat, R_shunt, coefp2, coefp3, elec_array):
+      start_time=time.time()
+      # inner variable initialization
+      sum_I=0
+      sum_Vmn=0
+      sum_Ps=0
+      # injection courant and measure
+      mcp = MCP23008(i2c, address=0x20)
+      pin0 = mcp.get_pin(0)
+      pin0.direction = Direction.OUTPUT
+      pin1 = mcp.get_pin(1)
+      pin1.direction = Direction.OUTPUT
+      pin0.value = False
+      pin1.value = False
+      for n in range(0,3+2*nb_stack-1) :        
+          # current injection
+          
+          if (n % 2) == 0:
+              
+              pin1.value = True
+              pin0.value = False # current injection polarity n°1        
+          else:
+              pin0.value = True
+              pin1.value = False# injection de courant polarity n°2
+          start_delay=time.time()
+          time.sleep(injection_deltat) # delay depending on current injection duration
+
+         
+          for k in range(0,integer):
+            meas[0,k] = ((AnalogIn(ads_current,ADS.P0).voltage/50)/R_shunt)*1000 # reading current value on ADS channel A0
+            meas[1,k] = AnalogIn(ads_voltage,ADS.P0).voltage * coefp2*1000
+            meas[2,k] = AnalogIn(ads_voltage,ADS.P1).voltage * coefp3*1000 # reading voltage value on ADS channel A2
+          pin1.value = False; pin0.value = False# stop current injection
+          end_delay=time.time()
+          sum_I=sum_I+(np.mean(meas[0,:]))
+          Vmn1=((np.mean(meas[1,:]))-(np.mean(meas[2,:])))
+          if (n % 2) == 0:
+                sum_Vmn=sum_Vmn-Vmn1
+                sum_Ps=sum_Ps+Vmn1
+          else:
+                sum_Vmn=sum_Vmn+Vmn1
+                sum_Ps=sum_Ps+Vmn1
+          end_calc=time.time()
+          cpu = CPUTemperature()
+          time.sleep((end_delay-start_delay)-(end_calc-end_delay)) 
+      # return averaged values
+  #     cpu= CPUTemperature()
+      output = pd.DataFrame({
+          "time":[datetime.now()],
+          "A":elec_array[0],
+          "B":elec_array[1],
+          "M":elec_array[2],
+          "N":elec_array[3],
+          "Vmn [mV]":[(sum_Vmn/(3+2*nb_stack-1))],
+          "I [mA]":[(sum_I/(3+2*nb_stack-1))],
+          "R [ohm]":[( (sum_Vmn/(3+2*nb_stack-1)/(sum_I/(3+2*nb_stack-1))))],
+  #         "Rab [KOhm]":[(Tab*2.47)/(sum_I/(3+2*nb_stack-1))/1000],
+  #         "Tx [V]":[Tx*2.47],              
+          "Ps [mV]":[(sum_Ps/(3+2*nb_stack-1))],
+          "nbStack":[nb_stack],
+          "CPU temp [°C]":[cpu.temperature],
+  #         "Hardware temp [°C]":[read_temp()-8],
+          "Time [S]":[(-start_time+time.time())]
+  #         "Rcontact[ohm]":[Rc],
+  #         "Rsoil[ohm]":[Rsoil],
+  #         "Rab_theory [Ohm]":[(Rc*2+Rsoil)]
        
-        for k in range(0,integer):
-          meas[0,k] = ((AnalogIn(ads_current,ADS.P0).voltage/50)/R_shunt)*1000 # reading current value on ADS channel A0
-          meas[1,k] = AnalogIn(ads_voltage,ADS.P0).voltage * coefp2*1000
-          meas[2,k] = AnalogIn(ads_voltage,ADS.P1).voltage * coefp3*1000 # reading voltage value on ADS channel A2
-        pin1.value = False; pin0.value = False# stop current injection
-        end_delay=time.time()
-        sum_I=sum_I+(np.mean(meas[0,:]))
-        Vmn1=((np.mean(meas[1,:]))-(np.mean(meas[2,:])))
-        if (n % 2) == 0:
-              sum_Vmn=sum_Vmn-Vmn1
-              sum_Ps=sum_Ps+Vmn1
-        else:
-              sum_Vmn=sum_Vmn+Vmn1
-              sum_Ps=sum_Ps+Vmn1
-        end_calc=time.time()
-        cpu = CPUTemperature()
-        time.sleep((end_delay-start_delay)-(end_calc-end_delay)) 
-    # return averaged values
-#     cpu= CPUTemperature()
-    output = pd.DataFrame({
-        "time":[datetime.now()],
-        "A":elec_array[0],
-        "B":elec_array[1],
-        "M":elec_array[2],
-        "N":elec_array[3],
-        "Vmn [mV]":[(sum_Vmn/(3+2*nb_stack-1))],
-        "I [mA]":[(sum_I/(3+2*nb_stack-1))],
-        "R [ohm]":[( (sum_Vmn/(3+2*nb_stack-1)/(sum_I/(3+2*nb_stack-1))))],
-#         "Rab [KOhm]":[(Tab*2.47)/(sum_I/(3+2*nb_stack-1))/1000],
-#         "Tx [V]":[Tx*2.47],              
-        "Ps [mV]":[(sum_Ps/(3+2*nb_stack-1))],
-        "nbStack":[nb_stack],
-        "CPU temp [°C]":[cpu.temperature],
-#         "Hardware temp [°C]":[read_temp()-8],
-        "Time [S]":[(-start_time+time.time())]
-#         "Rcontact[ohm]":[Rc],
-#         "Rsoil[ohm]":[Rsoil],
-#         "Rab_theory [Ohm]":[(Rc*2+Rsoil)]
-     
-     
-      # Dead time equivalent to the duration of the current injection pulse   
-    })
-    output=output.round(2)
-    print(output.to_string())
-    time.sleep(1)
-    return output
+       
+        # Dead time equivalent to the duration of the current injection pulse   
+      })
+      output=output.round(2)
+      print(output.to_string())
+      time.sleep(1)
+      return output
+
 
-"""
 
 # function to find rows with identical values in different columns
 def find_identical_in_line(array_object):
@@ -287,7 +291,7 @@ def append_and_save(path, last_measurement):
 """
 Main loop
 """
-import threading
+
 
 class OhmPi(object):
     def __init__(self, pardict):
@@ -322,11 +326,14 @@ class OhmPi(object):
                     #switch_mux_on(N[i,])
 
                     # run a measurement
-                    #current_measurement = run_measurement(self.pardict.get("stack"), pardict.get("injection_duration"), R_shunt, coef_p2, coef_p3, N[i,])
+                    if onpi:
+                      current_measurement = run_measurement(self.pardict.get("stack"), self.pardict.get("injection_duration"), R_shunt, coef_p2, coef_p3, N[i,])
+                    else:
+                      current_measurement = pd.DataFrame({
+                          'A': [N[i, 0]], 'B': [N[i, 1]], 'M': [N[i, 2]], 'N': [N[i, 3]], 'R [ohm]': np.abs(np.random.randn(1))
+                      })
+                    
                     #switch_mux_off(N[i,])
-                    current_measurement = pd.DataFrame({
-                        'a': [N[i, 0]], 'b': [N[i, 1]], 'm': [N[i, 2]], 'n': [N[i, 3]], 'rho': np.abs(np.random.randn(1))
-                    })
                     time.sleep(np.abs(np.random.randn(1))[0])
 
                     # save data and print in a text file
@@ -352,3 +359,9 @@ class OhmPi(object):
         if self.t is not None:
             self.t.join()
         print('self.status', self.status)
+
+# test
+#with open('ohmpi_param.json') as json_file:
+#    pardict = json.load(json_file)
+#ohmpi = OhmPi(pardict)
+#ohmpi.measure()
diff --git a/env.sh b/env.sh
new file mode 100644
index 0000000000000000000000000000000000000000..21e3ecaadebe18628555b7517c1c0083bcd0476b
--- /dev/null
+++ b/env.sh
@@ -0,0 +1,7 @@
+#!/bin/bash 
+sudo apt-get install -y libatlas-base-dev
+python3 -m venv ohmpy
+source ohmpy/bin/activate
+export CFLAGS=-fcommon
+pip install -r requirements.txt
+
diff --git a/index.html b/index.html
index 88385928a79640558570a8143d84903acd859bd3..8db1d579bbde5831aa10ff194b5b2713a6287324 100644
--- a/index.html
+++ b/index.html
@@ -103,8 +103,8 @@
 
     <script type="text/javascript">
         //let serverUrl = 'http://10.3.141.1:8080'
-        //let serverUrl = 'http://0.0.0.0:8080'
-        let serverUrl = 'http://localhost:8080'
+        let serverUrl = 'http://0.0.0.0:8080'
+        //let serverUrl = 'http://localhost:8080'
         let output = document.getElementById('output')
         let data = {} // hold data of all surveys
         let interv = null // hold interval for automatic data retrieval
@@ -256,7 +256,7 @@
                 }
                 
                 // dropdown with number of surveys and +++
-                let surveyNames = Object.keys(data)
+                let surveyNames = Object.keys(data).sort()
 
                 // callback function to draw the plot
                 function surveySelectFunc(el) {
diff --git a/ohmpi_param.json b/ohmpi_param.json
index 018dd93fd39403377d7074565d5356ef36a73ce6..7071487a858d80f5fa2bec82abde9eec12c3a328 100644
--- a/ohmpi_param.json
+++ b/ohmpi_param.json
@@ -4,5 +4,5 @@
     "nbr_meas": 100,
     "sequence_delay": 1,
     "stack": 1,
-    "export_path": "/home/pi/Documents/OhmPi/measurement.csv" 
+    "export_path": "data/measurement.csv" 
 }
diff --git a/old-requirements.txt b/old-requirements.txt
new file mode 100644
index 0000000000000000000000000000000000000000..4935e38a311ae23aa6e007577eb790e5623e19ee
--- /dev/null
+++ b/old-requirements.txt
@@ -0,0 +1,20 @@
+libraries to install using the package manager : libatlas-base-dev
+    sudo apt-get install libatlas-base-dev
+python libraries dependencies :
+Adafruit-Blinka==3.2.0
+adafruit-circuitpython-ads1x15==2.1.1
+adafruit-circuitpython-mcp230xx==2.5.1
+adafruit-circuitpython-busdevice==4.0.1
+Adafruit-PlatformDetect==1.3.8
+adafruit-circuitpython-tca9548a==0.5.1
+Adafruit-PureIO==1.0.4
+numpy==1.17.4
+pandas==0.25.3
+pkg-resources==0.0.0
+python-dateutil==2.8.1
+pytz==2019.3
+rpi-ws281x==4.2.2
+RPi.GPIO==0.7.0
+six==1.13.0
+spidev==3.4
+sysv-ipc==1.0.1 
diff --git a/requirements.txt b/requirements.txt
index a7f7edc2953937eaf23acbabcee9c47ccc4cfdc9..cbb65fcd99fbe729896ee728246880de69bf8c85 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,21 +1,9 @@
-libraries to install using the package manager : libatlas-base-dev
-    sudo apt-get install libatlas-base-dev
-python libraries dependencies :
-Adafruit-Blinka==3.2.0
-adafruit-circuitpython-ads1x15==2.1.1
-adafruit-circuitpython-mcp230xx==2.5.1
-adafruit-circuitpython-busdevice==4.0.1
-Adafruit-PlatformDetect==1.3.8
-adafruit-circuitpython-tca9548a==0.5.1
-Adafruit-PureIO==1.0.4
-numpy==1.17.4
-pandas==0.25.3
-pkg-resources==0.0.0
-python-dateutil==2.8.1
-pytz==2019.3
-rpi-ws281x==4.2.2
-RPi.GPIO==0.7.0
-six==1.13.0
-spidev==3.4
-sysv-ipc==1.0.1 
-termcolor==1.1.0
+RPi.GPIO
+adafruit-blinka
+numpy
+pandas
+adafruit-circuitpython-ads1x15
+adafruit-circuitpython-tca9548a
+adafruit-circuitpython-mcp230xx
+gpiozero
+termcolor
diff --git a/run.sh b/run.sh
new file mode 100644
index 0000000000000000000000000000000000000000..30e98988e9eb005153a49007e4cecd515f818db6
--- /dev/null
+++ b/run.sh
@@ -0,0 +1,2 @@
+source ../ohmpy/bin/activate
+python3 webserver.py
diff --git a/sphinx/source/Ohmpi_V2_00/step_n_3/a/MUX_board_list_2_xx.xlsx b/sphinx/source/Ohmpi_V2_00/step_n_3/a/MUX_board_list_2_xx.xlsx
index f792edfc2404cb044298340c545452849aa6d42b..9187d01c2690038431eb56c43b5fcc48447bc4f3 100644
Binary files a/sphinx/source/Ohmpi_V2_00/step_n_3/a/MUX_board_list_2_xx.xlsx and b/sphinx/source/Ohmpi_V2_00/step_n_3/a/MUX_board_list_2_xx.xlsx differ
diff --git a/webserver.py b/webserver.py
new file mode 100644
index 0000000000000000000000000000000000000000..24414188215937742d6291f5e681788e796e559d
--- /dev/null
+++ b/webserver.py
@@ -0,0 +1,98 @@
+from http.server import SimpleHTTPRequestHandler, HTTPServer
+import time
+import os
+import json
+from Ohmpi import OhmPi
+import threading
+import pandas as pd
+import shutil
+
+hostName = "0.0.0.0"
+#hostName = 'localhost'
+serverPort = 8080
+
+# https://gist.github.com/MichaelCurrie/19394abc19abd0de4473b595c0e37a3a
+
+with open('ohmpi_param.json') as json_file:
+    pardict = json.load(json_file)
+
+ohmpi = OhmPi(pardict)
+
+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)
+    #     print(self.headers)
+    #     print(self.request)
+    #     self.send_response(200)
+    #     self.send_header("Content-type", "text/html")
+    #     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'])))
+        rdic = {}
+        if dic['command'] == 'start':
+            ohmpi.measure()
+        elif dic['command'] == 'stop':
+            ohmpi.stop()
+        elif dic['command'] == 'getData':
+            # get all .csv file in data folder
+            fnames = os.listdir('data/')
+            ddic = {}
+            for fname in fnames:
+                if fname.replace('.csv', '') not in dic['surveyNames'] and fname != 'readme.txt':
+                    df = pd.read_csv('data/' + fname)
+                    ddic[fname.replace('.csv', '')] = {
+                        'a': df['A'].tolist(),
+                        'b': df['B'].tolist(),
+                        'm': df['M'].tolist(),
+                        'n': df['N'].tolist(),
+                        'rho': df['R [ohm]'].tolist(),
+                    }
+            rdic['data'] = ddic
+        elif dic['command'] == 'removeData':
+            shutil.rmtree('data')
+            os.mkdir('data')
+        elif dic['command'] == 'setConfig':
+            ohmpi.stop()
+            cdic = dic['config']
+            ohmpi.pardict['nb_electrodes'] = int(cdic['nbElectrodes'])
+            ohmpi.pardict['injection_duration'] = float(cdic['injectionDuration'])
+            ohmpi.pardict['nbr_meas'] = int(cdic['nbMeasurements'])
+            ohmpi.pardict['stack'] = int(cdic['nbStack'])
+            ohmpi.pardict['sequence_delay'] = int(cdic['sequenceDelay'])
+            print('setConfig', ohmpi.pardict)
+        elif dic['command'] == 'invert':
+            pass
+        elif dic['command'] == 'getResults':
+            pass
+        elif dic['command'] == 'download':
+            shutil.make_archive('data', 'zip', 'data')
+        else:
+            # command not found
+            rdic['response'] = 'command not found'
+        
+        rdic['status'] = ohmpi.status
+        self.send_response(200)
+        self.send_header('Content-Type', 'text/json')
+        self.end_headers()
+        self.wfile.write(bytes(json.dumps(rdic), 'utf8'))
+
+
+if __name__ == "__main__":        
+    webServer = HTTPServer((hostName, serverPort), MyServer)
+    print("Server started http://%s:%s" % (hostName, serverPort))
+
+    try:
+        webServer.serve_forever()
+    except KeyboardInterrupt:
+        pass
+
+    webServer.server_close()
+    print("Server stopped.")