Generating Analog Voltage with Digital Circuit

Summary of Generating Analog Voltage with Digital Circuit


The article explains how to generate analog voltages using a digital R-2R resistor ladder connected to microcontroller pins, offering a low-cost alternative to dedicated DACs. An 8-bit implementation uses only two resistor values (e.g., 1 kΩ and 2 kΩ) to produce weighted binary voltages, with microcontroller pins acting as DAC bits (LSB on the left, MSB on the right). Using two 1 kΩ in series can replace each 2 kΩ to simplify parts.

Parts used in the R-2R DAC project:

  • Microcontroller with at least 8 digital output pins
  • 1 kΩ resistors (multiple)
  • 2 kΩ resistors (multiple) or pairs of 1 kΩ in series as substitutes
  • Wiring/connectors to interface resistors to microcontroller pins
  • Ground and reference voltage connections (from microcontroller)

he purpose of this article is how to generate analog voltage with digital circuit. Although the market provides today a very broad range of dedicated digital-to-analogue converters, putting such a device in the schematic has a negative impact on the overall cost of the system. There are however, cheap methods of creating the required voltage levels, and even of generating pseudo-analogue signals, using purely digital means.

Generating Analog Voltage with Digital Circuit

1. Introduction

The method of generating an analog voltage use a digital circuit named R/2R resistor network. This method requires having a number of microcontroller pins available to be used for this specific task only. It is a very cheap method, as it only requires a few resistors of two different values only. The circuit shown in Figure 1 depicts an 8-bit DAC built around the available pins of the microcontroller using 2 kΩ and 1 kΩ resistors. To simplify the Bill of Materials, you could also use only 1 kΩ resistors, by using two of them in series instead of each 2 kΩ resistor.

 

2. Features

The advantage of this circuit, besides its very low cost, is the simple logic needed to operate it. The 8 pins of the microcontroller used have the exact functions of the 8 bits of a DAC, with the leftmost pin being the LSB and the rightmost pin being the MSB. The digital code applied by the microcontroller at its pins represents the exact value needed by a legitimate DAC to generate the required voltage:

For more detail:  Generating Analog Voltage with Digital Circuit

Quick Solutions to Questions related to R-2R DAC:

  • How does the R-2R resistor network generate analog voltage?
    It uses a ladder of resistors with two values to weight microcontroller digital output bits so their combined voltage produces an analog level.
  • Can I use only one resistor value instead of 1 kΩ and 2 kΩ?
    Yes; you can use only 1 kΩ resistors by placing two 1 kΩ resistors in series to replace each 2 kΩ resistor.
  • What microcontroller resources are required for the R-2R DAC?
    An available set of 8 digital output pins dedicated to the DAC function is required.
  • Does this method act like a legitimate DAC?
    Yes; the digital code applied to the pins represents the exact value a legitimate DAC would use to generate the required voltage.
  • What are the main advantages of this circuit?
    Its main advantages are very low cost and simple logic to operate, using only a few resistors.
  • Which pin corresponds to the least significant bit?
    The leftmost microcontroller pin in the described schematic corresponds to the LSB.
  • Which pin corresponds to the most significant bit?
    The rightmost microcontroller pin in the described schematic corresponds to the MSB.

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter