Вы находитесь на странице: 1из 6

ELP-305 : Lab Report

Experiment - 5
(Audio Playback with Modulation)

Submitted by​: Tuesday sub-group :- Yash Garg – 2015EE10691


Harsh Malara – 2015EE30649

Aim​ :-​ Learn to use signal conditioning, shaping and manipulation operations for interfacing
with real world appliances.

Problem Statement​ :-
- To reproduce the audio signal on a speaker with different modulations in terms of
amplitude and frequency using an 8-bit parallel DAC and a LM386 amplifier.
- Amplitude modulation can be achieved by using multiplication based on scaling of
potentiometer input. And Frequency modulation can be achieved by varying the delay
between samples.

Apparatus Required​ :-

● Arduino
● 8 bit DAC0800
● LM386 Audio amplifier
● Breadboard
● Potentiometer
● Resistors and Capacitors
● Connecting wires
● DC Supply
● Speaker

Challenges Faced​ :-

1. Understanding the design of the code for the experiment was the biggest challenge
2. Integrating DAC and LM386 chip with Arduino microcontroller was a complex task
3. Also capacitors present in the lab were not of correct values, and it created a lot of
confusion.

Block Diagram Schematic​ :-

Circuit Diagram​:-

Following circuit diagrams were used to make the required circuit. Arduino pins 0-7 were
applied to digital inputs of DAC.
Breadboard Circuit Picture​ :-
Flow Chart for Experiment :-

Observations​ :-

1.​ What would happen if we chose to digitize using 4-bits instead of 8-bits ? What if we chose
24-bits instead of 8-bits ?

Ans.​ If we use 4-bits instead of 8-bits, quality of audio produced will be worse, as now analog
audio signal is generated from only 4 discretization levels instead of 8, so jumping from one
level to other will not be that smooth as in case of 8-bits. Similarly if we use 24-bits instead of
8-bits, we will get a better output that represents original smooth wave as now there are more
discretization levels. But this will require increased circuitry, so we should only use it if it makes
difference to human ears in terms of sound quality.
2.​ How and why would you use a digital potentiometer ? More importantly, where (in which
design application) would you absolutely insist that a digital potentiometer be used ?

Ans.​ 1) A digital potentiometer operates like a traditional mechanical potentiometer (pot),


which is a variable resistor, except the digipot is an integrated chip (IC) that accepts signal input
rather than the physical movement of a shaft or slide for adjustment. Digipots modify the
resistance value via digital inputs rather than a physical slider or rotary wheel.

2) Digipots are convenient for use where environmental factors can adversely affect a
mechanical pot. Environments with vibration or particles like dirt, dust, moisture or grease that
can gum up the shaft can drive one to choose a digital potentiometer. Digipots can be better
protected from the environment since they can be encapsulated.

3) Digipots can also offer higher resolution, greater stability, and solid-state reliability. They are
smaller than mechanical potentiometers and can fit in tiny IC packages. They must be
programmed, typically with I​2​C or SPI communication bus protocols. Digital potentiometers can
be made with just 1% end-to-end resistance tolerance and are needed in tasks that require high
reliability and memory features.

Conclusion​ :-

In this experiment we reproduce the audio signal on a speaker with different modulations in
terms of amplitude and frequency using an 8-bit parallel DAC and a LM386 amplifier. We
achieved amplitude variations using multiplication based on scaling of potentiometer input and
frequency modulation was achieved by varying the delay between samples.

References​ :-

[1]​ ​https://drive.google.com/file/d/0B6xIF3HrSm15UGZSbllEcXVjRXM/view
[2] http://www.ti.com/lit/ds/symlink/dac0800.pdf
[3] http://www.ti.com/lit/ds/symlink/lm386.pdf
[4] https://electronics.stackexchange.com/questions/120687/how-to-correctly-connect-audio-
plug-to-lm386
[5] https://www.arduino.cc/en/tutorial/melody
[6] https://www.analogictips.com/what-is-a-digital-potentiometer/
Appendix : Code for Audio Playback with Modulation

int length = 15; // no. of notes


char notes[] = "ccggaagffeeddc ";
int beats[] = { 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 4 };
int tempo = 300;

void playTone(int tone, int duration)


{
for(long i = 0; i < duration * 1000L; i += tone * 2)
{
PORTD=255;
delayMicroseconds(tone);
PORTD=0;
delayMicroseconds(tone);
}
}

void playNote(char note, int duration)


{
char names[] = { 'c', 'd', 'e', 'f', 'g', 'a', 'b', 'C' };
int tones[] = { 1915, 1700, 1519, 1432, 1275, 1136, 1014, 956 };

// play the tone corresponding to the note name


for (int i = 0; i < 8; i++)
{
if(names[i] == note)
playTone(tones[i], duration);
}
}

void setup()
{
for(int i=0;i<8;i++)
pinMode(i,OUTPUT);
}

void loop()
{
for(int i = 0; i < length; i++)
{
if(notes[i] == ' ')
delay(beats[i] * tempo); // rest
else
playNote(notes[i], beats[i]*tempo);

// pause between notes


delay(tempo);
}
}

Вам также может понравиться