test_name = 'constant' # Name of test to run - constant volate voltammetery curr_range = '100uA' # Name of current range for test [-10uA, +10uA] sample_rate = 100.0 # Rate (samples/sec) at which to collect samples test_param = { 'quietValue': 0.0, # Output voltage during quiet peroid 'quietTime': 1000, # Duration of quiet period (ms) 'value': 2.5, # Output volatage (V) durring constant voltage test 'duration': 4000, # Duration of constant voltage test (ms) } # Create Device object and set sample rate, current range and test parameters dev = Potentiostat(port) dev.set_sample_rate(sample_rate) dev.set_curr_range(curr_range) dev.set_param(test_name, test_param) # Run cyclic voltammetry test t, volt, curr = dev.run_test(test_name, display='pbar', filename=datafile) # plot results using matplotlib plt.subplot(211) plt.title('Voltage and current vs time') plt.plot(t, volt) plt.ylabel('potential (V)') plt.ylim(0, test_param['value'] * 1.1) plt.grid('on') plt.subplot(212) plt.plot(t, curr) plt.ylabel('current (uA)')
from potentiostat import Potentiostat import sys if len(sys.argv) > 1: port = sys.argv[1] else: port = '/dev/ttyACM0' dev = Potentiostat(port) dev.set_curr_range('100uA') dev.set_sample_period(10) name = 'constant' param = { 'quietValue' : 0.0, 'quietTime' : 1000, 'value' : 1.0, 'duration' : 5000, } dev.set_param(name,param) t,volt,curr = dev.run_test(name,display='pbar')
# Multistep Test Data { 'quietValue': 0.0, 'quietTime': 1000, 'step': [(1000, -0.5), (1000, -0.2), (1000, -0.3), (1000, -0.0), (1000, -0.1), (1000, 0.3), (1000, 0.2), (1000, 0.5)], }, ] cpp = Potentiostat(port) cpp.set_curr_range(curr_range) cpp.set_sample_rate(sample_rate) print(test_name[int_test], test_data[int_test]) cpp.set_param(test_name[int_test], test_data[int_test]) t, volt, curr = cpp.run_test(test_name[int_test], display='pbar') file = open(datafile[int_test], 'w') file.write('Time \n' + str(t) + '\n' + 'Volt \n' + str(volt) + '\n' 'Curr \n' + str(curr) + '\n') plt.figure(1) plt.subplot(211) plt.plot(t, volt) plt.ylabel('potential (V)') plt.grid('on') plt.subplot(212) plt.plot(t, curr) plt.ylabel('current (uA)') plt.xlabel('time (sec)')
from __future__ import print_function from potentiostat import Potentiostat import sys if len(sys.argv) > 1: port = sys.argv[1] else: port = '/dev/ttyACM0' dev = Potentiostat(port) name = 'cyclic' param = { 'quietValue': 0.2, 'quietTime': 1500, 'amplitude': 1.52243432, 'offset': 0.1, 'period': 2000, 'numCycles': 5, 'shift': 0.12, } param_rsp = dev.set_param(name, param) print(param_rsp)
dev.set_curr_range('100uA') dev.set_sample_period(10) name = 'chronoamp' test_param = { 'quietValue': 0.0, 'quietTime': 1000, 'step': [ (0, 0.0), # Step 1 (duration ms, voltage) (29000, 0.5), # Step 2 (duration ms, voltage) ], } dev.set_param(name, test_param) t, volt, curr = dev.run_test(name, display='pbar', filename=datafile) plt.subplot(211) plt.title('Voltage and current vs time') plt.plot(t, volt) plt.ylabel('potential (V)') plt.ylim(0, max(volt) * 1.1) plt.grid('on') plt.subplot(212) plt.plot(t, curr) plt.ylabel('current (uA)') plt.xlabel('time (sec)') plt.grid('on')