Exemplo n.º 1
0
        def __init__(self):
                SPI_data = 16
                SPI_clock = 21
                SPI_latch = 20
                self.heat_relay = 12

                wiringpi2.wiringPiSetup()

                self.thermocouple = thermocouple.thermocouple()
                self.thermocouple.setup(SPI_data, SPI_clock, SPI_latch)

                self.relay_state = 0
                wiringpi2.pinMode(self.heat_relay,1)
                wiringpi2.digitalWrite(self.heat_relay, self.relay_state)
Exemplo n.º 2
0
__author__ = "Eric Yeung"

data = np.loadtxt('final_data_withouttime.txt')

thermocouple_voltage = data[:,0]
voltage = data[:,1]

# Imports the thermocouple modulue by David Bailey 
from thermocouple import thermocouple

# There was a linear offset of the form mx + b, where m = 10 and b = 1.5
for i in range(len(thermocouple_voltage)):
	thermocouple_voltage[i] = 10*thermocouple_voltage[i] + 1.5

temperature = np.array(thermocouple('E', thermocouple_voltage, 'mV'))

"""
Assuming the current changes linearly with as many
spaces as the amount of data points for voltage.
Our initial current was 3.640 mA and the final current
was 4.348 mA. 
"""
current = np.linspace(3.640, 4.348, len(voltage))

# Assuming material is ohmic, use ohm's law
resistance = voltage/current 

# We used 20 mA range so our uncertainity is +/- 0.07%, this is absolute uncert:
currentError = 7e-4*current
Exemplo n.º 3
0
__author__ = "Eric Yeung"

data = np.loadtxt('final_data_withouttime.txt')

thermocouple_voltage = data[:, 0]
voltage = data[:, 1]

# Imports the thermocouple modulue by David Bailey
from thermocouple import thermocouple

# There was a linear offset of the form mx + b, where m = 10 and b = 1.5
for i in range(len(thermocouple_voltage)):
    thermocouple_voltage[i] = 10 * thermocouple_voltage[i] + 1.5

temperature = np.array(thermocouple('E', thermocouple_voltage, 'mV'))
"""
Assuming the current changes linearly with as many
spaces as the amount of data points for voltage.
Our initial current was 3.640 mA and the final current
was 4.348 mA. 
"""
current = np.linspace(3.640, 4.348, len(voltage))

# Assuming material is ohmic, use ohm's law
resistance = voltage / current

# We used 20 mA range so our uncertainity is +/- 0.07%, this is absolute uncert:
currentError = 7e-4 * current

# Couldn't find error for lockin, use error of signal generator instead
Exemplo n.º 4
0
decreasingdata = data[peak:, :]

wheatvoltage1 = increasingdata[:, 1]
wheatvoltage1_error = 0.02 * wheatvoltage1
thermocouple_voltage1 = increasingdata[:, 2]

wheatvoltage2 = decreasingdata[:, 1]
wheatvoltage2_error = 0.02 * wheatvoltage2
thermocouple_voltage2 = decreasingdata[:, 2]
""" 
Convert type T thermocouple voltage into temperature
"""

from thermocouple import thermocouple

temperature1 = np.array(thermocouple('T', thermocouple_voltage1, 'mV'))
temperature2 = np.array(thermocouple('T', thermocouple_voltage2, 'mV'))

temperature1_error = 0.0075 * temperature1
temperature2_error = 0.0075 * temperature2
"""
Start the plotting for wheatstone voltage vs temperature
"""

plt.figure(1)
plt.plot(temperature1, wheatvoltage1, color='r', label='Heating up')
plt.plot(temperature2, wheatvoltage2, color='b', label='Cooling down')

# Too many datapoints, uncomment to see the errorbars

#plt.errorbar(temperature1, wheatvoltage1, xerr = temperature1_error,
Exemplo n.º 5
0
wheatvoltage1 = increasingdata[:,1]
wheatvoltage1_error = 0.02*wheatvoltage1
thermocouple_voltage1 = increasingdata[:,2]

wheatvoltage2 = decreasingdata[:,1]
wheatvoltage2_error = 0.02*wheatvoltage2
thermocouple_voltage2 = decreasingdata[:,2]

""" 
Convert type T thermocouple voltage into temperature
"""

from thermocouple import thermocouple 

temperature1 = np.array(thermocouple('T', thermocouple_voltage1, 'mV'))
temperature2 = np.array(thermocouple('T', thermocouple_voltage2, 'mV'))

temperature1_error = 0.0075*temperature1
temperature2_error = 0.0075*temperature2

"""
Start the plotting for wheatstone voltage vs temperature
"""

plt.figure(1)
plt.plot(temperature1, wheatvoltage1, color = 'r', label = 'Heating up')
plt.plot(temperature2, wheatvoltage2, color = 'b', label = 'Cooling down')

# Too many datapoints, uncomment to see the errorbars