Monday, June 30, 2025

 Interfacing bipolar DC signals to Arduino ADC

 Arduino's analog-to-digital converter (ADC) can only measure voltages in the range of 0V to its reference voltage (typically 5V or 3.3V, depending on the board). Bipolar AC signals, however, swing both above and below 0V, which presents a challenge: negative voltages can damage the Arduino and cannot be measured directly.

To safely and accurately interface a bipolar DC signal to the Arduino ADC, you need to shift (bias) and scale the signal so that it fits entirely within the ADC's input range.

One possible solution is described below.

The circuit (fig.1) is a non-inverting amplifier with a level-shifting network (R3-R4) to convert a bipolar input signal into a unipolar output.



fig.1

Here's the explanation of how the circuit works:

 1.      Non-Inverting Amplifier Configuration: The OP37 op-amp is set up as a non-inverting amplifier with R1 (1 kΩ) and R2 (2 kΩ) in the feedback network, providing a gain of (1 + R2 / R1) = 1 + (2k / 1k) = 3.

2.       DC Bias Calculation: The DC bias at the non-inverting input is the sum of V1 and V2, where V1 = 5V x R3 / (R3 + R4) and V2 = 0.2V x R4 / (R3 + R4). With R3 = 1 kΩ and R4 = 9 kΩ, V1 = 5V x (1k / 10k) = 0.5V and V2 = 0.2V x (9k / 10k) = 0.18V. Thus, the total DC bias is V1 + V2 = 0.5V + 0.18V = 0.68V.

3.      Input Signal: As the input signal Vin, a 100 Hz sinusoidal signal with a 0.2V DC offset and 0.3V amplitude was used. This is added to the 0.68V bias, so the signal at the non-inverting input ranges from 0.68V - 0.3V = 0.38V to 0.68V + 0.3V = 0.98V.

4.      Amplification: The op-amp amplifies the input signal with a gain of 3. The AC amplitude becomes 3 x 0.3V = 0.9V, and the DC offset is 3 x 0.68V = 2.04V. The output Vout would ideally range from 2.04V - 0.9V = 1.14V to 2.04V + 0.9V = 2.94V.

5.      Output Signal Vout: Since the op-amp is powered by a +5V supply, and the calculated output stays within this limit, Vout will be a unipolar signal that changes between approximately 1.14V and 2.94V. The final output across a load will be an AC signal with a 0.9V peak-to-peak amplitude, centered around 0.68V x 3 = 2.04V. A capacitor C1 connected to the power rail of the op-amp—a practice known as "power supply decoupling" or "bypass"—will filter out noise and stabilize the voltage supplied to the op-amp.

In this circuit, we can usenumerous single-supply IORR op-amps (LM358, MCP601, MCP6021, AD8541, etc.). 



Sunday, June 29, 2025

 Interfacing Bipolar AC Signals to Arduino ADC

 

Arduino's analog-to-digital converter (ADC) can only measure voltages in the range of 0V to its reference voltage (typically 5V or 3.3V, depending on the board). Bipolar AC signals, however, swing both above and below 0V, which presents a challenge: negative voltages can damage the Arduino and cannot be measured directly.

To safely and accurately interface a bipolar AC signal to the Arduino ADC, you need to shift (bias) and scale the signal so that it fits entirely within the ADC's input range.

One possible solution is described below.

 

Circuit Operation Overview

This circuit (fig.1) is a non-inverting amplifier based on the AD8541 operational amplifier. It is designed to convert a bipolar input signal (ranging from -0.1V to +0.1V) into a unipolar output signal referenced to a single supply voltage (+5V). The circuit achieves this by biasing the input and using AC coupling.

fig.1

Key Components and Their Functions

1. Input Coupling Capacitor (C1, 1µF):

  • Purpose: Blocks any DC component from the input signal (Vin), allowing only the AC (bipolar) part to pass through to the op-amp.
  • Effect: Ensures that the input signal is superimposed on a DC bias set by the resistor divider (R3 and R4), which is crucial for single-supply operation.

2. Biasing Network (R3, 1kΩ and R4, 9kΩ):

  • Purpose: Creates a DC bias voltage at the non-inverting input of the op-amp.

·         Bias Voltage Calculation (R3-R4 Network)

The voltage divider formed by R3 and R4 sets the DC bias at the non-inverting input of the op-amp. The correct formula for the voltage at the junction (with respect to ground) is:

 

Vbias = R3/(R3+R4) × V+

 

Given:

  • R3 = 1kΩ
  • R4 = 9kΩ
  • V+ = 5V

 

Vbias = 1k/(1k+9k) × 5V = 1/10 × 5V = 0.5V

 So, the bias at the non-inverting input is 0.5V, not 4.5V as previously calculated.

 3. Amplification of Both AC and DC Components

This is a non-inverting amplifier, so both the AC input (after C1) and the DC bias from R3-R4 are amplified by the same gain:

Gain = 1 + R2/R1 = 1+2k/1k = 3

The output voltage (Vout) is given by:

Vout = Gain × (VinAC + Vbias)

  • VinAC is the AC signal after C1 (ranging from -0.1V to +0.1V).
  • Vbias is 0.5V.

So,

Vout = 3 × (VinAC + 0.5V)

 4. Output Signal Range

  • When Vin,AC = −0.1V:

                         Vout,min = 3 × (−0.1V + 0.5V) = 3 × 0.4V = 1.2V

  • When Vin,AC = +0.1V:

                          Vout,max = 3 × (0.1V + 0.5V) = 3 × 0.6V = 1.8V

Therefore, the output will swing from 1.2V to 1.8V as the input swings from -0.1V to +0.1V.

 

5. Purpose of Capacitor C1

  • C1 is an AC coupling (blocking) capacitor. It blocks any DC component from the input, ensuring that only the AC signal is passed to the non-inverting input, which is then superimposed on the DC bias voltage provided by R3 and R4.
  • This allows the circuit to convert a bipolar AC input (centered at 0V) into a unipolar output (centered at the amplified bias voltage).

Summary Table

Component

Function

Effect on Signal

C1

AC coupling

Passes AC, blocks DC from Vin

R3, R4

Voltage divider (bias)

Sets input bias at 0.5V

R1, R2

Feedback (gain)

Gain = 3 for both AC and DC

C2

Supply decoupling

Reduces power supply noise

 

 

 

 

 

 

 






In this circuit, we can use many popular single-supply IORR op-amps (MCP6021, OP37, LM358, etc.).



  Conclusion

  • The circuit shifts the input AC signal (±0.1V) up to a DC level of 0.5V, then amplifies both the AC and DC components by 3.
  • The output is a unipolar signal, swinging from 1.2V to 1.8V, suitable for single-supply systems.
  • C1 ensures only the AC component of the input is processed, while the DC operating point is defined by the R3-R4 divider and amplified along with the signal.