For use with: Alpaca Kernel

17C - Implement and Investigate: Linear Potentiostat Model with Alpaca#

Goals#

  1. Build a simple model of the potentiostat on Alpaca

  2. Get an intuition for the (multiple) inversion of polarity between potentiostat’s control and readout

  3. Compute Icell from the measurements, and compose you first voltammogram

  4. Optional: Compute the range and accuracy of Icell

  5. Optional: Suppress the noise

Implement 1: Implement the linear Potentiostat Model#

It’s up to your decision whether you will use the Basic or the Advanced Design to implement the resistor-based Measurement Cell Model 1.

Design References#

Schematic: Basic Design - Model 1

Design Basic: Model 1 implementation on Alpaca


Schematic: Advanced Design - Model 1

Design Basic: Model 1 implementation on Alpaca


Fritzing: Alpaca's default jumpers

Alpaca - The starting point configuration for Voltammetry


Fritzing: Basic Design - Barebone with Relay

Basic Design: Barebone with Relay


Implement and Investigate 2.1: \(U_{\text{DAC}}\) and \(U_{\text{ADC}}\)#

Recall or derive the formula for \(U_{ADC}\) as a function of \(U_{\text{DAC}}\) for the chosen design.
Look up your results from 17A, and check Udac -> Udaq_assistant -> Ucell -> Ua -> Uadc. First we will noly look at Udac -> Uadc.

Take the relevant parameters into account, write a code to set a desired Udac and to measure Uadc.

Basic design

  • Udac_assistant = function of UdacA

  • Uadc = Uadc0 and/or Uadc=Uadc1

Advanced design

  • Udac = UdacA and/or Udac = UdacB

  • Uadc = Uadc0

Use resistors R1=10k, R2=10k and Rf=10k and set the attenuation for the ADCs to 1:1.

  1. Set Udac = 1V and Udac = -1V, and measure Uadc.

  2. Convert the measured Uadc to Volts and compare with the expected outcome. Pay attention to the correct sign in your results (polarity).

💡Hints: Custom functions

You may use functions included in picotools as a reminder on how to control the DAC and the readouts.

However, we recommend that you write your own functions, because in practice, adapting the existing unfamiliar functions for this purpose might take longer than writing your own.

Optional: Consider creating your own Python module for this project, for example: picovolt.py and import your functions with, for example:

import picovolt as pv
data = pv.function(param1, param2, ...)

  1. Write a code to loop over the Udac and to store the measured output voltages.

Basic Design
Perform a voltage sweep from Udac=-0.5V to Udac=1.5V and plot the measured Uadc

Advanced Design
Perform a voltage sweep from UdacA=0V to UdacA=2V and plot the measured Uadc

  • while UdacB=0V,

  • while UdacB=1V


Optional: Swap the parameters for UdacA with UdacB

💡Hint: Function Generator

You may in this assignment use the in-built Function Generator to extract a Triangle waveform with a required symmetry.

from functiongenerator import Triangle

triangle = Triangle(Vmin=V_min, Vmax=V_max, freq=1, symmetry=50) 
waveform = triangle.get_voltages(n=NUM_SAMPLES)

for ii in range(NUM_SAMPLES):
    dac_a.write(waveform[ii])

Conclude#

With help of the plots, reflect on:

Goal 2: Get an intuition for the (multiple) inversion of polarity between potentiostat’s control and readout

Implement and Investigate 2.2: Cell Potential#

Recall or derive the formula for \(U_{a}\) as a function of \(U_{\text{cell}}\) in Model 1. Now we dive into the voltages between Udac & Uadc: Udac -> Udaq_assistant -> Ucell -> Ua -> Uadc.

Use the experience from the previous section, and write a code that

  • sets Udac to generate the desired Ucell

  • and computes Ua from the measurement of Uadc.

Then,

  1. Run a measurement for Ucell = 1V and Ucell = -1V and extract the Ua.

    • Optional: Measure the actual Ucell with Ain2 as a reference signal for later.

💡 Hints

  • Remember to reset your Pico before the measurement and save the data

  • Choose to measure with or without -12V to Cria

  1. Compare the measured Ua with the expected outcome.

  1. Write a code to loop over the Ucell and to store the measured output voltages.

  1. Perform a voltage sweep Ucell=-1V to Ucell=1V and convert the measured signal to Ua

  1. Plot the measured Ua along with a calculated, expected Ua_ref and discuss any potential differences in each case.

  1. Save your results in a file and fetch it from Pico to your computer

Implement and Investigate 3: Cell Current#

Recall or derive the formula for \(I_{\text{cell}}\) as a function of \(U_{\text{cell}}\) for Model 1 in your design.

  1. Extract Icell from the measurement of Ua saved in Implement and Investigate 3: Cell Potential.

  1. Plot Icell as a function of Ucell.

  1. Optional: Include a suitable capacitor in your circuit to reduce the noise. Compute the cut-off frequency.

  1. Optional: Compute the accuracy and the noise in the measured Icell to evaluate the effect of the Noise filter.

  1. Optional: Replace the resistors with R1=R2=Rf=1k. Then, run the same measurement and plot Icell as a function of Ucell. Finally, compare the quality of this plot with the one recorded with the previous configuration.


Compare and Conclude#

⏳ Estimated time: 5 min

To be checked off by a TA#

  1. Present your plot of Icell over Ucell.

  2. Discuss your results from the optional tasks.


Optional - Implement and Investigate 4: Progress to Week 18#

I4.1: Optimise the range of detectable Icell to improve the Signal-to-Noise ratio.#

Recall or derive the formula for the range of Icell as a function of all relevant parameters in Model 1 for your chosen design.

Goal: Find out how to configure your Potentiostat to ensure that are making use of the avaialable limits to record the strongest signal within a predefined range of Icell.

  1. Compute the range of possible Icell as a function Rf (and in the Advanced Design as a function of Uoffset) for roughly the entire range of possible Ua with the given configuration of resistors.

    the range of Ua is the range of the possible outputs of OPAMP2:
    Basic - positive and negative,
    Advanced - only positive.

  1. Select Rf to increase the current-to-voltage conversion factor and to utilise roughly the entire range of Ua without causing clipping on OPAMP2, and adjust the attenuation of AMPs to capture the signal from Ua without clipping the ADCs.

    Note that it could be optimal to slightly re-adjust the value of Rf because there are only a few available options of attenuation factors. It is also fine to leave some margins.

    Advanced Design: Focus on optimising the range for the positive currents first, so do not change the Uoffset yet. Notice what effect the change of Rf has on the Icell range for the negative currents.

  1. Advanced Design: Derive a formula for setting a desired range of detectable Icell and describe the method to adjust that range while maintaining a fixed range of Ucell.

    Consider writing a function to compute that Icell range for a given set of parameters or to compute the required parameters for a given range of currents.

  1. Pre-compute several essential Icell ranges for a pre-defined set of ranges of Ucell.

    Optional: Write a function to compute the required parameters on demand.

I4.2: Noise reduction#

Filtering#

Figure out how to estimate the bound for a suitable the cut-off frequency of your filter that will only negligibly affect your Voltammetry measurements.

Averaging#

Gather ideas on how to write an optimised code for measurements with averaging to reduce its effect on the timing precision.