diff --git a/V2_00_step_02 - Copie.rst b/V2_00_step_02 - Copie.rst deleted file mode 100644 index c98864a23f267342179258e203608484e10d167a..0000000000000000000000000000000000000000 --- a/V2_00_step_02 - Copie.rst +++ /dev/null @@ -1,467 +0,0 @@ - -**STEP n°2**: Assembly of the measurement board -**************************************************** - -+----------------------------------------------------+ -| **Required components** | -+----------------------------------------------------+ - -.. figure:: step_n_2/00_mes_board_components.jpg - :width: 600px - :align: center - :height: 450px - :alt: alternate text - :figclass: align-center - - - - -.. csv-table:: List of components - :file: C:\Users\remi.clement\Documents\28_ohmpi_all_git\master2\sphinx\source\step_n_2\Mesure_board_list_2_xx.csv - :widths: 30, 70, 70, 70, 70, 35, 35 - :header-rows: 1 - -Description -========================================== - -.. figure:: schema_measurement_board.jpg - :width: 600px - :align: center - :height: 450px - :alt: alternate text - :figclass: align-center - -Figure shows the general schematics for the electronic measurement board developed. -We have developed a complete "plug and play" measurement board. To measure electrical resistivity with Raspberry Pi. -two ADS1115 were used,one for the voltage measurement one for the current measurement, as proposed by Florsch [7]. The ADS1115 -is a 16-bit ADC (Analog-to-Digital Converter), with an adaptable gain. The advantage of ADS1115 is that the -input signal value could lie between - to + 6.114 V. For the current measurement we have directly integrated the INA282 component, -which allows to realize precise current measurement around a shunt resistor. The assembly steps are described in the following steps: - - - -.. table:: - :align: center - - +--------+------------------------------------------------------------+ - | | .. image:: step_n_2/01_mes_board.jpg | - | 1 +------------------------------------------------------------+ - | | Installation of female header, 1 by10 pins, for ADS1115 | - | | | - +--------+------------------------------------------------------------+ - -.. table:: - :align: center - - +--------+------------------------------------------------------------+ - | | .. image:: step_n_2/02_mes_board.jpg | - |2 +------------------------------------------------------------+ - | | Soldering of 4 dual-in-line- socket (2 by 2 pins) for | - | | optical relay, AQY211EH. | - +--------+------------------------------------------------------------+ - -.. table:: - :align: center - - +--------+------------------------------------------------------------+ - | | .. image:: step_n_2/03_mes_board.jpg | - |3 +------------------------------------------------------------+ - | | Soldering of 1 dual-in-line- socket (2 by 9 pins) | - | | for INA282. | - +--------+------------------------------------------------------------+ - -.. table:: - :align: center - - +--------+------------------------------------------------------------+ - | | .. image:: step_n_2/04_mes_board.jpg | - | 4 +------------------------------------------------------------+ - | | Soldering of 1 dual-in-line- socket (2 by 4 pins) | - | | | - +--------+------------------------------------------------------------+ -.. table:: - :align: center - - +--------+------------------------------------------------------------+ - | | .. image:: step_n_2/05_mes_board.jpg | - |5 +------------------------------------------------------------+ - | | Soldering of 2 dual-in-line- socket (2 by 4 pins) | - | | | - +--------+------------------------------------------------------------+ - -.. table:: - :align: center - - +--------+------------------------------------------------------------+ - | | .. image:: step_n_2/06_mes_board.jpg | - | 6 +------------------------------------------------------------+ - | | Traco Power Supply 12V to 5V, TDH15 - 1211N | - | | | - +--------+------------------------------------------------------------+ - -.. table:: - :align: center - - +--------+------------------------------------------------------------+ - | | .. image:: step_n_2/07_mes_board.jpg | - |7 +------------------------------------------------------------+ - | | Four screw terminals for 12V inpout et 5V outpout | - | | | - +--------+------------------------------------------------------------+ - -.. table:: - :align: center - - +--------+------------------------------------------------------------+ - | | .. image:: step_n_2/08_mes_board.jpg | - |8 +------------------------------------------------------------+ - | | Traco power Supply 12V to 24V, TRN-1215 | - | | | - +--------+------------------------------------------------------------+ - -.. table:: - :align: center - - +--------+------------------------------------------------------------+ - | | .. image:: step_n_2/09_mes_board.jpg | - |9 +------------------------------------------------------------+ - | | Two screw terminals electrodes M and N | - | | | - +--------+------------------------------------------------------------+ - -.. table:: - :align: center - - +---------+------------------------------------------------------------+ - | | .. image:: step_n_2/10_mes_board.jpg | - |10 +------------------------------------------------------------+ - | | Four screw terminals, for 12V power supply and for | - | | electrodes A and B | - +---------+------------------------------------------------------------+ - -.. table:: - :align: center - - +---------+------------------------------------------------------------+ - | | .. image:: step_n_2/11_mes_board.jpg | - |11 +------------------------------------------------------------+ - | | Soldering three capacitors (100nF) | - | | | - +---------+------------------------------------------------------------+ - -.. table:: - :align: center - - +---------+------------------------------------------------------------+ - | | .. image:: step_n_2/12_mes_board.jpg | - | 12 +------------------------------------------------------------+ - | | 2 ohms shunt resistor pre-adjustment | - | | | - +---------+------------------------------------------------------------+ -.. table:: - :align: center - - +---------+------------------------------------------------------------+ - | | .. image:: step_n_2/13_mes_board.jpg | - |13 +------------------------------------------------------------+ - | | Soldering 2 ohms shunt resistor | - | | | - +---------+------------------------------------------------------------+ - -.. table:: - :align: center - - +---------+------------------------------------------------------------+ - | | .. image:: step_n_2/14_mes_board.jpg | - |14 +------------------------------------------------------------+ - | | 1 Mohms resistors | - | | | - +---------+------------------------------------------------------------+ - -.. table:: - :align: center - - +---------+------------------------------------------------------------+ - | | .. image:: step_n_2/15_mes_board.jpg | - |15 +------------------------------------------------------------+ - | | Soldering tow 1 Kohms resistors | - | | | - +---------+------------------------------------------------------------+ - -.. table:: - :align: center - - +---------+------------------------------------------------------------+ - | | .. image:: step_n_2/16_mes_board.jpg | - |16 +------------------------------------------------------------+ - | | Soldering tow 1.5Kohms resistors | - | | | - +---------+------------------------------------------------------------+ -.. table:: - :align: center - - +---------+------------------------------------------------------------+ - | | .. image:: step_n_2/17_mes_board.jpg | - |17 +------------------------------------------------------------+ - | | Soldering tow 1.5Kohms resistors | - | | | - +---------+------------------------------------------------------------+ - -.. table:: - :align: center - - +---------+------------------------------------------------------------+ - | | .. image:: step_n_2/18_mes_board.jpg | - |18 +------------------------------------------------------------+ - | | Female header 2 by 20 pins for Raspberry Pi connection | - | | | - +---------+------------------------------------------------------------+ - -.. table:: - :align: center - - +---------+------------------------------------------------------------+ - | | .. image:: step_n_2/19_mes_board.jpg | - |19 +------------------------------------------------------------+ - | | View of the female header 2 by 20 pins installation | - | | for Raspberry Pi connection | - +---------+------------------------------------------------------------+ - -.. table:: - :align: center - - +---------+------------------------------------------------------------+ - | | .. image:: step_n_2/20_mes_board.jpg | - |20 +------------------------------------------------------------+ - | | Fixing MCP23008 component | - | | | - +---------+------------------------------------------------------------+ - -.. table:: - :align: center - - +---------+------------------------------------------------------------+ - | | .. image:: step_n_2/21_mes_board.jpg | - |21 +------------------------------------------------------------+ - | |Mounting optical relay, AQY211EH | - | | | - +---------+------------------------------------------------------------+ - -.. table:: - :align: center - - +---------+------------------------------------------------------------+ - | | .. image:: step_n_2/22_mes_board.jpg | - |22 +------------------------------------------------------------+ - | | Mounting LM158 operational amplificator | - | | | - +---------+------------------------------------------------------------+ - -.. table:: - :align: center - - +---------+------------------------------------------------------------+ - | | .. image:: step_n_2/23_mes_board.jpg | - |23 +------------------------------------------------------------+ - | | Mounting ADS115 board | - | | | - +---------+------------------------------------------------------------+ - -.. table:: - :align: center - - +---------+------------------------------------------------------------+ - | | .. image:: step_n_2/24_mes_board.jpg | - |24 +------------------------------------------------------------+ - | | Fixing the INA282 | - | | | - +---------+------------------------------------------------------------+ - - - -**STEP n°3**: Start-up of the measurement board. -**************************************************** - -+------------------------------------------------------------------------+ -| **Required components** | -+------------------------------------------------------------------------+ - -.. csv-table:: List of components - :file: C:\Users\remi.clement\Documents\28_ohmpi_all_git\master2\sphinx\source\step_n_3\test_2_xx.csv - :widths: 30, 70, 70, 70, 70, 35, 35 - :header-rows: 1 - -.. table:: - :align: center - - +--------+------------------------------------------------------------+ - | | .. image:: step_n_3/001.jpg | - |1 +------------------------------------------------------------+ - | | Shutdown the raspberry Pi and unplug the power supply | - | | | - +--------+------------------------------------------------------------+ - -.. table:: - :align: center - - +--------+--------------------------------------------------------------------------+ - | | .. image:: step_n_3/001.jpg | - |2 +--------------------------------------------------------------------------+ - | | Mounting the bottom spacers on the Raspberry Pi (male/female, 11mm, M3) | - | | | - +--------+--------------------------------------------------------------------------+ - -.. table:: - :align: center - - +--------+--------------------------------------------------------------------------+ - | | .. image:: step_n_3/002.jpg | - |3 +--------------------------------------------------------------------------+ - | | Mounting the upper spacers on the Raspberry Pi (female/female, 11mm, M3) | - | | | - +--------+--------------------------------------------------------------------------+ - -.. table:: - :align: center - - +--------+------------------------------------------------------------+ - | | .. image:: step_n_3/003.jpg | - |4 +------------------------------------------------------------+ - | | Mounting the Ohmpi's measurement board on the Raspberry Pi | - | | | - +--------+------------------------------------------------------------+ - -.. table:: - :align: center - - +--------+------------------------------------------------------------+ - | | .. image:: step_n_3/004.jpg | - |5 +------------------------------------------------------------+ - | | Mounting the Ohmpi's measurement board on the Raspberry Pi | - | | | - +--------+------------------------------------------------------------+ - -.. table:: - :align: center - - +--------+------------------------------------------------------------+ - | | .. image:: step_n_3/005.jpg | - |6 +------------------------------------------------------------+ - | | Plug the power supply into a socket and connect it to your | - | | Raspberry Pi's power port. | - +--------+------------------------------------------------------------+ - - -**STEP n°4**: Measurement board validation -**************************************************** - - Run the terminal, and write - - .. code-block:: python - - i2cdetect -y 1 - -.. table:: - :align: center - - +--------+------------------------------------------------------------+ - | | .. image:: step_n_4/i2cdetect.png | - |1 +------------------------------------------------------------+ - | |If everything is working, three I2C addresses should appear | - | |on the screen. | - +--------+------------------------------------------------------------+ - - - -Setting up an equivalent electronic circuit, for this you will need: - * 4 1kohm resistor (R2) - * 1 220 ohm resistor (R1) - * 1 small padboard - * Spool of solder - - .. table:: - :align: left - - +--------+------------------------------------------------------------+ - | | .. image:: step_n_4/ref_circuit.png | - |2 +------------------------------------------------------------+ - | | Schematic of equivalent electronic circuit test | - +--------+------------------------------------------------------------+ - -.. table:: - :align: center - - +--------+------------------------------------------------------------+ - | | .. image:: step_n_4/20210905_122820.jpg | - |3 +------------------------------------------------------------+ - | | Préparer le circuit équivalent | - +--------+------------------------------------------------------------+ - - -.. table:: - :align: center - - +--------+------------------------------------------------------------+ - | | .. image:: step_n_4/20210905_123034.jpg | - |4 +------------------------------------------------------------+ - | | Préparer les cables de connexion aux batterie et les cosses| - +--------+------------------------------------------------------------+ - - -.. table:: - :align: center - - +--------+------------------------------------------------------------+ - | | .. image:: step_n_4/20210905_132856.jpg | - |5 +------------------------------------------------------------+ - | | Souder les câbles et les cosses | - +--------+------------------------------------------------------------+ - - -.. table:: - :align: center - - +--------+------------------------------------------------------------+ - | | .. image:: step_n_4/20210905_210045.jpg | - |6 +------------------------------------------------------------+ - | | Installer les cables rouges sur la borne +12V et cable noir| - | | sur la borne ground. | - +--------+------------------------------------------------------------+ - -.. table:: - :align: center - - +--------+------------------------------------------------------------+ - | | .. image:: step_n_4/20210905_210045.jpg | - |7 +------------------------------------------------------------+ - | | Installer le circuit de référence | - | | | - +--------+------------------------------------------------------------+ - - -Run the Thonny IDE and load the code Ohmpy4elec.pi - - -**STEP n°5**: Assembly of the MUX board -**************************************************** - - - -**STEP n°6**: Check Mux Board -**************************************************** - - - -**STEP n°7**: Assemble Ohmpi -**************************************************** - - - -**STEP n°8**: Boxing Ohmpi -**************************************************** - - - -**STEP n°9**: Field measurement -**************************************************** - \ No newline at end of file diff --git a/test_mux_board.py b/test_mux_board.py new file mode 100644 index 0000000000000000000000000000000000000000..62188d8361d7c3c9780a52d1a76b7968e4a40cfa --- /dev/null +++ b/test_mux_board.py @@ -0,0 +1,78 @@ +""" +Created on Tue Dec 7 06:39:33 2021 +Code for testing switch MUX for ohmpi 2 +@author: remi.clement +""" + +import time , board, busio,adafruit_tca9548a +from adafruit_mcp230xx.mcp23017 import MCP23017 +import digitalio +from digitalio import Direction + + +address=0X71# choose the mux board address +activation_time=1 # choose your activation time in second + + +i2c = busio.I2C(board.SCL, board.SDA) #activation du protocle I2C +def switch_mux_on(electrode,address): + tca= adafruit_tca9548a.TCA9548A(i2c, address) + if electrode < 17: + nb_i2C=7 + a=electrode + elif electrode > 16 and electrode< 33: + nb_i2C=6 + a=electrode-16 + elif electrode > 32 and electrode < 49: + nb_i2C=5 + a=electrode-32 + elif electrode > 48 and electrode < 65: + nb_i2C=4 + a=electrode-48 + + mcp2 = MCP23017(tca[nb_i2C]) + mcp2.get_pin(a-1).direction=Direction.OUTPUT + mcp2.get_pin(a-1).value=True + +def switch_mux_off(electrode,address): + tca= adafruit_tca9548a.TCA9548A(i2c, address) + if electrode < 17: + nb_i2C=7 + a=electrode + elif electrode > 16 and electrode < 33: + nb_i2C=6 + a=electrode-16 + elif electrode > 32 and electrode < 49: + nb_i2C=5 + + a=electrode-32 + elif electrode > 48 and electrode < 65: + nb_i2C=4 + a=electrode-48 + + mcp2 = MCP23017(tca[nb_i2C]) + mcp2.get_pin(a-1).direction=digitalio.Direction.OUTPUT + mcp2.get_pin(a-1).value=False + +a=input(' if vous want try 1 channel choose 1, if you want try all channel choose 2!') + +if a=='1': + b=0 + print ("run channel by channel test") + electrode=int(input(' Choose your electrode number (integer):')) + switch_mux_on(electrode,address) + print('electrode:',electrode,' activate' ) + time.sleep(activation_time) + switch_mux_off(electrode,address) + print('electrode:',electrode,' deactivate' ) + +if a== '2': + for electrode in range(1, 65): + switch_mux_on(electrode,address) + print('electrode:',electrode,' activate' ) + time.sleep(activation_time) + switch_mux_off(electrode,address) + print('electrode:',electrode,' deactivate' ) + +if a not in ['1', '2']: + print ("Wrong choice !")