Analogue signal processing Fig. . Schematics of LED driver and analogue conditioning circuit. The LED is connected in series with a 30-mA constant current diode and an NPN transistor; the base terminal of the transistor is connected to a digital output pin of the microcontroller, which switches the current flow on and off at a frequency of ~410 Hz and a duty cycle of 50 %. The optical signal is detected using an amplified photodiode (OPT101). The DC output 𝑉 1 from the amplified photodiode is passed through a non-inverting integrator (I1, green box) that generates a positive output current 𝐼 int at the summing terminal of A0 (Pin 2 of the OPT101), cancelling the negative DC photocurrent due to ambient light and hence reducing the DC component of 𝑉 1 to zero. 𝑉 1 is passed to a non-integrating amplifier that adds a constant DC offset of 1.6 V, yielding an output voltage 𝑉 2 that spans the range 0 to 3.2 V (S1, red box). Finally, 𝑉 2 is passed to an active second-order low-pass filter (LP1, blue box) that suppresses noise and high-frequency components above 94 kHz.