Fully analog digitally controlled voltage source

Voltage is set with three BCD switches with a step of 10mV

Similar projects worth following
The aim of the project is to develop a source of voltage that can be easily controlled without using any form of a microcontroller in a precise manner.
It uses only a few operational amplifiers, a set of resistors and capacitors, reference voltage source and three BCD rotary switches.
The circuit is powered with a single supply, preferably 12V DC, but 9V (or even less) operation is also possible with a limited output voltage range.

When starting the project, I had several requirements on my mind:

  1. Single supply operation, preferably in the range 9-12V.
  2. No trimming should be necessary to obtain reasonable accuracy.
  3. No "exotic" parts nor part values (especially resstors!) should be used.
  4. Possibly low current consumption of the circuit. (not met that well!)
  5. Possibly a single sided board that can be produced by a simple "Chinese" CNC mill.

The circuit I used is shown below:

Figure 1. The electric circuit of the Fully analog digitally controlled voltage source

Details of the circuit

Reference voltage source

Figure 2. Reference voltage source

The principle of operation of the circuit starts with a stable and accurate reference voltage. I needed this to be 1V to make the simple setting of output voltage possible. In fact, any integer value of the reference voltage would do, but 1V seemed to be easy to obtain and required no "difficult" resistor values.

To produce the 1V reference voltage without using any trimmers, the LM4040A circuit is chosen. The A version may be more expensive (approximately twice the cost), but provides better accuracy. This accuracy would be degraded by further processing steps, so it is good to start with better accuracy.

LM4040 has a version that produces 3V on the output and it seems to be widely available. To produce 1V, the output voltage has to be divided in ratio 1/3, and that requires a resistor divider with values R + 2R. Luckily, values like 1k and 2k, 10k and 20k are easily available, so this was the way to go. I used precise 0.1% resistors R21 and R22 in the divider. The value of R19 does not need to be precise - a 1% or even 5% resistor should do. The value of R19 (20k) is chosen so that a sufficient current is provided for LM4040 to function properly. For the assumed supply voltage range 9 to 12V, the LM4040 current will be in the range from 300 to 450uA, that is enough to maintain the proper operation of LM4040.

Reference voltage buffer

Figure 3. Reference voltage buffer

Since the 1V reference voltage is present on the output of a voltage divider with significant output resistance (6.67k), I use a voltage buffer to provide low output resistance of the 1V reference voltage. Decreasing this resistance proved to be essential for accurate operation of the remaining part of the circuit. Using lower resistance values in the voltage divider would not help, since to get a very low output resistance, in the order of 1 Ohm or less, would require the use of prohibitively low values of resistors and increase the voltage divider current to about 300mA.

Another aspect that needs considering is the choice of the operational amplifier. It needs to have a set of properties:

  • low input bias current (in order not to introduce significant errors caused by loading of the voltage divider)
  • low input offset voltage (in order not to introduce significant errors to the output voltage)
  • rail to rail on input and output operation (in order to be able to work with a single supply voltage and provide wide range of output voltage)

I chose LMC6062 because I can easily get them for a reasonable price. They are precision (=low offset voltage) CMOS (=low bias current) amplifiers. The specified supply voltage is from 4.5V up to 15V. Especially the second value is important - many modern opamps do not work with supply voltage above 5.5V. LMC6062 is also a rail to rail opamp, which is important in this project. They also have quite high typical open loop voltage gain, that helps to maintain consistiency between real life performance and results of simple calculations we are used to. Plus, there are two of them in a single SO8 package.

Resistor R24 is there only to help in routing the tracks on the PCB and its value is 0 Ohms.

Voltage generator

Figure 4. Voltage generator

This is the part of the circuit where the desired voltage is generated.

The way it works is the following.

The voltage on the non-inverting input (pin...

Read more »

  • Repeated measurements

    Klima06/04/2023 at 15:46 0 comments

    I performed an additional set of measurements for the second prototype using a different voltmeter: Solartron 7150+.

    Below you can find results and the graphs with new measurements added. The new measurements seem to confirm the previous measurement results.

    Ambient temperature during measurements: 23°C

    Supply voltage: 9.99V

    Voltmeter used: Solartron 7150+

    Prototype #2
    set value [V] measured value [V] error [mV] error [%]
    0 0.003369 3.369 ---
    0.15 0.149463 -0.537 -0.358
    1.34 1.338665 -1.335 -0.100
    1.79 1.788334 -1.666 -0.093
    2.12 2.11797 -2.030 -0.096
    3.12 3.11701 -2.990 -0.096
    3.77 3.7666 -3.400 -0.090
    4.33 4.32482 -5.180 -0.120
    4.85 4.84432 -5.680 -0.117
    5.25 5.24366 -6.340 -0.121
    6.49 6.48202 -7.980 -0.123
    6.95 6.94179 -8.210 -0.118
    7.28 7.27105 -8.950 -0.123
    8.28 8.27135 -8.650 -0.104
    8.66 8.65086 -9.140 -0.106
    Relative error with dots indicating measurement results: green - prototype #1, red - prototype #2, blue - prototype #2, Solartron voltmeter
    Absolute error with dots indicating measurement results: green - prototype #1, red - prototype #2, blue - prototype #2, Solartron voltmeter

  • Monotonicity

    Klima05/30/2023 at 22:05 0 comments

    An important feature of the circuits like the one designed (which is effectively a digital to analog converter) is maintaining the monotonicity.

    It means, that for every change of set value to a value higher by one least significant digit, the output value also increases. Since I already had the simulation script, I simulated the voltage difference between consecutive steps:

    Monotonicity of the circuit (simulation data)

     Every time the value drops below 0, the monotonicity is lost. It can be seen, that for some extreme combinations of component values within their specified tolerances, the monotonicity will be lost for transition from 7.99V to 8.00V. The ideal value (for ideal components) of change is 0.01V.

    For my prototypes, the following values were measured:

    Set value
    Measured value Prototype #1
    Measured value Prototype #2
    7.99 V7.9854 V7.9791 V
    8.00 V8.0010 V7.9898 V

    The monotonicity is therefore maintained even for this nevralgic step for both prototypes.

    Out of curiosity, I also checked how this plot would look like if I specified 1% resistors in the circuit:

    Monotonicity of the circuit with worse accuracy resistors (1%) - simulation data

    It can be seen that the possible loss of monotonicity is much more probable and more steps with possible loss can be observed.

  • Prototype #2

    Klima05/30/2023 at 21:39 0 comments

    The second prototype was soldered on a hot plate - maybe it is the reason why the accuracy is worse than for prototype #1, that was hand soldered?

    Another source of error in this case is the output resistor R29 - its value is 1k in this case and that, together with input resistance of the voltmeter form a voltage divider that observably decreases the measured voltage. The difference of output voltage is +1mV for 8.66V set voltage when measured before R29!

    This is the short pictorial story of prototype #2 being created:

    Milling, drilling, outside cutting:

    The long past-due SnPb solder paste is dispensed using a handheld dispenser:

    The components are placed by hand:

    A homemade hotplate is used to solder everything together (note the fume extractor above-left):

    SMD components are soldered, but the copper got discolored due to the heat and lack of protection layer on top:

    The remaining part was to solder the through-hole switches and the power supply input wires and the output wires.

  • Measurements

    Klima05/30/2023 at 21:29 0 comments

    Theoretical results for error calculation, now with measurements!

    I made 2 prototypes and measured the output voltage of both prototypes. The results are shown below.

    Ambient temperature during measurements: 24°C

    Supply voltage: 9.99V

    Voltmeter used: Brymen BM857a

    Prototype #1
    set value [V] measured value [V] error [mV] error [%]
    0 0.03528 35.28 ---
    0.15 0.15125 1.25 0.833
    1.34 1.34085 0.85 0.063
    1.79 1.79069 0.69 0.039
    2.12 2.12023 0.23 0.011
    3.12 3.11964 -0.36 -0.012
    3.77 3.76934 -0.66 -0.018
    4.33 4.32833 -1.67 -0.039
    4.85 4.8478 -2.20 -0.045
    5.25 5.2482 -1.80 -0.034
    6.49 6.4867 -3.30 -0.051
    6.95 6.9462 -3.80 -0.055
    7.28 7.276 -4.00 -0.055
    8.28 8.2811 1.10 0.013
    8.66 8.661 1.00 0.012
    Prototype #2
    set value [V] measured value [V] error [mV] error [%]
    0 0.00339 3.39 ---
    0.15 0.14943 -0.57 -0.380
    1.34 1.33838 -1.62 -0.121
    1.79 1.78795 -2.05 -0.115
    2.12 2.11742 -2.58 -0.122
    3.12 3.1162 -3.80 -0.122
    3.77 3.76559 -4.41 -0.117
    4.33 4.3237 -6.30 -0.145
    4.85 4.8431 -6.90 -0.142
    5.25 5.2427 -7.30 -0.139
    6.49 6.4809 -9.10 -0.140
    6.95 6.9405 -9.50 -0.137
    7.28 7.27 -10.00 -0.137
    8.28 8.27 -10.00 -0.121
    8.66 8.6495 -10.50 -0.121
    Relative error with dots indicating measurement results: Yellow - prototype #1, red - prototype #2
    Absolute error with dots indicating measurement results: Yellow - prototype #1, red - prototype #2

    As can be seen, the measurements lie within the limits indicated by the simulation.

  • Theoretical accuracy

    Klima05/25/2023 at 21:39 0 comments

    Theoretical accuracy

    The accuracy of the circuit was estimated using a Python script, implementing a MonteCarlo like estimation.

    The following sources of errors were considered:

    Accuracy of the resistors: +-0.1%

    Offset voltages of the opamps: +-0.1 mV

    Accuracy of the LM4040: +-0.1%

    Contact resistance: 0 to 0.1 Ohm

    Relative error

    Absolute error

    For most of the range, the relative error is usually below 0.1%. In terms of absolute error, in most cases the error stays below 10mV. This is a sufficiently low error for my purposes.

    Measurements should follow.

View all 5 project logs

Enjoy this project?



Kuba Sunderland-Ober wrote 05/30/2023 at 14:05 point

The layout with the MELF resistors is mesmerizing. The single layer is a nice challenge. 

  Are you sure? yes | no

Klima wrote 05/30/2023 at 16:42 point

It is much easier to mill a single sided board. 1206 resistors should fit as well and might be easier to source.

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates