Exercises Day 2 TA#

1. Capacitor and Resistor in parallel#

In the circuit below, you will see a capacitor and a resistor in parallel. The voltage source alternates at 20Hz, going from -10 to +10 volts. The current travels over the resistor or via the capacitor to ground.

../_images/cap_res_parallel_sim.png

1A. Increase the value of the resistor to 200kOhm. What happens to the current through the resistor?

1B. Put the resistor back to 10kOhm. Now, increase the capacitance of the capacitor to around 10mF. What happens to the current?

1C. Return the values to 10kOhm and 100nF.

Change the frequency of the alternating signal to

  • 1000 Hz (action potentials!)

  • then to 1 Hz

You may have to change the simulation speed using the red slider at the top right, and adjust the x-scaling of the scope below (right-click / properties / and slide the ‘horizontal scale’).

How does the frequency of the signal relate to how much current crosses either the capacitor or the resistor?

1A. The current over the resistor becomes very small due to the increased resistance. There is a slight increase in current over the capacitor because impedances in parallel impedances diminish (through a reciprocal formula) to form the total impedance. See here for more info

1B. More current travels through the capacitor, its impedance has been reduced.

1C. High frequencies = low capacitor impedance = more current through capacitor relative to resistor. At 1 Hz the resistor has a higher max current.

2. The equivalent circuit of the electrode#

In the theory handout, we discussed how we can represent an electrode as a circuit containing a resistance and a capacitance. We’ll now build this equivalent circuit in the simulator.

2A. In the simulator, edit the circuit used above to build the equivalent circuit of a polarised, tungsten electrode. See the theory handout for more details.

Here are some values to use:

  • Rm: the DC resistance of the metal electrode wire, 10-100 Ohms.

  • Ce: the electrode tip capacitance, generated by the double layer generated around the electrode. Ce ~ 0.2 pF / µm2, so 10 - 20 pF (if the electrode is unplated)

  • Re: electrode tip resistance, in parallel with Ce. ~ 100 MOhm.

  • Edit the alternating voltage supply to provide 1V at 1Khz, mimicking the signal coming from your cell. 1V is larger than ephys signals, but makes the current flow easier to see. Change the sliders for simulation speed and current speed until you can see where the current is flowing.

2B. What happens if you delete the resistor Re?

2C. Bonus exercise: Can you change this circuit from a polarising, tungsten electrode, to a circuit representing a nonpolarizable electrode?

2A: Circuit of electrode: https://tinyurl.com/yzzjjvdk

../_images/electrode_eq_circuit.png

2B: They should not see much difference if the electrode is only represented by capacitor, because the capacitance of a polarising electrode has the largest effect on the current due to the high resistance of the resistor.

2C: Reduce the resistance of Re until current can flow through Re.

3. Shunt Impedance#

Here is the circuit of the electrode with a shunt impedance added of 100 pF:

../_images/day2circuit.png

3A. What is shunt impedance here?

3B. What % of our signal are we losing between Vec and Vin? Why?

3C. What could we change to increase the signal at Vin?

3D. The tips of certain electrodes, e.g. nichrome tetrodes, can be electroplated in a thin layer of gold. This ‘goldplating’ increases the surface area of the tip, creating more space to separate charge. This increases tip capacitance by around 100x. Make this change in the circuit simulator. How similar are Vec and Vin now?

3A: Shunt impedance = Shunt capacitance Csh + shunt resistance Rsh. These are both routes to ground outside of the intended acquisition system. At the high frequencies (1kHz) we are interested in, the capacitive component will have low impedance, and will therefore have more effect than the resistive component, so Rsh is often ignored. Technically this is just the equivalent circuit of the electrode, so shunt impedance here would be the capacitance along the side of the electrode.

Remember that any two conducting surfaces, with a non-conducting layer in between, is a capacitor. Shunt capacitance arises mainly from the capacitance across the thin insulation layer isolating an electrode and the surrounding electrolyte, as well as the cumulative capacitance along cables and connectors (Robinson, 1968).

3B: There should be 655 mV left of our 5V signal. Vec = 5V, Vin = 655mV, we are losing 87% of our signal because the capacitor of our electrode and the shunt capacitance are forming a voltage divider.

3C: We can change the impedance ratio to change the Vin.

\[Vin = \frac{Zsh}{Ze+Zsh} Vec\]

We want Vec to be multiplied by a ratio that is close as possible to 1. We can do that by decreasing Ze (the impedance of the electrode) by increasing the capacitance of the electrode. There’s not much we can do to increase Zsh, though in theory that would help; we essentially do this by designing high input impedance amplifiers.

3D: Gold plated electrode circuit: the increased capacitance decreases impedance. Circuit here: https://tinyurl.com/y6p3trme. Students can get impedance and capacitance mixed up and forget they go in opposite directions.

Recording Circuit#

To actually perform a recording, we will have to attach the electrode to the rest of an acquisition system. The recording system has an analog to digital converter (ADC), and a recording computer. The leakage resistance here is where the recording system is connected to ground.

../_images/day2withac.png

3E. How much of the voltage at the electrode, Vec, are we recording at Vout?

3F. Add a headstage to this circuit, by placing an ideal operational amplifier between the electrode and the long wire. What happens to Vout? Why?

3G. Change the circuit to stop the amplifier from saturating. What is the amplifier gain now?

3E:

  • Vec = 1V

  • Vout = 5.027 mV

  • We are recording 0.5%

3F:

Place op amp through:

Menu/Active construction blocks/OpAmp. Result: https://tinyurl.com/y68o5n4o Some students will already put the negative feedback in here, just make sure they understand why and what happens without it. Without negative feedback:

Vout hits +- 15V, it is saturating to the value of the power rails, because it has very very high gain. It is calculating the difference between + and - multiplying it by its huge gain.

3G:

../_images/sim_headstage_added.png

We need to do something to prevent our amplifier from always hitting power-rail values. We can provide negative feedback to the amplifier by looping the output back and feeding it into one of the terminals. Connect the amplifier output to the inverting input. The amplifier is going to do the same thing as before; output the difference between + and - multiplied by its huge gain. The output will rise rapidly, however this time, as soon as it reaches the value of the + terminal, the + and – are the same value and there’s no difference left to amplify.

Now we’re just seeing our input signal replicated at the output of the amplifier with a gain of 1.

4. Operational Amplifiers#

We will now build the same circuit on the breadboard. The Teensy ‘Blink’ signal will act as our neuronal data, that will travel across electrode and shunt impedances before reaching the oscilloscope to be recorded. Our goal is to get as much of the Blink signal as possible to reach our oscilloscope recording system.

In the theory handout, we discussed the importance of headstages. We’ll test that now, by building the recording circuit without and with an amplifier acting as a headstage.

  • ‘Neuron’ = Digital blink output from Teensy

  • ‘Electrode’ = 100 kOhm resistor

  • ‘Shunt’ = 22kOhm resistor

  • ‘Leak’ = 220Ohm resistor

  • ‘Recording system’ = the Picoscope

../_images/circuitday2.png

4A. Recording circuit without an amplifier#

4A. Upload the Blink example to your teensy (or just run it if still loaded).

Build the circuit below:

  • Send the Teensy output through a 100 KOhm resistor. This makes it behave a bit like a biological signal coming from an electrode.

  • A 22kOhm resistor to ground simulates shunt impedance.

  • A 220 Ohm resistor to ground simulates that your acquisition system is connected to ground (via some resistance).

  • The yellow wires are ‘readout’ wires to connect your oscilloscope to.

../_images/resistors_amplifier_breadboard.png ../_images/fritz_wire_only_blink.png ../_images/wire_only_blink.png

4B. Use the oscilloscope to measure the peak to peak voltage amplitude recorded at three points:

(+) Probe Location

Circuit 1, without amplifier

Circuit 2, with amplifier

  1. Teensy Pin 13

  1. Readout Wire 1

  1. Readout Wire 2

4C. How much signal is lost?

4B. Recording circuit with amplifier#

Build voltage rails#

Warning

Make sure that the pins from the batteries do not touch, and if they’re not in use, best to put some tape on them so they don’t touch things. ‘Short-circuiting’ the batteries (connecting them without any sort of resistance) causes a huge current to flow from the + to -, enough to… melt stuff.

We need to provide our op-amp with power. We will use batteries to make voltage ‘rails’. We are going to make a -3V and +3V rail. To do this we use a common trick and turn two regular power supplies into a bipolar power supply. In our case we use batteries, because they’re cheap and pretty much fully noise-free. Check which way up your breadboard is (keep the blue line at the top). Following the figures precisely will make debugging much easier later on.

4D. Connect the battery holders as follows:

  • The first pair of batteries provides +3V from the red wire (goes to red rail on breadboard), and 0 from the black wire (goes to blue rail on breadboard).

  • The two blue rails of the breadboard are connected through a wire, setting them both to 0V.

  • The second pair of batteries is reversed (red wire goes to blue rail, black wire to red rail). This provides -3V relative to ground.

  • Remember or label which side is +3 and which is -3

../_images/bipolar_power_supply.png ../_images/fritz_bipolar_power_supply.png

Add bypass capacitors#

Bypass capacitors are small capacitors that act like little secondary batteries. The batteries we use have a high ESR - ‘equivalent series resistance’, and some capacitance. This means that are not great at quickly providing current. Because of this, when our op-amp starts working, it can run out of current for a very short time until the battery can drive the rails back to their original voltage. This is bad for the signal quality.

So, we allow these small capacitors to charge. If the battery briefly can’t provide current, the bypass capacitors will discharge, providing quick back-up current. We’re exploiting the fact that these caps have very low ESR and can provide current pretty much instantaneously. The fact that they’re too small to power anything for more than a millisecond does not matter here, at that point the batteries have caught up.

4E. Add two 100nF (marked 104) caps, one to each rail, so connecting GND to 3V and connecting GND to -3V.

../_images/fritz_bipolar_power_supply.png

Add a ‘headstage’#

We will replace our long wire with a ‘headstage’. We will use only the most basic part of the headstage, an operational amplifier.

This is the op-amp you have. Make sure you’re looking at the op-amp (AS358P), not the instrumentation amp.

../_images/op_amp_pinout.png

4F. Add the op-amp to the circuit.

  • Place the op-amp on your breadboard, with the semicircle cutout on the left.

  • Connect the +3 voltage rail to ‘Vcc+’ and the -3 voltage rail to ‘Vcc-‘

  • Put the electrode output wire into the + input of your op-amp, and the output of the op-amp into the ‘wire’ simulation circuit.

  • Feed the output of the op-amp, back into the – input.

4G. Now measure the same three points as before and complete the table in question 4B. -

4H. Optional: try changing the resistances you’ve used for electrode, shunt, and leakage. What happens to the signal?

4G. Optional: Measure the same points in the simulator as you did on the breadboard. How do they compare?

../_images/fritz_headstage_blink.png ../_images/amp_headstage_blink.png

The wire now cannot destroy our signal, because even though we did not amplify it at all (we only have unity gain) we ‘buffered’ it. Now the op-amp can push as much current into the wire as is needed and your signal makes it through.

It might be tricky to understand that one has the same value in rows 2 and 3 of the op-amp headstage configuration, since we are adding an amplifier and one would expect the signal to have been amplified. But our amplifier has unity gain here, so that is why there is no amplification, and it highlights its important function of protecting our signal by not drawing current from the source thanks to its huge input impedance.

Optional exercise 4H: Make a version of this circuit that’s more similar to ephys signals by using a sinewave.

  • Send sinewave (code in day 1) to pin A14 (no header soldered there but can use a wire, connection is a bit unstable)

  • make it faster (at least 20 Hz, it’s still slower than ephys but they get the idea)

  • Use capacitors instead of Resistors, e.g. 104 for electrode, 22 for shunt

  • Connect Agnd to ground

Optional exercise 4G:

(+) Probe

Wire-only (simulator)

Wire-only (breadboard)

Op-Amp (simulator)

Op-Amp (breadboard)

  1. Teensy Pin 13

3.3 V

3.3 V

3.3 V

3.3 V

  1. Readout Wire 1

7.17 mV

8.4mV

595 mV

600mV

  1. Readout Wire 2

7.17 mV

8.4mV

595 mV

600mV