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 2kOhm and 1kOhm resistors. To simplify the Bill of Materials, you could also use only 1kOhm resistors, by using two of them in series instead of each 2kOhm resistor.