6bit Digital-Analog-Converter

Cheap discrete DAC with CD4007 CMOS ICs

Similar projects worth following
A fifty-year old DAC design with two CD4007 CMOS ICs, but still good enough to get a grasp how DACs work.

The output (which is inverted) should act according to the input bit pattern.

Examples with 3.3V (CD4007UBE specified for 3V-18V):
111111 (representing 0d) = 0.0V
011111 (representing 2^5 = 32d) = 1.6V
001111 (representing 2^5 + 2^4 = 48d) = 2.5V

The better the tolerances of the resistors (you need a lot :-D), the better the results. Use any input device you like (e.g. µC, mechanical switches). Also easily scalable to 9bit, 12bit, ....

Note: added some more photos for clarification.


My assembly consists of two CD4007UBE. CD4007A is given in my book source, which has lower max voltage but is the faster version (30ns vs 20ns; one has to be aware of the general rule not using a faster logic family than necessary because of noise problems). 2R = 100k +/- 1%.


Generating digital data by means of a Raspberry Pi Pico µC in this project.

MicroPython program for an ad-hoc test (should generate 2.5V): 

from machine import Pin
lsb = Pin(7, Pin.OUT) # bit0, least significant bit
bit1 = Pin(8, Pin.OUT)     
bit2 = Pin(9, Pin.OUT)     
bit3 = Pin(10, Pin.OUT) 
bit4 = Pin(11, Pin.OUT) 
msb = Pin(12, Pin.OUT) # bit5, most significant bit (2^5 = 32)

For more sophisticated applications one can deploy the RP2040 Single-cycle IO block (SIO).

C program would look something like:

void setOutput(int DAC)
  *(SIO + 0x014 / 4) = DAC << 7; // we start on GP7


SAR ADC, function generator, etc.


I paid 50 Cents for each IC, and close to 0 Cents for for the resistors.

Adobe Portable Document Format - 543.31 kB - 01/04/2023 at 06:00


Adobe Portable Document Format - 1.37 MB - 12/10/2022 at 10:58


  • 2 × CD4007UBE Logic ICs / Gates and Inverters
  • 100 × Resistor 100k You need a lot resistors with acceptable tolerance values (at least 1%)
  • 2 × Capacitor 100nF should be ceramic; for decoupling / reducing noise
  • 1 × µC whatever you like

  • Using a MCP23016 I/O expansion for I2C bus

    Florian Wilhelm Dirnberger01/02/2023 at 06:28 0 comments

    Expending six Pico GPs (or more) may be rather impractical in some projects. 

    The I2C bus would need only two connections, so one can go with an additional I2C IC, such as the MCP23016 or MCP23017 I/O expansion.

    Having all circuits work smoothly together was for me a hassle though. Issues probably stem from the Pico's internal pull-up resistors which are generally not so well-suited for the I2C bus (values range from 50k to 80k, according to the data sheet). 

    Small-value resistors provide improved noise immunity as well as increased speed, so I soldered two external 3.9 kOhm and de-activated the internal ones via SW.

View project log

Enjoy this project?



Adrian Freed wrote 12/11/2022 at 20:36 point

If you load in the mA range the output voltage driving the resistors will droop depending on the MCU (and which pins and whether you have configured for "high drive" mode).
I already contributed a DAC project which avoids the resistors by using the transconductance of CMOS gates.

  Are you sure? yes | no

Adrian Freed wrote 12/11/2022 at 19:51 point

A CD4069 can be used instead of two chips and you can also drive the resistor ladder directly from the MCU. In all cases R and 2R need to be large enough to swamp variations in the output resistance of  the driving mosfets.

  Are you sure? yes | no

Florian Wilhelm Dirnberger wrote 12/11/2022 at 20:16 point

Yeah maybe. Feel free to create a seperate project which is configured this way.

I am usually not driving components directly from the Pico µC GPs for I might run into the problem that I exceed the upper current limit (which is for all the GPs combined around 50 mA - with the CD4007 I am fairly safe (high-input impedance)).

Would not happen here, but may happen if I add more complexity and more output devices.

  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