# Group Project

GroupProject

Microcontrolleras an Instrument to Play the First Notes Of O Canada.

Objectives

1. To learn the interaction between a digital signal and an analog signal using the relevant instruments.

2. Study electromagnetics, sound and speakers.

3. To familiarize with the use of the Arduino.

Thisproject exercise requires that one use their individualmicrocontroller as an instrument to play the first notes of O Canada.The Arduino being a digital instrument can play the part ofsynthesizing this instrument through conversion of a digital signalto an analog signal. The Arduino turns the signal from discretevalues into continuous values. In this problem the Arduino acts as atransducer by converting the signal into the preferable frequency ofthe output. Varying the frequency of the output signal of our Arduinowe can tune it according to that of the instrument that we want. Thefigures below shows one such example of the experiment with theschematic diagram and the output signal. The notes of the musicalinstrument are delivered as an analog output from the speaker(Jonathan&amp Ramesh, 2014).

Figure1

Toolsand equipment

1. Arduino board

2. Computer to program the Arduino

4. Connecting wires

5. 7 Resistors two R (36.5ohms) and five 2R (73ohms).

6. Cathode ray oscilloscope,

7. Speaker

8. Signal generator

Discussion

Inthis case, we are only suing three pins from our input this is a3-Bit Digital to Analog Conversion (DAC) circuit. To get the valuesof the resistors that we need we have to calculate the values fromohms law by V/I=R and then use the resistors whose values are ratedin our calculations in our circuit. The 3-bit circuit will have thecode input as follows (001, 010, and 100). Current flowing acrossany active at any particular point is I0=Vref/ 3R).At each of the branch, the current divides itself into two I2= I1/2and I1= I0/2.Current into the lower bit divides more sine and each stage developstwo signals. For generating sound, a period interrupt is employed forthis purpose. Below is a table of periodic interrupt and that of dataso as to generate sound (Jonathan&amp Ramesh, 2014).

Figure2

Figure3

Thethree digital inputs have an output of Iout=(4b2+ 2b1+ b0)Vref/ (24R).The 3-bit microcontroller will be able to generate 8 differentcurrent outputs with a resolution of 1.25mA as presented in the tablebelow (Jonathan&amp Ramesh, 2014).

 N Q2       Q1       Q0 Iout (μA) 0 0    0    0 0.0 1 0    0    5.0 1.25 2 0    5.0  0 2.5 3 0    5.0  5.0 3.75 4 3.3  0    0 5.00 5 5.0  0    5.0 6.25 6 5.0  5.0  0 7.50 7 5.0  5.0 5.0 8.75

Bit 2

Bit 1

Bit 0

Thefigure below is the analog output signal of the DAC.

Figure3

Tohave my own code I modifies the values of the independent variablesin the code made by others to make it perform according to what wewant. The code of the project was as below

Figure4

Flowchartfor the program variables is as below

Figure5

Conclusion

Theexperiment was a huge success in that it showed the versatility ofthe microcontrollers while at the same time drilling home the pointof DACs. These ideas might also be applied to other problems such ashaving a microcontroller that controls the voicemail message of aphone once it rings and turns out unreachable. It was thus a veryappealing and an informative experiment as it will allow me tobenefit later in the near future (Jonathan&amp Ramesh, 2014).

References

Jonathan,V., and Ramesh, Y. Digitalto Analog Conversion and Sound EmbeddedSystems – ShapeThe World.Chapter13: Retrieved 12thNov, 2015 fromhttp://users.ece.utexas.edu/~valvano/Volume1/E-Book/C13_DACSound.html