Ohm's law states that the current through a conductor between two points is directly proportional to the voltage
across the two points[wikipedia].
| | |
#Example Python code to demostrate ohm low.
from I2Brick import *
import matplotlib.pyplot as plt
%matplotlib inline
port = I2Brick('COM7') #Windows: Initialize serial communication with I2Bricks
#port = I2Brick('/dev/ttyUSB0') #Linux: Initialize serial communication with I2Bricks
print(ard(port)) #test communication between ARD and PC
R_sense=100
voltage=[]
current=[]
for v in range (0, 4000,100):
dac(port,0, v) #set dac voltage
ADC0 = adc(port,0) #read adc0 voltage
ADC1 = adc(port,1)
if (ADC0<0 or ADC0>4096): ADC0 = 0
if (ADC1<0 or ADC1>4096): ADC1 = 0
voltage.append((ADC0 - ADC1)/1000) #calculate voltage
current.append(ADC1/R_sense) #calculate current
port.close()
plt.plot(voltage, current)
plt.plot(voltage, current,label='Resistor R= 1 kOhm')
plt.axis([0,3,0,3])
plt.title('i-v curve')
plt.legend()
plt.xlabel('Voltage [V]')
plt.ylabel('Current [mA]')
plt.show()
Advanced Semiconductor Analyser For comparison, an identical test of 1 kOhm resistor was conducted with a Peak Electronics Atlas DCA75 Pro Advanced Semiconductor Analyser (right).
| | |
There are more results for the simple I2Bricks I-V curve tracer controlled by Python code below. |
| | |
| | |
| | |