<> Navigation: * [[AJMPublic/teaching/scm-lab|SCM Wiki page]] * [[AJMPublic/teaching/arduino-pi/projects/arduino/getting-started|Arduino: Getting Started page]] = Arduino : DAC & Audio : A Light Theremin = To see what we will end up with, [[https://plus.google.com/u/0/photos/108602826145190910811/albums/5878611188845650385/5878611281992153186?pid=5878611281992153186&oid=108602826145190910811|have a look at this video.]] == Aims == The aims of this experiment are to * Introduce you to the basics of electronics. * Embedded programming (in C): that is, programming a microcontroller to do what would be rather complex with traditional electronics alone. * Digital-to-analogue conversion * Buffer circuits using an op-amp * Amplification using an op-amp * RC filters * wave-form generation * sound generation and control * And finally, putting it all together to make a light theremin: a (musical) instrument you can play. * {{{#!wiki important Important This list of aims should set the tone and character of your data collection and report. While we will build a light theremin in this experiment, the experiment is primarily about electronics. So your writeup should be likewise focused on the electronics! '''Circuit diagrams''': You have been supplied with two kinds of circuit diagrams * Schematic, and * Bread-board views. Your report should include the schematic diagrams only. The bread-board views are there for your convenience only! }}} == Credits == This experiment is based on the [[http://www.instructables.com/id/Arduino-Audio-Output/?ALLSTEPS|superb tutorial by Amanda Aghassaei on Instructables]]. I have created all circuit diagrams with the [[http://fritzing.org|Fritzing package]]. It is open source and really cool! == Assessment == This project will be assessed on the following items: * There are tasks and questions included in each section. These need to be answered, data collected, and analysed. The tasks are clearly defined in yellow or green boxes. * Circuits used will need to be described. It is not sufficient to say "I used this circuit"; you need to make a serious attempt to describe how the circuit works. The experiment is divided into logical sections and a lot of information provided to help you discover how the rather complex circuit is put together from smaller, easy to understand bits. Additionally, additional reading material and links to external websites are provided. You are expected to read these (within reason) to help you write an informed and compelete report. * This is not an exercise on programming so you need not write much about the Arduino's programs, but you will need to say something about the Arduino and the way it functions (how it handles inputs and output being the most pertinent for this project). Any programs you choose to include should be in an Appendix. * Tables, graphs and analysis is assessed as with any other report. * You are free to use images of the circuits diagrams on this Wiki in your report (acknowledge the source!). * There is no error analysis required. * For details of report writing see the SCM QM+ page. * //How much should I include?//: Clearly, if you include all circuit diagrams in your report, it will be very large indeed. You need to keep a balance. If in doubt, ask! == Parts == Please make sure you have all of these before you proceed. And make sure you return all of these when you are done! * 9 22 kOhm resistors 5% metal film * 7 10 kOhm resistors 5% metal film * 9 20 kOhm resistors 1% metal film * 7 10 kOhm resistors 1% metal film * 1 10 Ohm resistor 1% metal film * 1 1 kOhm resistor 1% metal film * 1 220 Ohm resistor * 1 LED (red or green) * Arduino Uno (mounted on a board) * wire jumpers * 2 TS922IN IC, OP AMP * 2 POTENTIOMETER, 10K * 8 ohm speaker * Capacitors 0.01 $\mu$F, 0.1 $\mu$F and 220 $\mu$F * Mounted breadboard * 2 Phototransistors/photodiodes. * Oscilloscope * 1 USB cable * Computer == Outline of the experiment == This experiment consists of a few parts/ * [[AJMPublic/teaching/arduino-pi/projects/arduino/dac-audio/dac|Digital to Analogue Converter (DAC)]]: First we will learn how to generate wave forms using the Arduino Uno. Here we will build an 8-bit digital to analogue converter (DAC). With this, as we shall see, we will be able to generate a variety of waveforms, though our focus will be on sine wave generation. * [[AJMPublic/teaching/arduino-pi/projects/arduino/dac-audio/buffer-circuits|Buffer circuits]]: Next we will learn how to buffer the waveforms from the DAC. We need this step as the DAC is unable to handle any load/ you can't connect the DAC output to a speaker and hear the waveform. If you do so, it will heavily distort. Even a simple LED (light emitting diode) will cause a distortion. There are many ways of buffering the waveform. Here we will use an operational amplifier (op-amp) to do it. * [[AJMPublic/teaching/arduino-pi/projects/arduino/dac-audio/rc-filter|RC filter]]: Even though we have used an 8-bit DAC, the resulting waveform will be rough/ it will have steps (good CD players use a 24-bit DAC!). To smoothen it we will use an RC filter. In this part of the experiment we will learn how to construct an appropriate RC filter and will explore how the filter alters the shape of the wave. * [[AJMPublic/teaching/arduino-pi/projects/arduino/dac-audio/amplification|Amplification]]: Another use of an op-amp is amplification. In this step we will use two op-amps to amplify not the voltage, but the current of the signal. Our aim here is to get the current large enough to allow us to drive a speaker and hear the waveform. * [[AJMPublic/teaching/arduino-pi/projects/arduino/dac-audio/light-theremin|The Light Theremin]]: To construct a light Theremin we need to be able to control the pitch (and volume) of the sound. We will explore various setups (using variable resistors and photo transistors/photoresistors) to implement pitch control, and possibly volume control too. If successful, by this stage you will have your light Theremin working. == Suggested Timetable == * Afternoon 1: Arduino introduction and start DAC * Afternoon 2: Complete DAC * Afternoon 3: Buffer Circuits and RC filter * Afternoon 4: Amplification * Afternoon 5: Light Theremin * Afternoon 6: Make sure you have done all the tasks you need to do! == Administration == [[AJMPublic/teaching/arduino-pi/projects/arduino/dac-audio/old-versions|AJMPublic/teaching/arduino-pi/projects/arduino/dac-audio/old-versions]] === Prelude === * Prelude to the experiment: Learn about the [[AJMPublic/teaching/arduino-pi/projects/arduino/getting-started|Arduino microcontroller]] and perform the following experiments as they will introduce you to various aspects of the Arduino (use the links to the webpages. The PDFs are there as a backup in case the links are down): * (Expt 1) [[http://learn.adafruit.com/adafruit-arduino-lesson-1-blink|Blink]] ([[attachment:adafruit-arduino-lesson-1-blink.pdf|PDF]]) * (Expt 3) [[http://learn.adafruit.com/adafruit-arduino-lesson-2-leds|Control a single LED]] ([[attachment:adafruit-arduino-lesson-2-leds.pdf|PDF]]) * (Expt 5) [[http://learn.adafruit.com/adafruit-arduino-lesson-6-digital-inputs|Digital Inputs]] ([[attachment:adafruit-arduino-lesson-6-digital-inputs.pdf|PDF]]) You will not be assessed on the above experiments so please do not include them in the main body of your report. The point of these is to give you an idea of what a sketch is and how we communicate with the Arduino. [[AJMPublic/teaching/arduino-pi/projects/arduino/dac-audio/serial-monitor|Visualizing waveforms using the Serial Monitor.]]