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.
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