1 of 142

Ephys & Behaviour

TENSS 2025, Day 1, version 2

2 of 142

  • https://tenss.github.io/TENSS_Electronics/

3 of 142

Learning goals (1)

By Dhp1080, svg adaptation by Actam - Image:Neuron.svg, CC BY-SA 3.0, https://commons.wikimedia.org/w/index.php?curid=4293768

How is the extracellular potential affected by neuronal activity?

How can we record these potential changes?

How do we get single neurons from these recordings?

4 of 142

5 of 142

What we want to understand

6 of 142

Electronics

FROM RESISTOR TO SPIKE

7 of 142

Brains are boring

8 of 142

Brains are boring until you give them a body

9 of 142

Learning goals (2)

How can we measure behaviour and perform closed loop experiments?

10 of 142

Building a recording setup

11 of 142

Building a recording setup

https://www.kiddiwinks.co.za/news/2016/09/7-benefits-of-lego-play-for-kids-and-adults/

Recording

software

Sensor

Actuator

OpenEphys board

12 of 142

Figure in the Paper

13 of 142

Figure in the Paper Reality

14 of 142

Real life is messy

15 of 142

Fearless creativity, duck tape and a bit of solder can go a long way

16 of 142

Let’s try to make something that works somehow

FROM RESISTOR TO SPIKE

BEHAVIOUR

17 of 142

Learning goals (3)

How to synchronise the data streams we acquired?

How do we go from data to figure (a.k.a minimal data analysis)?

https://www.cleanpng.com/

18 of 142

What will we analyse?

  • EEG?
  • LFP?
  • Head-fixed recording?
  • Freely moving recording?
  • Behaviour tracking

FROM RESISTOR TO SPIKE

ANALYSIS

BEHAVIOUR

19 of 142

20 of 142

What is electricity?

The bunch of stuff that happens when a

kind of thing moves around

21 of 142

Charge, q

  • Conserved quantity, one of only 4! (energy, angular momentum, linear momentum and charge)

The net charge of an isolated system is constant

  • Fundamental property

Proton: +e

Electron: -e

  • Positive and negative
  • Units: Coulombs (C) = 6.241509×1018 e

22 of 142

Coulomb's inverse-square law

23 of 142

Gravity vs. electric forces

24 of 142

Voltage: potential difference

+

  • Electric field: Force that would be felt by a test charge at each point

+

25 of 142

Voltage: potential difference

  • Voltage (V) = Potential difference between two points

+

  • Electric field: Force that would be felt by a test charge at each point

q

q

26 of 142

Hydraulic analogy: voltage

Voltage is a difference in electrical potential.

It is measured between two distinct points.

Analog to water pressure in a pipe.

A single point has no measurable voltage.

gemini

High potential

Low potential

Intermediate potential

High voltage

Low voltage

27 of 142

Current: charge in motion

Current (I): how much charge (Q) moves through a given area in time t

Units: Amperes (Amps) = Coulomb / sec

What factors will influence I?

28 of 142

Hydraulic analogy: current

Hydraulic

  • Rate of water flowing through a pipe

Electrical

  • Rate of charged particles through a conductor
  • e.g. Electrons in metal
  • e.g Ions in solution

29 of 142

Current: charge in motion

Current (I): how much charge (Q) moves through a given area in time t

What factors will influence I?

  1. Voltage/E-field: stronger means more current�
  2. Conduction medium: how good is it at allowing charge to move?

30 of 142

Current paths

  • Large Voltage difference
  • Strong electrical force
  • Metal: good conductor
  • How much charge flows?���

~50kV

31 of 142

Current paths

  • Large Voltage difference
  • Strong electrical force
  • Metal: good conductor
  • How much charge flows?��
  • None (ideally)
  • Large resistance (R)
    • Air
    • Ceramic insulators

~50kV

R

R

R

R

R

R

32 of 142

Hydraulic analogy: resistance

Hydraulic

Constriction or blockage in pipe

Electrical

Impurities and thermal motion that disturb the flow of charged particles

33 of 142

Resistance

  • Charge particles are accelerated in an electric field but slam into stuff on along their path�
  • This jiggles the stuff they slam into (heat)�
  • In some materials motion is impeded so much, that ~no charge will flow (I = 0)�
  • Units: Ohms (Ω) = Volts/Amps

34 of 142

Resistivity

  • Resistivity (ρ): material property describing how strongly it resists current
  • Block of material with resistivity ρ, length l, and face area A
  • Perfect conductors on both faces
  • What is its total resistance?

35 of 142

Resistivity

  • Resistivity (ρ): material property describing how strongly it resists current
  • Block of material with resistivity ρ, length l, and face area A
  • Perfect conductors on both faces
  • What is its total resistance?

36 of 142

Resistivity

Silicon

Copper

ρ = 2.3×103 Ω⋅m

ρ = 1.7×10-8 Ω⋅m

11 orders of magnitude

37 of 142

Hydraulic analogy: resistivity

Hydraulic

Density of mesh in pipe

Electrical

(1 / mobility) of charge carriers

38 of 142

Wire

39 of 142

Wire

  • In an ideal circuit a wire is connection with no resistance
  • It’s is symbolised by a line
  • Two points linked by a wire are “shorted” or have a “short circuit”

40 of 142

Resistor

41 of 142

Current depends on voltage and resistance

  • Current is proportional to voltage
  • Current is inversely proportional to resistance
  • Ohm’s Law

42 of 142

Conservation of charge

  • Although charge moves, the total charge must be conserved!
  • There is only one topology that supports this: a loop.
  • All electrical circuits are loops

Voltage�(10 V)

Resistor�(10 Ohms)

I

I

What happens it you replace the resistor with a wire?

43 of 142

Circuit

  • Where is the loop?

44 of 142

Ground

  • Where is the loop?
  • Ground and power symbols are useful for complicated schematics.
  • Used to indicate a common conductor and voltage.

Cu

I

I

Cu

45 of 142

Hydraulic analogy: ground

Hydraulic

  • What is 0 potential energy?
  • “Sea level”: arbitrary potential energy level

Electrical

  • What is 0 voltage
  • “Ground”: arbitrary potential

+

0

-

+

0

-

46 of 142

Charge is conserved (“Kirchhoff's Current Law”)

  • Conservation of charge
  • “Kirchhoff's current law”

47 of 142

Energy is conserved (“Kirchhoff's Voltage Law”)

  • Conservation of energy
  • “Kirchhoff's voltage law”

48 of 142

Voltage Divider

49 of 142

Resistor circuit

50 of 142

Resistor circuit

51 of 142

Resistor circuit

52 of 142

Resistor circuit

53 of 142

Resistor circuit

54 of 142

Resistor circuit

55 of 142

Potentiometer

Vout

“Wiper”

56 of 142

Voltage divider

57 of 142

Voltage divider

58 of 142

Voltage divider

59 of 142

Voltage divider

60 of 142

Voltage divider

61 of 142

The recording arc

62 of 142

What is an electrode?

  • Insulated wire with exposed tip
  • Bring it within the E-field / potential field produced by cell

63 of 142

What is an electrode?

  • Insulated wire with exposed tip
  • Rs = Series resistance (CSF, electrode interface)
  • Rsh = Shunt resistance. Ideally large, but not in practice.

64 of 142

What is an electrode?

  • What is Vout?

65 of 142

66 of 142

67 of 142

Electric fields �and Ohm’s Law

Jon Newman

�TENSS 2024

68 of 142

ECG - Electrocardiogram

  • Electrical activity generated by cardiac tissue
  • Surface electrode
  • V(t)

69 of 142

EMG - Electromyogram

  • Electrical activity generated by �skeletal muscle (motor unit APs)
  • Surface electrodes
  • V(t)

70 of 142

EEG - Electroencephalogram

  • Electrical activity generated by the brain
  • Summed activity of lots of neurons
  • Surface electrodes
  • V(t)

71 of 142

LFP - Local field potential

  • Electrical activity generated by a neural circuit
  • Summed activity of lots of neurons
  • Intracranial electrodes
  • V(t)

72 of 142

Spike or “Unit” Recordings

  • Electrical activity generated by individual cells
  • Small intracranial electrodes
    • Silicon probes
    • Tetrodes
    • Sharps
  • V(t)

73 of 142

Electrical recordings

  • Sensing an “electric field”
  • Output is voltage, why?
  • Electrodes
    • Why 2 or more?
    • Different shapes
    • Different materials
  • Voltage as function of time
    • Amplified, why?
    • Filtered, why?
    • Digitized, why/how?

V

time

74 of 142

Electric Fields

75 of 142

Charge, q

  • Conserved quantity, one of only 4! (energy, angular momentum, linear momentum and charge)

The net charge of an isolated system is constant

  • Fundamental property

Proton: +e

Electron: -e

  • Positive and negative
  • Units: Coulombs (C) = 6.241509×1018 e

76 of 142

Coulomb's inverse-square law

77 of 142

Gravity vs. electric forces

78 of 142

Electric force

Object with charge

Test charge, q0

Calculate force using inverse square law and plot arrow

Divide by q0 to get field value (why?)

+q

79 of 142

Electric field

Object with charge

Test charge, q0

Repeat for every position around the charge

  • Arrows show the direction and magnitude of the field

+q

80 of 142

Electric potential

Object with charge

Test charge, q0

What is the work done on the particle by the field when it comes from infinitely far away?

+q

81 of 142

Electric potential field

Object with charge

Test charge, q0

Repeat for all positions in space

+q

82 of 142

Voltage

Object with charge

Test charge, q0

How much work is done on test charge when it moves between positions in space�

Path does not matter (conservative force, no integral required!)

Unit: Volts (V) = Joules / Coulomb

+q

83 of 142

Voltage

Object with charge

Test charge, q0

How much work is done on test charge when it moves between positions in space�

Which has a larger voltage difference?

+q

84 of 142

Voltage

Object with charge

Test charge, q0

How much work is done on test charge when it moves between positions in space�

Which has a larger voltage difference?

+q

85 of 142

Voltage

Object with charge

Test charge, q0

How much work is done on test charge when it moves between positions in space�

Which has a larger voltage difference?

+q

86 of 142

Aside: Electron-Volt, eV

eV: The measure of an amount of kinetic energy gained by a single electron accelerating through an electric potential difference of one volt in vacuum

1 eV = 1.602176634×10−19 J

87 of 142

Aside: Electron-Volt, eV

eV: The measure of an amount of kinetic energy gained by a single electron accelerating through an electric potential difference of one volt in vacuum

1 eV = 1.602176634×10−19 J

House Fly

  • 50 thousand trillion nucleons
  • 10 mg
  • 0.5 m/s

88 of 142

Aside: Electron-Volt, eV

eV: The measure of an amount of kinetic energy gained by a single electron accelerating through an electric potential difference of one volt in vacuum

1 eV = 1.602176634×10−19 J

House Fly

  • 50 thousand trillion nucleons
  • 10 mg
  • 0.5 m/s

LHC

  • Single proton
  • mp/⁠me = 1836.152673
  • V = 99.9999991% * C

Image: https://www.warrenphotographic.co.uk/03911-houseflies-in-flight

89 of 142

Superposition

Two charged objects

90 of 142

Superposition

Two charged objects

�Vector addition of fields

91 of 142

Superposition

Two charged objects

�Vector addition of fields

�Take gradient of combined field

92 of 142

Superposition: making a voltage source

  • Two plates
  • One contains a lot of positive charge, the other negative
  • Charge is locked to each plate

93 of 142

Superposition: making a voltage source

  • Two plates
  • One contains a lot of positive charge, the other negative
  • Charge is locked to each plate
  • Field is constant between the plates and (largely) cancels on the outside

94 of 142

Superposition: making a voltage source

  • What happens if charge can move freely between the plates?

95 of 142

Field inside conductor

  • What happens if charge can move freely between the plates?
  • The electric field, and therefore voltage between any two points in a perfect conductor is 0

Perfect conductors

96 of 142

Gravity vs. electric forces

Gravity

Electric force

Property of Interest

Mass

Charge (+/-)

Force Law

Inverse square

Inverse square

Direction

Attraction

Repulsion or attraction

Conservative

Yes

Yes

Linear (superposition)

Yes

Yes

97 of 142

Gravity vs. electric forces

98 of 142

Ohm’s Law

99 of 142

Current: charge in motion

Current (I): how much charge (Q) moves through a given area in time t

Units: Amperes (Amps) = Coulomb / sec

What factors will influence I?

100 of 142

Current: charge in motion

Current (I): how much charge (Q) moves through a given area in time t

What factors will influence I?

101 of 142

Current: charge in motion

Current (I): how much charge (Q) moves through a given area in time t

What factors will influence I?

  1. Voltage/E-field: stronger means more current�
  2. Conduction medium: how good is it at allowing charge to move?

102 of 142

Current paths

  • Large Voltage difference
  • Strong electrical force
  • Metal: good conductor
  • How much charge flows?���

~50kV

103 of 142

Current paths

  • Large Voltage difference
  • Strong electrical force
  • Metal: good conductor
  • How much charge flows?��
  • None (ideally)
  • Large resistance (R)
    • Air
    • Ceramic insulators

~50kV

R

R

R

R

R

R

104 of 142

Resistance

  • Charge particles are accelerated in an electric field but slam into stuff on along their path�
  • This jiggles the stuff they slam into (heat)�
  • In some materials motion is impeded so much, that ~no charge will flow (I = 0)�
  • Units: Ohms (Ω) = Volts/Amps

105 of 142

Resistivity

  • Resistivity (ρ): material property describing how strongly it resists current
  • Block of material with resistivity ρ, length l, and face area A
  • Perfect conductors on both faces
  • What is its total resistance?

106 of 142

Resistivity

  • Resistivity (ρ): material property describing how strongly it resists current
  • Block of material with resistivity ρ, length l, and face area A
  • Perfect conductors on both faces
  • What is its total resistance?

107 of 142

Resistivity

Silicon

Copper

ρ = 2.3×103 Ω⋅m

ρ = 1.7×10-8 Ω⋅m

11 orders of magnitude

108 of 142

Current depends on voltage and resistance

  • Current is proportional to voltage
  • Current is inversely proportional to resistance
  • Ohm’s Law

109 of 142

Conservation of charge

  • Although charge moves, the total charge must be conserved!
  • There is only one topology that supports this: a loop.
  • All electrical circuits are loops

Voltage�(10 V)

Resistor�(10 Ohms)

I

I

110 of 142

Circuit

  • Where is the loop?

111 of 142

Ground

  • Where is the loop?
  • Ground and power symbols are useful for complicated schematics.
  • Used to indicate a common conductor and voltage.

Cu

I

I

Cu

112 of 142

Charge is conserved (“Kirchhoff's Current Law”)

  • Conservation of charge
  • “Kirchhoff's current law”

113 of 142

Energy is conserved (“Kirchhoff's Voltage Law”)

  • Conservation of energy
  • “Kirchhoff's voltage law”

114 of 142

Hydraulic Analogies

115 of 142

Hydraulic analogy: current

Hydraulic

  • Rate of water flowing through a pipe

Electrical

  • Rate of charged particles through a conductor
  • e.g. Electrons in metal
  • e.g Ions in solution

116 of 142

Hydraulic analogy: voltage

Hydraulic

  • Potential energy

Electrical

  • “Electrical potential energy”

High potential energy compared to �sea level

+9V compared to the other terminal

117 of 142

Hydraulic analogy: ground

Hydraulic

  • What is 0 potential energy?
  • “Sea level”: arbitrary potential energy level

Electrical

  • What is 0 voltage
  • “Ground”: arbitrary potential

+

0

-

+

0

-

118 of 142

Hydraulic analogy: resistance

Hydraulic

Constriction or blockage in pipe

Electrical

Impurities and thermal motion that disturb the flow of charged particles

119 of 142

Hydraulic analogy: resistivity

Hydraulic

Density of mesh in pipe

Electrical

(1 / mobility) of charge carriers

120 of 142

Voltage Divider

121 of 142

Resistor circuit

122 of 142

Resistor circuit

123 of 142

Resistor circuit

124 of 142

Resistor circuit

125 of 142

Resistor circuit

126 of 142

Resistor circuit

127 of 142

Potentiometer

Vout

“Wiper”

128 of 142

Voltage divider

129 of 142

Voltage divider

130 of 142

Voltage divider

131 of 142

Voltage divider

132 of 142

Voltage divider

133 of 142

What is an electrode?

  • Insulated wire with exposed tip
  • Bring it within the E-field / potential field produced by cell

134 of 142

What is an electrode?

  • Insulated wire with exposed tip
  • Rs = Series resistance (CSF, electrode interface)
  • Rsh = Shunt resistance. Ideally large, but not in practice.

135 of 142

What is an electrode?

  • What is Vout?

136 of 142

Questions

137 of 142

Parallel Resistors

  • We saw above that series resistors add
  • When resistors are in parallel, they pass a fraction of the incoming current in inverse proportion to their respective resistances.

138 of 142

Intuitive origins of inverse-square law

  • Imagine some point source for gravitational force (a “mass”).
  • Draw a sphere around it
  • As sphere radius increases, strength is distributed over area

139 of 142

Newton’s universal law of gravitation

140 of 142

Gravitational Field

Object with mass M

Test mass, m = 1

Gravitational force field

  • Arrows show direction test mass will move

M

M

141 of 142

Gravitational Potential

Object with mass M

Test mass, m = 1

How much work is done on test mass when it moves between positions in space�

Path does not matter (conservative force)

M

M

M

Φ1

Φ2

142 of 142

Superposition

To find the combined field, add the fields produced by each mass