ECSE 2010 Omega Lab MS1 Proof of Concepts

Contents
Warning
This article was last updated on 2026-03-12, the content may be out of date.

Voltage Divider

Circuit Schematic

/ecse-2010-ms1-poc/figure-1-1.png
Figure 1.1 - Schematic

Description

We designed two voltage divider circuits. One is used to convert the 12V power supply into a 6V reference voltage (VrefV_{ref}) for the subsequent voltage comparator; the other is used to generate the input voltage (VinV_{in}) for the voltage comparator. This input voltage is determined by the resistance of the photoresistor (LDR) through the voltage divider circuit.

Analysis

Calculate VrefV_{ref}, given

  • Vbus=12 VV_{bus} = 12 \text{ V}
  • R1=1 kΩR_1 = 1\text{ k} \Omega
  • R2=1 kΩR_2 = 1\text{ k} \Omega

Step 1: Total series resistance in that branch

Rtotal=R1+R2=1k+1k=2 kΩ R_{total} = R_1 + R_2 = 1k + 1k = 2\text{ k}\Omega

Step 2: Branch current (Ohm’s law)

I=VRtotal=122000=0.006 A=6 mA I = \frac{V}{R_{total}} = \frac{12}{2000} = 0.006\text{ A} = 6\text{ mA}

Step 3: Voltage at midpoint (VrefV_{ref})

VrefV_{ref} is the voltage across R2R_2 (because it’s the resistor from midpoint down to ground):

Vref=I⋅R2=(6 mA)(1 kΩ)=6 V V_{ref} = I \cdot R_2 = (6\text{ mA})(1\text{ k}\Omega) = \boxed{6\text{ V}}

Equivalently: Vref=12⋅R2R1+R2=12⋅12=6 VV_{ref}=12\cdot \frac{R_2}{R_1+R_2}=12\cdot \frac{1}{2}=6\text{ V}


Calculate VinV_{in}, given:

  • Vbus=12 VV_{bus} = 12\text{ V}
  • R3=1 kΩR_3 = 1\text{ k}\Omega
  • RLDR=2 kΩR_{LDR} = 2\text{ k}\Omega

Step 1: Total series resistance in that branch

Rtotal=R3+RLDR=1k+2k=3 kΩ R_{total} = R_3 + R_{LDR} = 1k + 2k = 3\text{ k}\Omega

Step 2: Branch current

I=123000=0.004 A=4 mA I = \frac{12}{3000} = 0.004\text{ A} = 4\text{ mA}

Step 3: Voltage at midpoint (VinV_{in})

VinV_{in} is the voltage across the bottom resistor (the LDR):

Vin=I⋅RLDR=(4 mA)(2 kΩ)=8 V V_{in} = I \cdot R_{LDR} = (4\text{ mA})(2\text{ k}\Omega) = \boxed{8\text{ V}}

Equivalently: Vin=12⋅RLDRR3+RLDR=12⋅23=8 VV_{in}=12\cdot \frac{R_{LDR}}{R_3+R_{LDR}}=12\cdot \frac{2}{3}=8\text{ V}

Simulation

Running LTSpice with following config

/ecse-2010-ms1-poc/figure-1-1.png
Figure 1.2 - Simulation

We got this result

1
2
3
4
5
6
7
8
9
       --- Operating Point ---
V(vbus): 12      voltage
V(vref): 6       voltage
V(vin):  8       voltage
I(R1):   0.006   device_current
I(R2):   0.006   device_current
I(R3):   0.004   device_current
I(Ldr):  0.004   device_current
I(V1):   -0.01   device_current

Experimental

With this setup

/ecse-2010-ms1-poc/figure-1-2.avif
Figure 1.3 - Experimental

we powered with 12V DC as initially designed.

/ecse-2010-ms1-poc/figure-1-3.avif
Figure 1.4 - Experimental

Then measured the Vref=6.066 VV_{ref} = 6.066 \text{ V}

/ecse-2010-ms1-poc/figure-1-4.avif
Figure 1.5 - Experimental

and the Vin=7.967 VV_{in} = 7.967 \text{ V}

/ecse-2010-ms1-poc/figure-1-5.avif
Figure 1.6 - Experimental

Discussion

Here’s how the hand calc, LTspice, and bench measurement line up, plus the percent error of the measurement vs. the design target.

Node Design (calc) LTspice op point Measured Abs. error (Meas − Design) % error
VrefV_{ref} 6.000 V 6.000 V 6.066 V +0.066 V +1.10%
VinV_{in} 8.000 V 8.000 V 7.967 V −0.033 V −0.41%

both measured voltages are very close to the ideal divider predictions (within about ±1.1%). LTspice matches exactly because it uses ideal component values unless you add tolerances.

Why the measurement differs from the ideal (most likely causes)

  1. Resistor tolerance (biggest for VrefV_{ref}) With two “1 kΩ” resistors, VrefV_{ref} is exactly 6 V only if R1=R2R_1=R_2. If Vbus=12 VV_{bus}=12\text{ V} exactly, my measured Vref=6.066 VV_{ref}=6.066\text{ V} implies the ratio is slightly off:

    R2R1≈1.022 \frac{R_2}{R_1}\approx 1.022

    R2R_2 about 2.2% higher than R1R_1, totally plausible for common 5% (and even possible with 1% parts depending on pairing).

  2. LDR isn’t a fixed 2 kΩ (it changes with light + temperature) Using my measured Vin=7.967 VV_{in}=7.967\text{ V}, R3=1kΩR_3=1k\Omega, and Vbus=12 VV_{bus}=12\text{ V}, the inferred LDR value is:

    RLDR=R3VinVbus−Vin≈1k⋅7.96712−7.967≈1.98kΩ R_{LDR} = R_3\frac{V_{in}}{V_{bus}-V_{in}} \approx 1k\cdot\frac{7.967}{12-7.967}\approx 1.98k\Omega

    So the LDR at measurement time was basically ~1.98 kΩ, which explains why VinV_{in} is very close to 8 V.

Operational Amplifier as a Comparator

Circuit Schematic

/ecse-2010-ms1-poc/figure-2-1.png
Figure 2.1 - Schematic

Description

This part is a voltage comparator. The previously generated 6V reference voltage from the voltage divider circuit, along with the signal, is fed into an OP37 operational amplifier. Once the signal output from the voltage divider circuit containing the LDR exceeds 6V, the final output becomes high (lighting up the LED), and vice versa.

Analysis

Step 1: Use the divider results (inputs of the op-amp)

From my earlier values (and assuming ideal op-amp inputs draw zero current, so the dividers are not loaded):

  • VrefV_{ref} from R1=1kR_1=1k over R2=1kR_2=1k:

    Vref=12⋅1k1k+1k=12⋅12=6 V V_{ref}=12\cdot \frac{1k}{1k+1k}=12\cdot\frac12=6\text{ V}
  • VinV_{in} from R3=1kR_3=1k over LDR=2k\text{LDR}=2k:

    Vin=12⋅2k1k+2k=12⋅23=8 V V_{in}=12\cdot \frac{2k}{1k+2k}=12\cdot\frac{2}{3}=8\text{ V}

Step 2: Compare op-amp input polarities

From the diagram connections:

  • The top input is “−” (inverting) and is connected to VrefV_{ref}
  • The bottom input is “+” (non-inverting) and is connected to VinV_{in}

So:

V+=Vin=8 V,V−=Vref=6 V V_+ = V_{in} = 8\text{ V},\quad V_- = V_{ref} = 6\text{ V}

Step 3: Ideal op-amp output behavior (open-loop comparator)

For an ideal op-amp (infinite open-loop gain):

  • If V+>V−V_+ > V_- ⇒ output drives to the positive rail
  • If V+<V−V_+ < V_- ⇒ output drives to the negative rail

Here:

V+−V−=8−6=2 V>0 V_+ - V_- = 8 - 6 = 2\text{ V} > 0

So the output goes high.

Step 4: Output rail values

The op-amp is powered from:

  • +V=Vbus=12 V+V = V_{bus} = 12\text{ V}
  • −V=0 V (ground)-V = 0\text{ V (ground)}

Therefore, based on an ideal op-amp only:

Vout=12 V (HIGH) \boxed{V_{out} = 12\text{ V (HIGH)}}

Real OP37 behavior may not swing exactly to the rails.

Simulation

/ecse-2010-ms1-poc/figure-2-1.png
Figure 2.1 - Simulation
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
         --- Operating Point ---
V(vbus):      12                 voltage
V(vref):      6.57209            voltage
V(vin):       7.23722            voltage
V(vout):      11.1378            voltage
I(R1):        0.00542791         device_current
I(R2):        0.00657209         device_current
I(R3):        0.00476279         device_current
I(Ldr):       0.00361861         device_current
I(V1):        -0.0127152         device_current
Ix(u1:1):     0.00114418         subckt_current
Ix(u1:2):     -0.00114418        subckt_current
Ix(u1:3):     0.00252446         subckt_current
Ix(u1:4):     -0.00253246        subckt_current
Ix(u1:5):     -1.02757e-11       subckt_current

Experimental

With this setup

/ecse-2010-ms1-poc/figure-2-2.avif
Figure 2.2 - Experimental

we powered with 12V DC as initially designed.

/ecse-2010-ms1-poc/figure-1-3.avif
Figure 2.3 - Experimental

Then measured the Vout=11.454 VV_{out} = 11.454 \text{ V}

/ecse-2010-ms1-poc/figure-2-3.avif
Figure 2.4 - Experimental

Discussion

Below is the calc vs. LTspice vs. measurement comparison for the OP37 used as a comparator, plus % error.

Comparator node voltages (with error %)

Node Ideal LTspice op point Measured Abs. error % error % error
VrefV_{ref} 6.000 V 6.572 V — — — —
VinV_{in} 8.000 V 7.237 V — — — —
VoutV_{out} 12.000 V 11.138 V 11.454 V +0.316 V +2.84% −4.55%

What this says:

  • my measured output is very close to the LTspice OP37 model (only 2.84% high vs sim).
  • my output is below 12 V because OP37 is not rail-to-rail, and output swing depends on load current and headroom.

Why LTspice shows “weird” VrefV_{ref} and VinV_{in} (6.57 V and 7.24 V)

In an ideal comparator assumption, the inputs draw ~0 current, so the dividers stay exactly at 6 V and 8 V.

But my LTspice operating point report shows this:

  • I(R1)=5.4279 mAI(R1)=5.4279 \text{ mA} while I(R2)=6.5721 mAI(R2)=6.5721 \text{ mA}
  • I(R3)=4.7628 mAI(R3)=4.7628 \text{ mA} while I(LDR)=3.6186 mAI(LDR)=3.6186 \text{ mA}

Those mismatches mean the divider midpoints are being loaded, and the amount is:

Iload≈6.5721−5.4279=1.1442 mA I_{\text{load}} \approx 6.5721 - 5.4279 = 1.1442\ \text{mA}

(same 1.1442 mA shows up on the other divider too)


Input clamp effect

The OP37 has back-to-back input protection diodes between its inputs, and if the differential input exceeds ~0.7 V, those diodes conduct and you must limit the current.

the ideal differential would be:

Vin−Vref=8−6=2 V V_{in}-V_{ref} = 8-6 = 2\text{ V}

That’s well above ~0.7 V, so in a real device (and many macromodels), the input protection network can conduct and effectively pull the two input nodes toward each other, which is exactly what my sim shows:

  • LTspice differential becomes 7.237−6.572=0.665 V 7.237 - 6.572 = 0.665\text{ V} right near the diode clamp region

Because my divider resistors are only 1 kΩ, even ~mA of clamp current will shift node voltages by hundreds of mV, explaining the ~±0.57 V\pm 0.57\text{ V} movement in VrefV_{ref} and VinV_{in}.


In Total

  • The comparator output behaves correctly: since Vin>VrefV_{in} > V_{ref}, the OP37 drives VoutV_{out} high, and you measured 11.454 V11.454\text{ V}, close to the simulated 11.138 V11.138\text{ V} (2.84% error).
  • The output doesn’t reach 12 V because OP37 output swing is limited (not rail-to-rail) and depends on load/headroom.
  • LTspice shows the input nodes shifting because in open-loop comparator use, the input differential can exceed the internal protection diode threshold; the model then allows input clamp current (~1.14 mA) which loads the 1 kΩ dividers and moves VrefV_{ref} up and VinV_{in} down.

Related Content