Generate Audio using Arduino using R-2R DAC and LM358 Operational Amplifier

Here it is shown how audio can be generated using Arduino, R-2R DAC(digital to analog converter) and LM358 operational amplifier. The audio is first recorded and put into ROM of the Arduino. Then this audio is output is sent to R-2R ladder DAC which converts the digital audio signal into analog audio signal. The audio signal from the DAC is amplified by the LM358 operational amplifier and finally sent to a speaker.

The first step is to have audio samples of some audio in header file. We can use free recorder software like audacity to record audio. How to do this was explained in details in the tutorial Audio from Arduino using R2R DAC and transistor amplifier (Update: a better code is provided and explained here Arduino code for generating audio sample .

After you have the audio sample code uploaded into Arduino the next step is to interconnect the different circuit hardware. This is explained. The hardware circuit on breadboard is shown below

Audio using Arduino using R2R DAC and LM358 Operational Amplifier

  And the circuit schematic for this is shown below.

Arduino,R2R DAC,LM358 circuit diagram

In this circuit, the Arduino Mega 2560 PORTC is used to output audio samples into R-2R ladder DAC. The values used for the ladder resistors were 2.2KOhm and 4.7KOhm. The output from the ladder circuit is then fed into low pass filter with cutoff frequency of 20Khz, with resistor of 82Ohm and capacitor of 0.1uF. At this point it is the same circuit as used before with transistor amplifier. After the LPF, we have used LM358 op-amp as amplifying stage to drive the 8Ohm speaker. The two op-amp used here are simply buffer with no gain. At the output from the 2nd op-amp of the LM358 a 10uF capacitor was used to block any DC signal into the speaker.

The Arduino code and the audio sample used here are same as was used in the earlier tutorial Audio from Arduino using R2R DAC and transistor amplifier.

The following video shows the sound produced by this circuit.

Next see how the same thing can be done using LM368 audio amplifier.

Audio generate using Arduino, R-2R DAC and LM368

Post a Comment

Previous Post Next Post