iorodeo/potentiostat

Shifted 100Hz Sinusoid and Sample Rate Problem

Closed this issue · 6 comments

Hello,
I have a problem when I try to make a sinusoid with a 20ms period (or 50Hz) with a 2V amplitude. It works but instead of behind centered on 0, it is centered on -2V. How to correct this problem ? Using 'shift' doesn't do anything, and when using 'offset' it just does a flat voltage at the offset value.

Furthermore, I have an issue understanding sample rate. Is the sample rate simply the number of measurements every second and is just used to make the graph ? And no matter the sample rate the sinusoid follow its parameters ? Or does it give an output voltage according to the sample rate ? And thus the sample rate is critical to make the system work correctly ?
If the second explanation is correct, then I must tune the sample rate to match the period I want to set right ?
I have get it to work by putting 5 sample per period (changing the sample_rate to keep this rate for every period I set) but I need to understand it.

Thank you for your response

The sample rate is simply the number of measurements per seconds which are sent back to the host pc. The output waveform generated using an outscan rate of 5kHz which is set using a hardware Timer on the microcontroller.

The sample rate you use is still quite important though as you will want to have a high enough sample rate to get sufficient measurements per cycle of your sinusoid. The maximum sample rate for the Rodeostat is 1000Hz when using the Python API and 200Hz when using the web app. For this application I would suggest using the Python API with a sample rate of 1000Hz as this will at least give you 20 points per waveform. With the webapp and a sample rate of 200Hz you will only get 5 points per cycle which isn't a lot.

Regarding the parameters for the sinusoidal test.

The "shift" parameter is a unit-less phase shift parameter. It is used to specify the phase shift for the sinusoid. It takes values in the range of 0 to 1. For a sinusoid the phase shift in degrees will be 360 times the value of shift parameter (360 x shift). So if shift=0 you get a sinewave (0 degree phase shift) , if shift=0.25 you get a cosine (90 degree phase shift), etc. This parameter won't have any effect of the offset of the waveform.

The "offset" parameter sets the offset of the waveform from zero. This is essentially just a voltage which is added to the sinusoidal waveform. When offset=0 the sinusoid will be centered on 0V. When the offset=1 the sinusoid will be centered on 1V, etc.

You can find a description of the parameters for the sinusoidal test here https://iorodeo.github.io/iorodeo-potentiostat-docs-build/tests.html#sinusoidal-voltammetry

I would start by running some examples using the 50k dummy cell which comes with the Rodeostat. The following Python script will run a 50Hz sinusoid with a 2V amplitude. The sample rate is 1000Hz and the waveform is centered on 0V.

from potentiostat import Potentiostat
import sys
import matplotlib.pyplot as plt

port = '/dev/ttyACM0'
dev = Potentiostat(port)
dev.set_curr_range('100uA')
dev.set_sample_rate(1000.0)

name = 'sinusoid'
param = {
        'quietValue' : 0.0,
        'quietTime'  : 100,
        'amplitude'  : 2.0,
        'offset'     : 0.0,
        'period'     : 20,
        'numCycles'  : 10,
        'shift'      : 0.0,
        }

dev.set_param(name,param)
t,volt,curr = dev.run_test(name,display='pbar')

fig, ax = plt.subplots(2,1)
ax[0].plot(t,volt)
ax[0].set_ylabel('(V)')
ax[0].grid(True)
ax[1].plot(t,curr)
ax[1].set_ylabel('(uA)')
ax[1].set_xlabel('t (sec)')
ax[1].grid(True)
plt.show()

The current range is important whenever you are a test which involves measuring current. If current goes outside of the selected current range the measurement will saturate.

The device also has some intrinsic current limitations in that it can only source and sink so much current. I would recommend keeping the current with in ±10mA.

Yes the Rodeostat is a potentiostat. It uses feedback to control the voltage between the working and reference electrodes using the counter electrode as an actuator. When doing this it is said to be operating in closed-loop. However, there is an easy solution for your application. You can operate the device in open-loop by connecting the reference and counter electrode outputs together. This will essentially remove the potentiostat's feedback loop. The reference and counter electrode will now always be at the same potential. You now have a two electrode device with working electrode and a combined "counter/reference" electrode. Now when you operate the device will just directly set the potential between the working and combined "counter/reference" electrode in an open-loop fashing without feedback control.