Commit 1e07632d authored by Clement Remi's avatar Clement Remi
Browse files

Merge branch 'ohmpi_1.5' into 'master'

Ohmpi 1.5

See merge request reversaal/OhmPi!4
Showing with 11142 additions and 51986 deletions
+11142 -51986
......@@ -7,4 +7,149 @@
7 10 8 9
8 11 9 10
9 12 10 11
10 13 11 12
\ No newline at end of file
10 13 11 12
11 14 12 13
12 15 13 14
13 16 14 15
14 17 15 16
15 18 16 17
16 19 17 18
17 20 18 19
18 21 19 20
19 22 20 21
20 23 21 22
21 24 22 23
22 25 23 24
23 26 24 25
24 27 25 26
25 28 26 27
26 29 27 28
27 30 28 29
28 31 29 30
29 32 30 31
1 7 3 5
2 8 4 6
3 9 5 7
4 10 6 8
5 11 7 9
6 12 8 10
7 13 9 11
8 14 10 12
9 15 11 13
10 16 12 14
11 17 13 15
12 18 14 16
13 19 15 17
14 20 16 18
15 21 17 19
16 22 18 20
17 23 19 21
18 24 20 22
19 25 21 23
20 26 22 24
21 27 23 25
22 28 24 26
23 29 25 27
24 30 26 28
25 31 27 29
26 32 28 30
1 10 4 7
2 11 5 8
3 12 6 9
4 13 7 10
5 14 8 11
6 15 9 12
7 16 10 13
8 17 11 14
9 18 12 15
10 19 13 16
11 20 14 17
12 21 15 18
13 22 16 19
14 23 17 20
15 24 18 21
16 25 19 22
17 26 20 23
18 27 21 24
19 28 22 25
20 29 23 26
21 30 24 27
22 31 25 28
23 32 26 29
1 13 5 9
2 14 6 10
3 15 7 11
4 16 8 12
5 17 9 13
6 18 10 14
7 19 11 15
8 20 12 16
9 21 13 17
10 22 14 18
11 23 15 19
12 24 16 20
13 25 17 21
14 26 18 22
15 27 19 23
16 28 20 24
17 29 21 25
18 30 22 26
19 31 23 27
20 32 24 28
1 16 6 11
2 17 7 12
3 18 8 13
4 19 9 14
5 20 10 15
6 21 11 16
7 22 12 17
8 23 13 18
9 24 14 19
10 25 15 20
11 26 16 21
12 27 17 22
13 28 18 23
14 29 19 24
15 30 20 25
16 31 21 26
17 32 22 27
1 19 7 13
2 20 8 14
3 21 9 15
4 22 10 16
5 23 11 17
6 24 12 18
7 25 13 19
8 26 14 20
9 27 15 21
10 28 16 22
11 29 17 23
12 30 18 24
13 31 19 25
14 32 20 26
1 22 8 15
2 23 9 16
3 24 10 17
4 25 11 18
5 26 12 19
6 27 13 20
7 28 14 21
8 29 15 22
9 30 16 23
10 31 17 24
11 32 18 25
1 25 9 17
2 26 10 18
3 27 11 19
4 28 12 20
5 29 13 21
6 30 14 22
7 31 15 23
8 32 16 24
1 28 10 19
2 29 11 20
3 30 12 21
4 31 13 22
5 32 14 23
1 31 11 21
2 32 12 22
"""
created on January 6, 2020
Update December 2021
Update april 2021
Ohmpi.py is a program to control a low-cost and open hardward resistivity meter OhmPi that has been developed by Rémi CLEMENT(INRAE),Vivien DUBOIS(INRAE),Hélène GUYARD(IGE), Nicolas FORQUET (INRAE), and Yannick FARGIER (IFSTTAR).
"""
print('OHMPI start' )
print('\033[1m'+'\033[31m'+' ________________________________')
print('| _ | | | || \/ || ___ \_ _|')
print('| | | | |_| || . . || |_/ / | |' )
print('| | | | _ || |\/| || __/ | |')
print('\ \_/ / | | || | | || | _| |_')
print(' \___/\_| |_/\_| |_/\_| \___/ ')
print('\033[0m')
print('OhmPi start' )
print('Vers: 1.51')
print('Import library')
import RPi.GPIO as GPIO
import time
from datetime import datetime
import board
import busio
import numpy
import os
import sys
import time , board, busio, numpy, os, sys, json, glob,os.path,adafruit_tca9548a
import adafruit_ads1x15.ads1115 as ADS
from adafruit_ads1x15.analog_in import AnalogIn
import pandas as pd
import os.path
import json
"""
display start time
"""
from pandas import DataFrame
from datetime import datetime
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"))
"""
hardware parameters
"""
R_ref = 50 # reference resistance value in ohm
coef_p0 = 2.5 # slope for current conversion for ADS.P0, measurement in V/V
coef_p1 = 2.5 # slope for current conversion for ADS.P1, measurement in V/V
coef_p2 = 2.5 # slope for current conversion for ADS.P2, measurement in V/V
coef_p3 = 2.5 # slope for current conversion for ADS.P3, measurement in V/V
export_path = "/home/pi/Desktop/measurement.csv"
R_shunt = 0.2# reference resistance value in ohm
coef_p2 = 2.50# slope for current conversion for ADS.P2, measurement in V/V
coef_p3 = 2.50 # slope for current conversion for ADS.P3, measurement in V/V
offset_p2= 0
offset_p3= 0
integer=10
meas=numpy.zeros((3,integer))
"""
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)
"""
functions
"""
# function swtich_mux select the right channels for the multiplexer cascade for electrodes A, B, M and N.
def switch_mux(quadripole):
path2elec = numpy.loadtxt("path2elec.txt", delimiter=" ", dtype=bool)
quadmux = numpy.loadtxt("quadmux.txt", delimiter=" ", dtype=int)
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
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
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):
for j in range(0,5) :
GPIO.output(int(quadmux[i,j]), bool(path2elec[quadripole[i]-1,j]))
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 find rows with identical values in different columns
def find_identical_in_line(array_object):
......@@ -70,12 +161,12 @@ def find_identical_in_line(array_object):
if any(temp > 1):
output.append(i)
return output
#
# read quadripole file and apply tests
def read_quad(filename, nb_elec):
output = numpy.loadtxt(filename, delimiter=" ",dtype=int) # load quadripole file
# locate lines where the electrode index exceeds the maximum number of electrodes
test_index_elec = numpy.array(numpy.where(output > 32))
test_index_elec = numpy.array(numpy.where(output > nb_elec))
# locate lines where an electrode is referred twice
test_same_elec = find_identical_in_line(output)
# if statement with exit cases (rajouter un else if pour le deuxième cas du ticket #2)
......@@ -90,77 +181,79 @@ def read_quad(filename, nb_elec):
else:
return output
def gain_auto(channel):
gain=2/3
if ((abs(channel.voltage)<2.040) and (abs(channel.voltage)>=1.023)):
gain=2
elif ((abs(channel.voltage)<1.023) and (abs(channel.voltage)>=0.508)):
gain=4
elif ((abs(channel.voltage)<0.508) and (abs(channel.voltage)>=0.250)):
gain=8
elif abs(channel.voltage)<0.256:
gain=16
#print(gain)
return gain
# perform a measurement
def run_measurement(nb_stack, injection_deltat, Rref, coefp0, coefp1, coefp2, coefp3, elec_array):
i2c = busio.I2C(board.SCL, board.SDA) # I2C protocol setup
ads = ADS.ADS1115(i2c, gain=2/3) # I2C communication setup
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
# GPIO initialization
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(7, GPIO.OUT)
GPIO.setup(8, GPIO.OUT)
# resistance measurement
# 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:
GPIO.output(7, GPIO.HIGH) # polarity n°1
pin1.value = True
pin0.value = False # current injection polarity n°1
else:
GPIO.output(7, GPIO.LOW) # polarity n°2
GPIO.output(8, GPIO.HIGH) # current injection
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
ads = ADS.ADS1115(i2c, gain=2/3,data_rate=860)# select gain
ads = ADS.ADS1115(i2c, gain=gain_auto(AnalogIn(ads,ADS.P0)),data_rate=860)
Ia1 = AnalogIn(ads,ADS.P0).voltage * coefp0 # reading current value on ADS channel A0
ads = ADS.ADS1115(i2c, gain=2/3,data_rate=860)# select gain
ads = ADS.ADS1115(i2c, gain=gain_auto(AnalogIn(ads,ADS.P1)),data_rate=860)
Ib1 = AnalogIn(ads,ADS.P1).voltage * coefp1 # reading current value on ADS channel A1
ads = ADS.ADS1115(i2c, gain=2/3,data_rate=860)# select gain
ads = ADS.ADS1115(i2c, gain=gain_auto(AnalogIn(ads,ADS.P2)),data_rate=860)
Vm1 = AnalogIn(ads,ADS.P2).voltage * coefp2# reading voltage value on ADS channel A2
ads = ADS.ADS1115(i2c, gain=2/3,data_rate=860)# select gain
ads = ADS.ADS1115(i2c, gain=gain_auto(AnalogIn(ads,ADS.P3)),data_rate=860)
Vn1 = AnalogIn(ads,ADS.P3).voltage * coefp3# reading voltage value on ADS channel A3
GPIO.output(8, GPIO.LOW)# stop current injection
time.sleep(injection_deltat) # Dead time equivalent to the duration of the current injection pulse
I1= (Ia1 - Ib1)/Rref
sum_I=sum_I+I1
Vmn1= (Vm1 - Vn1)
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+(numpy.mean(meas[0,:]))
Vmn1=((numpy.mean(meas[1,:]))-(numpy.mean(meas[2,:])))
if (n % 2) == 0:
sum_Vmn=sum_Vmn-Vmn1
sum_Ps=sum_Ps+Vmn1
sum_Vmn=sum_Vmn-Vmn1
sum_Ps=sum_Ps+Vmn1
else:
sum_Vmn=sum_Vmn+Vmn1
sum_Ps=sum_Ps+Vmn1
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
output = pd.DataFrame({
# cpu= CPUTemperature()
output = DataFrame({
"time":[datetime.now()],
"A":elec_array[0],
"B":elec_array[1],
"M":elec_array[2],
"N":elec_array[3],
"Vmn":[sum_Vmn/(3+2*nb_stack-1)],
"I":[sum_I/(3+2*nb_stack-1)],
"R":[sum_Vmn/(3+2*nb_stack-1)/(sum_I/(3+2*nb_stack-1))],
"Ps":[sum_Ps/(3+2*nb_stack-1)],
"nbStack":[nb_stack]
"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
# save data
......@@ -175,45 +268,28 @@ def append_and_save(path, last_measurement):
with open(path, 'a') as f:
last_measurement.to_csv(f, header=True)
"""
Initialization of GPIO channels
"""
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
"""
Initialization of multiplexer channels
"""
pinList = [12,16,20,21,26,18,23,24,25,19,6,13,4,17,27,22,10,9,11,5] # List of GPIOs enabled for relay cards (electrodes)
for i in pinList:
GPIO.setup(i, GPIO.OUT)
GPIO.output(i, GPIO.HIGH)
"""
Main loop
"""
N=read_quad("ABMN.txt",pardict.get("nb_electrodes")) # load quadripole file
N=read_quad("dd.txt",pardict.get("nb_electrodes")) # load quadripole file
if N.ndim == 1:
N = N.reshape(1, 4)
ZERO_mux(pardict.get("nb_electrodes"))
for g in range(0,pardict.get("nbr_meas")): # for time-lapse monitoring
for i in range(0,N.shape[0]): # loop over quadripoles
# call the switch_mux function to switch to the right electrodes
switch_mux(N[i,])
switch_mux_on(N[i,])
# run a measurement
current_measurement = run_measurement(pardict.get("stack"), pardict.get("injection_duration"), R_ref, coef_p0, coef_p1, coef_p2, coef_p3, N[i,])
# save data and print in a text file
current_measurement = run_measurement(pardict.get("stack"), pardict.get("injection_duration"), R_shunt, coef_p2, coef_p3, N[i,])
switch_mux_off(N[i,])
#save data and print in a text file
append_and_save(pardict.get("export_path"), current_measurement)
# reset multiplexer channels
GPIO.output(12, GPIO.HIGH); GPIO.output(16, GPIO.HIGH); GPIO.output(20, GPIO.HIGH); GPIO.output(21, GPIO.HIGH); GPIO.output(26, GPIO.HIGH)
GPIO.output(18, GPIO.HIGH); GPIO.output(23, GPIO.HIGH); GPIO.output(24, GPIO.HIGH); GPIO.output(25, GPIO.HIGH); GPIO.output(19, GPIO.HIGH)
GPIO.output(6, GPIO.HIGH); GPIO.output(13, GPIO.HIGH); GPIO.output(4, GPIO.HIGH); GPIO.output(17, GPIO.HIGH); GPIO.output(27, GPIO.HIGH)
GPIO.output(22, GPIO.HIGH); GPIO.output(10, GPIO.HIGH); GPIO.output(9, GPIO.HIGH); GPIO.output(11, GPIO.HIGH); GPIO.output(5, GPIO.HIGH)
print(i+1,'/',N.shape[0])
print('end of sequence')
ZERO_mux(pardict.get("nb_electrodes"))
time.sleep(pardict.get("sequence_delay")) #waiting next measurement (time-lapse)
File deleted
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Fritzing Bill of Materials</title>
<style type="text/css">
.meta {
font-size: small;
margin: 0.4em 0;
}
table {
border-collapse: collapse;
}
th {
font-weight: bold;
text-align: left;
border-bottom: 1px solid black;
padding: 0.1em 1.5em 0.2em 0.1em;
}
td {
border-bottom: 1px solid #CCC;
padding: 0.5em 1.5em 0.5em 0.1em;
}
.props {
font-size: smaller;
}
</style>
</head>
<body>
<h1>Bill of Materials: card_measure_raspberry_v3.04.fzz</h1>
<p class="meta">C:/Users/remi.clement/Documents/28_ohmpi_all_git/PCB_file_measurement card/card_measure_raspberry_v3.04.fzz</p>
<p class="meta">vendredi, décembre 18 2020, 21:47:29</p>
<h2>Assembly List</h2>
<table>
<thead>
<tr>
<th>Label</th>
<th>Part Type</th>
<th>Properties</th>
</tr>
</thead>
<tbody>
<tr>
<td>C1</td>
<td>Ceramic Capacitor</td>
<td class="props">boîtier 100 mil [THT, multilayer]; capacité 100nF; tension 50V</td>
</tr><tr>
<td>C2</td>
<td>Ceramic Capacitor</td>
<td class="props">boîtier 100 mil [THT, multilayer]; capacité 100nF; tension 50V</td>
</tr><tr>
<td>C3</td>
<td>Ceramic Capacitor</td>
<td class="props">boîtier 100 mil [THT, multilayer]; capacité 100nF; tension 50V</td>
</tr><tr>
<td>C4</td>
<td>Ceramic Capacitor</td>
<td class="props">boîtier 100 mil [THT, multilayer]; capacité 100nF; tension 50V</td>
</tr><tr>
<td>Composant1</td>
<td>Adafruit ADS1115 16Bit I2C ADC</td>
<td class="props">variante variant 2; numéro du composant Adafruit #1115</td>
</tr><tr>
<td>Fuse1</td>
<td>Fuse </td>
<td class="props">variante variant 1; datasheet https://www.mouser.fr/datasheet/2/240/Littelfuse_Fuse_251_253_Datasheet_pdf-522535.pdf; manufacturer little fuse</td>
</tr><tr>
<td>J6</td>
<td>Screw terminal - 14 pins</td>
<td class="props">Taille du trou 1.0mm,0.508mm; espacement des broches 0.137in (3.5mm); boîtier THT; broches 14</td>
</tr><tr>
<td>LM358-1</td>
<td>LM358</td>
<td class="props">boîtier dip08; chip lm358</td>
</tr><tr>
<td>LM358-2</td>
<td>LM358</td>
<td class="props">boîtier dip08; chip lm358</td>
</tr><tr>
<td>LM358-3</td>
<td>LM358</td>
<td class="props">boîtier dip08; chip lm358</td>
</tr><tr>
<td>LM358-4</td>
<td>LM358</td>
<td class="props">boîtier dip08; chip lm358</td>
</tr><tr>
<td>R1</td>
<td>1kΩ Resistor</td>
<td class="props">espacement des broches 400 mil; tolérance ±0.1%; bands 4; boîtier THT; résistance 1kΩ</td>
</tr><tr>
<td>R2</td>
<td>1.5kΩ Resistor</td>
<td class="props">espacement des broches 400 mil; tolérance ±0.1%; bands 4; boîtier THT; résistance 1.5kΩ</td>
</tr><tr>
<td>R3</td>
<td>1kΩ Resistor</td>
<td class="props">espacement des broches 400 mil; tolérance ±0.1%; bands 4; boîtier THT; résistance 1kΩ</td>
</tr><tr>
<td>R4</td>
<td>1.5kΩ Resistor</td>
<td class="props">espacement des broches 400 mil; tolérance ±0.1%; bands 4; boîtier THT; résistance 1.5kΩ</td>
</tr><tr>
<td>R5</td>
<td>50Ω Resistor</td>
<td class="props">espacement des broches 400 mil; tolérance ±0.1%; bands 4; boîtier THT; résistance 50Ω</td>
</tr><tr>
<td>R6</td>
<td>1.5kΩ Resistor</td>
<td class="props">espacement des broches 400 mil; tolérance ±0.1%; bands 4; boîtier THT; résistance 1.5kΩ</td>
</tr><tr>
<td>R7</td>
<td>1kΩ Resistor</td>
<td class="props">espacement des broches 400 mil; tolérance ±0.1%; bands 4; boîtier THT; résistance 1kΩ</td>
</tr><tr>
<td>R8</td>
<td>1.5kΩ Resistor</td>
<td class="props">espacement des broches 400 mil; tolérance ±0.1%; bands 4; boîtier THT; résistance 1.5kΩ</td>
</tr><tr>
<td>R9</td>
<td>1kΩ Resistor</td>
<td class="props">espacement des broches 400 mil; tolérance ±0.1%; bands 4; boîtier THT; résistance 1kΩ</td>
</tr><tr>
<td>R10</td>
<td>10MΩ Resistor</td>
<td class="props">espacement des broches 400 mil; tolérance ±5%; bands 4; boîtier THT; résistance 10MΩ</td>
</tr><tr>
<td>R11</td>
<td>10MΩ Resistor</td>
<td class="props">espacement des broches 400 mil; tolérance ±5%; bands 4; boîtier THT; résistance 10MΩ</td>
</tr><tr>
<td>R12</td>
<td>10MΩ Resistor</td>
<td class="props">espacement des broches 400 mil; tolérance ±5%; bands 4; boîtier THT; résistance 10MΩ</td>
</tr><tr>
<td>R13</td>
<td>10MΩ Resistor</td>
<td class="props">espacement des broches 400 mil; tolérance ±5%; bands 4; boîtier THT; résistance 10MΩ</td>
</tr><tr>
<td>TRN3-1215</td>
<td>TRN3-1211</td>
<td class="props">variante 1211</td>
</tr><tr>
<td>TRN3-1215</td>
<td>TRN3-1211</td>
<td class="props">variante 1211</td>
</tr>
</tbody>
</table>
<h2>Shopping List</h2>
<table>
<thead>
<tr>
<th>Amount</th>
<th>Part Type</th>
<th>Properties</th>
</tr>
</thead>
<tbody>
<tr>
<td>4</td>
<td>Ceramic Capacitor</td>
<td class="props">boîtier 100 mil [THT, multilayer]; capacité 100nF; tension 50V</td>
</tr><tr>
<td>1</td>
<td>Adafruit ADS1115 16Bit I2C ADC</td>
<td class="props">variante variant 2; numéro du composant Adafruit #1115</td>
</tr><tr>
<td>1</td>
<td>Fuse </td>
<td class="props">variante variant 1; datasheet https://www.mouser.fr/datasheet/2/240/Littelfuse_Fuse_251_253_Datasheet_pdf-522535.pdf; manufacturer little fuse</td>
</tr><tr>
<td>1</td>
<td>Screw terminal - 14 pins</td>
<td class="props">Taille du trou 1.0mm,0.508mm; espacement des broches 0.137in (3.5mm); boîtier THT; broches 14</td>
</tr><tr>
<td>4</td>
<td>LM358</td>
<td class="props">boîtier dip08; chip lm358</td>
</tr><tr>
<td>4</td>
<td>1kΩ Resistor</td>
<td class="props">espacement des broches 400 mil; tolérance ±0.1%; bands 4; boîtier THT; résistance 1kΩ</td>
</tr><tr>
<td>4</td>
<td>1.5kΩ Resistor</td>
<td class="props">espacement des broches 400 mil; tolérance ±0.1%; bands 4; boîtier THT; résistance 1.5kΩ</td>
</tr><tr>
<td>1</td>
<td>50Ω Resistor</td>
<td class="props">espacement des broches 400 mil; tolérance ±0.1%; bands 4; boîtier THT; résistance 50Ω</td>
</tr><tr>
<td>4</td>
<td>10MΩ Resistor</td>
<td class="props">espacement des broches 400 mil; tolérance ±5%; bands 4; boîtier THT; résistance 10MΩ</td>
</tr><tr>
<td>2</td>
<td>TRN3-1211</td>
<td class="props">variante 1211</td>
</tr>
</tbody>
</table>
<p class="meta"><br/>Exported with Fritzing 0.9.4- http://fritzing.org</p>
</body>
</html>
G04 MADE WITH FRITZING*
G04 WWW.FRITZING.ORG*
G04 DOUBLE SIDED*
G04 HOLES PLATED*
G04 CONTOUR ON CENTER OF CONTOUR VECTOR*
%ASAXBY*%
%FSLAX23Y23*%
%MOIN*%
%OFA0B0*%
%SFA1.0B1.0*%
%ADD10R,3.047950X3.323970*%
%ADD11C,0.008000*%
%ADD10C,0.008*%
%LNCONTOUR*%
G90*
G70*
G54D10*
G54D11*
X4Y3320D02*
X3044Y3320D01*
X3044Y4D01*
X4Y4D01*
X4Y3320D01*
D02*
G04 End of contour*
M02*
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
; NON-PLATED HOLES START AT T1
; THROUGH (PLATED) HOLES START AT T100
M48
INCH
T1C0.125984
T100C0.030000
T101C0.032000
T102C0.035000
T103C0.040000
T104C0.045969
T105C0.031496
T106C0.039370
%
T1
X028451Y032048
X028451Y002048
X001451Y002048
X001451Y032048
T100
X016128Y020780
X009435Y007001
X015734Y026292
X015126Y020780
X007951Y013408
X009435Y005999
X008953Y013408
X014733Y026292
T101
X006451Y010048
X016175Y024930
X013325Y017615
X006451Y012048
X016175Y021930
X009451Y004048
X013325Y018615
X006451Y009048
X006451Y002048
X016325Y017615
X009451Y012048
X016175Y023930
X009451Y003048
X009451Y002048
X016325Y018615
X016175Y022930
X013325Y016615
X006451Y011048
X006451Y003048
X009451Y005048
X009451Y011048
X016325Y019615
X016325Y016615
X013175Y021930
X006451Y004048
X013175Y022930
X006451Y005048
X013175Y023930
X009451Y010048
X013175Y024930
X013325Y019615
X009451Y009048
T102
X018687Y023008
X013372Y007457
X001955Y009229
X022821Y020646
X022821Y016646
X021371Y020048
X021371Y016048
X011451Y017048
X021049Y012119
X003530Y010150
X018687Y019008
X003530Y009229
X003530Y014150
X011451Y008048
X001955Y005229
X011451Y022048
X011451Y007048
X003530Y005229
X017049Y012119
X011451Y013048
X011451Y018048
X013372Y003457
X018451Y014048
X011451Y003048
X018451Y018048
X011451Y012048
T103
X025356Y026303
X025356Y012524
X025356Y015280
X025356Y011146
X025356Y022169
X025356Y020791
X025356Y019414
X025356Y016658
X025356Y024925
X025356Y027681
X025356Y029059
X025356Y023547
X025356Y018036
X025356Y013902
T104
X020262Y007788
X019475Y002470
X017585Y007788
X016797Y002470
X016797Y007788
X017585Y002470
X018687Y007788
X019475Y007788
X018687Y002470
X020262Y002470
T105
X021215Y014678
X023215Y014678
T106
X008451Y022930
X008451Y025930
X008451Y016930
X008451Y019930
X008451Y018930
X008451Y024930
X008451Y017930
X008451Y020930
X008451Y021930
X008451Y023930
T00
M30
This diff is collapsed.
This diff is collapsed.
*Pick And Place List
*Company=
*Author=
*eMail=
*
*Project=card_measure_raspberry_v3.04
*Date=21:47:16
*CreatedBy=Fritzing 0.9.4.2019-12-01.CD-498-0-a1ffcea
*
*
*Coordinates in mm, always center of component
*Origin 0/0=Lower left corner of PCB
*Rotation in degree (0-360, math. pos.)
*
*No;Value;Package;X;Y;Rotation;Side;Name
1;;dip08;37.6566;-46.0127;90;Bottom;LM358-1
2;;THT;64.9137;-51.1885;0;Bottom;J6
3;1k;THT;29.0867;-50.9226;90;Bottom;R3
4;;;31.6324;-76.3844;0;Bottom;TXT3
5;;;72.2988;-45.686;0;Bottom;TXT2
6;50;THT;54.2835;-45.8426;-90;Bottom;R5
7;;;3.68675;-5.20256;0;Bottom;Hole4
8;100nF;100 mil [THT, multilayer];23.9666;-16.5079;-90;Bottom;C3
9;1.5k;THT;29.0867;-38.2226;90;Bottom;R4
10;10M;THT;48.3867;-30.7827;0;Bottom;R11
11;;;3.68675;-81.4026;0;Bottom;Hole3
12;;;72.2988;-31.6258;0;Bottom;TXT2
13;100nF;100 mil [THT, multilayer];21.4667;-34.0573;0;Bottom;C4
14;100nF;100 mil [THT, multilayer];39.692;-52.7827;0;Bottom;C2
15;;;72.2668;-81.4026;0;Bottom;Hole2
16;1k;THT;8.96676;-30.8626;90;Bottom;R7
17;1k;THT;47.4667;-53.3627;90;Bottom;R1
18;;;72.2986;-49.4567;0;Bottom;TXT2
19;;;72.2988;-42.2225;0;Bottom;TXT2
20;;;72.2987;-28.0842;0;Bottom;TXT2
21;;;56.4267;-37.2826;0;Bottom;Fuse1
22;;;14.7992;-54.4326;-90;Bottom;Composant1
23;1.5k;THT;8.96676;-18.3627;90;Bottom;R6
24;;dip08;37.2768;-59.5126;90;Bottom;LM358-2
25;;;72.2668;-5.20256;0;Bottom;Hole1
26;;;47.0689;-6.2461;0;Bottom;TRN3-1215
27;1k;THT;29.0867;-25.5226;90;Bottom;R9
28;;;60.2127;-12.9351;0;Bottom;TXT3
29;;;72.2987;-63.1096;0;Bottom;TXT2
30;;;51.2658;-40.8438;0;Bottom;TXT6
31;;;72.2986;-56.1372;0;Bottom;TXT2
32;;;72.2987;-66.3947;0;Bottom;TXT2
33;;;11.0396;-53.884;0;Bottom;TXT4
34;;;72.2987;-35.6898;0;Bottom;TXT2
35;;;72.2986;-52.4952;0;Bottom;TXT2
36;100nF;100 mil [THT, multilayer];38.6921;-66.7827;0;Bottom;C1
37;;;72.2986;-39.0222;0;Bottom;TXT2
38;10M;THT;4.96655;-18.3627;90;Bottom;R12
39;;dip08;20.1967;-9.01264;90;Bottom;LM358-3
40;;;72.2987;-59.6624;0;Bottom;TXT2
41;1.5k;THT;29.0867;-12.8226;90;Bottom;R8
42;1.5k;THT;46.8667;-40.7626;90;Bottom;R2
43;;;72.2987;-70.299;0;Bottom;TXT2
44;10M;THT;33.9666;-13.8626;90;Bottom;R13
45;;;51.9042;-52.5271;0;Bottom;TXT5
46;;;72.2985;-73.8911;0;Bottom;TXT2
47;10M;THT;57.9668;-47.3626;90;Bottom;R10
48;;dip08;20.1967;-26.7926;90;Bottom;LM358-4
49;;;47.0692;-19.7527;0;Bottom;TRN3-1215
G04 MADE WITH FRITZING*
G04 WWW.FRITZING.ORG*
G04 DOUBLE SIDED*
G04 HOLES PLATED*
G04 CONTOUR ON CENTER OF CONTOUR VECTOR*
%ASAXBY*%
%FSLAX23Y23*%
%MOIN*%
%OFA0B0*%
%SFA1.0B1.0*%
%ADD10R,3.047950X3.323970X3.031950X3.307970*%
%ADD11C,0.008000*%
%LNSILK0*%
G90*
G70*
G54D11*
X4Y3320D02*
X3044Y3320D01*
X3044Y4D01*
X4Y4D01*
X4Y3320D01*
D02*
G04 End of Silk0*
M02*
\ No newline at end of file
This diff is collapsed.
File added
import RPi.GPIO as GPIO
import time , board, busio, numpy, os, sys, json, glob, statistics
from datetime import datetime
import adafruit_ads1x15.ads1115 as ADS
from adafruit_ads1x15.analog_in import AnalogIn
import pandas as pd
import os.path
from gpiozero import CPUTemperature
i2c = busio.I2C(board.SCL, board.SDA) # I2C protocol setup
ads = ADS.ADS1115(i2c, gain=2/3,data_rate=860)
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(7, GPIO.OUT)
GPIO.setup(8, GPIO.OUT)
coef_p0 = 2.47 # slope for current conversion for ADS.P0, measurement in V/V
coef_p1 = 2.47# slope for current conversion for ADS.P1, measurement in V/V
coef_p2 = 2.4748 # slope for current conversion for ADS.P2, measurement in V/V
coef_p3 = 2.4748 # slope for current conversion for ADS.P3, measurement in V/V
integer=1000
meas=numpy.zeros((4,integer))
for i in range(0,100) :
sum_I=0
GPIO.output(8, GPIO.HIGH) # current injection
time.sleep(4)
for i in range(0,integer) :
meas[0,i] = AnalogIn(ads,ADS.P3).voltage
GPIO.output(8, GPIO.LOW)
std=statistics.stdev(meas[0,:])
mean=statistics.mean(meas[0,:])
print(mean,std)
#print(2.4653*mean+0.0073, std)
time.sleep(4)
import psutil
print(psutil.virtual_memory())
\ No newline at end of file
dd.txt 0 → 100644
This diff is collapsed.
measurement.csv 0 → 100644
+ 10582
0
View file @ 1e07632d
This diff is collapsed.
{
"nb_electrodes": 32,
"nb_electrodes": 64,
"injection_duration": 0.5,
"nbr_meas": 1,
"sequence_delay": 30,
"sequence_delay": 10,
"stack": 1,
"export_path": "home/pi/Desktop/measurement.csv"
}
\ No newline at end of file
"export_path": "/home/pi/ohmpi1_5/measurement.csv"
}
test.py 0 → 100644
This diff is collapsed.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment