When talking about signals, they can be roughly divided into analog signals and digital signals. All digital electronic devices (such as logic gates, triggers, microcontrollers, microprocessors, etc.) can process digital signals, while analog electronic devices (such as operational amplifiers, power switches, etc.) can work. In a typical electronic design, these two signals usually have to be converted from one form to another. We’ve learned how to use an analog-to-digital converter (ADC) to convert analog signals to digital values. In this article, we will learn how to use DAC to convert digital signals to analog voltages.
What is Digital to Analog Converter(DAC)?
A digital to analog converter is usually referred to as DAC, D / A or d2a is a device that will binary values (0 and 1) with a continuous set of analog voltages. There are many technologies that can do this, each with its own advantages and disadvantages. In this article, we will learn how DAC works and how to use it in output design.
Where do we need DAC?
A computer is a binary computer running in the analog world, so in order to produce output that other devices can understand, you can use DAC. For example, a computer stores audio in the form of binary values of sound waves. In order to play these sounds as sound on the speakers, we need analog signals because it is well known that the diaphragm of the speakers vibrates according to the intensity of the analog signal to produce sound / music. Therefore, here, we will use DAC to convert digital audio files into analog signals for playback on the speakers.
Binary system is a position system, that is, a position value system. Each bit represents whether there is a power 2 in the sum of powers. In other words, the whole digital to analog conversion process can be seen as calibration operation binary count mapping to a certain voltage range, where 0V is the minimum value and the maximum voltage is the maximum input binary voltage.
Type of DAC
- Summation amplifier
Since DAC is only the weighted sum of binary inputs, a circuit called summation amplifier is used.
This is basically an op amp with multiple resistors connected to one input. The node where resistance meets is called summation node or virtual ground. The binary input enters the resistor and the analog output is obtained on the output of the operational amplifier.
What makes this circuit work is the resistors – each resistor must be carefully selected and matched to obtain an accurate analog output. The more bits you have, the more resistance you need – which is not always possible. These limitations can be overcome using the next method.
- R-2R ladder
This is the simplest DAC type, requiring only two resistance values arranged in the ladder. You can think of it as a slightly more complex divider, although the math is very complex.
The binary input enters the 2R resistor and the output is obtained at the bottom of the ladder.
- PWM DAC
This is the type of DAC most of us don’t even know to use!
The popular Arduino microcontroller has the ability to output analog signals using PWM signals. First, the PWM signal looks like a binary waveform with only high and low peaks and variable duty cycle (ratio of on time to time period).
However, it is intended to be used with an RC filter to convert the PWM signal to a voltage value by filtering out the AC component and leaving the DC component. The voltage output is proportional to the duty cycle of the input – the higher the duty cycle, the greater the output voltage of the filter.
Application of DAC
- Digital signal processing
When signals are converted to binary, they are much easier to use.
Audio editing is a good example. The audio is converted to binary and can then be manipulated. To play this audio, use DAC to convert it to a sound signal that can be played on the speakers.
- Digital power supply
Most microcontrollers are too slow to be part of the power control loop. In order to change the voltage or current of the power supply, you can change the reference. This can be achieved by connecting the DAC to the output of the microcontroller and then using the DAC to change the reference voltage to a preselected value.
Disadvantages of DAC
DAC can only generate any number of voltage steps allowed by binary number, in other words, it is almost impossible to generate real continuous voltage value.
Most of the DAC circuits mentioned above require several parts, which may not always be practical. However, a discrete DAC chip that can communicate with the microcontroller through SPI and I2C is provided.
That’s all for today. Hope you enjoyed this article. However, if you have doubts or have any questions about this, you can contact me in the comments section below. I’ll be happy to help you as best I can. Let us know your feedback and suggestions at any time, they allow us to provide you with high-quality work that responds to your needs and expectations, and helps you continue to give back to our products. Thank you for reading this article.
How to use DAC?
DAC can be used as independent IC or even embedded in microcontroller. But the most commonly used IC is the IC that can be sold as an independent IC. The most commonly used are dac7715, DAC0832, DAC0808, etc. For the convenience of this article, let’s consider mcp4725 DAC IC.
MCP 4725 is a small, compact DAC module, often used in conjunction with Arduino, which means good news – documents and libraries are easy to get.
Here are some functions of the chip:
1.12 bit resolution
This is much better than the 8 bits provided by Arduino. If the supply voltage is 5V, each binary digit will be converted to 5V / (2 ^ 12) = 1.22mv, which provides an amazing resolution. This can be improved by reducing the supply voltage to 3.3V, in which case the resolution is 0.8mv or 800 μ v.
- I2C communication
The communication interface only needs two pins, serial data and serial clock, which saves the pins on the microcontroller. The speed range is 100kHz to 3.4MHz.
- Address password
You can change the I2C address by connecting the pin to VCC or GND. This is particularly useful when using multiple devices.
MCP 4725 is packaged in SOT23-6, which means it is not smaller than the slim SMD transistor, thus saving a lot of space.
In general, MCP 4725 is a powerful chip due to its size and function.
DAC is an important link between the analog and digital world. By converting the binary count into a proportional discrete voltage level, the computer can communicate with the devices that usually use analog signals.