PHYSICAL INTERFACES PROBLEM STATEMENT
INITIAL TESTING
To create an Illumaphone, a light-based, spatial musical instrument.
Initial testing (circuit wise) and code for this project was done in various stages -
RATIONALE BEHIND CHOICE OF PROJECT
Stage 1 - To understand the working of an LDR, which is basically a photo resistor. I created a circuit with a single LDR and printed the analog value for it on to the serial monitor.
While choosing this particular project I had a certain fascination with the idea of creating music using circuits and Arduino. I had initially chosen a project which involved a lot of lights but when we think about, lights are an electrical component and there’s no surprise to lighting up something using current but there this a certain mystery to producing musical notes using electrical components.
REFERENCE VIDEO My reference and inspiration for this particular project was taken from the following source. https://www.youtube.com/watch?v=LAt_svdEDRU In this particular project, they have used an Arduino set up and as for the software part, they have used a music programming language called ChucK, which was developed at Princeton a while back. Hence, I haven’t used the software part of from this source. I’ve written it myself, with a little bit of help from various websites (which have been mentioned further in this document).
Stage 2 - To connect multiple LDRs and get accurate readings. Stage 3 - To obtain an audio output from a single LDR using a piezo buzzer. Stage 4 - To conditionally obtain an audio output from each LDR, using a buzzer.
COMPONENTS After the initial testing which only required a couple of LDRs (borrowed from our existing kits), there were a number of other components required to start the project. Here’s an exhaustive list of all the components 1 Arduino Uno + USB 2 Bread boards 7 LDRs 7 Resistors (10k ohm) 40 Connecting wires 1 Jumper wire roll 1 Piezo Buzzer 1 8 Ohm speaker 1 SD Card Module 1 SD Card 1 SD Card Reader Cardboard box for base Cups/tubes
Circuit of a single LDR
Connecting a 8 ohm speaker into the existing circuit
LDR producing audio through a Piezo buzzer.
Connecting an SD Card Module into the circuit In order to incorporate external .wav audio files into my project, I needed an SD card Module, an SD Card and an SD card Reader. Audio files in the .wav format had to be added into the SD card from the computer using the SD Card Reader. Once that was done, the SD card then had to be inserted into the SD Card Module through the 5 pins which had to be connected as follows GND - GND MOSI - pin11 MISO - pin 12 CLK - pin 13 CS - pin 4
Multiple LDRs producing audio through a Piezo
FIGURING OUT THE CODE Getting to the final code involved a lot of stages since I could only manage a limited amount of help from the Internet. I found one screenshot and a couple of basic codes. Here are the codes used at various stages. Here’s what I used to get the LDRs working -
Here’s the code to obtain an audio output from multiple LDRs using a Piezo Buzzer -
The code was further modified to include external audio using an SD Card Module
In order to run this code, there were two libraries that had to be included, a standard SD Library and a TMRPCM Library, which was downloaded to call certain functions like ‘Play()’, ‘Volumn()’ etc, which have been used in the code.
The following code was executed to include external files using the SD Card Module and to play those files with the help of LDRs -
And lastly, the following code was executed to vary the frequency of the tone from the Buzzer, to create a musical pattern -
The tone() function works with two arguments, but can take up to three arguments. Let’s address the two required items first: tone (pin number, frequency in hertz); 1. The pin number that you will use on the Arduino. 2. The frequency specified in hertz. Hertz are cycles per second.
ASSEMBLING THE HARDWARE Assembling the hardware required 4 tubes and a cardboard box -
Space under the box on top of which the tubes were placed.
After this I created two holes each at the centre of where each tube had to placed, to make space from the LDRs to be connected, like this -
Each LDR was passed through two of these holes, at an equal distance, and the rest of the circuit was pushed under the box.
Wiring of the LDRs, from under the box.
AUDIO OUTPUT
LEARNING CURVE
My initial plan was to play external audio .wav files, for which I had attached an SD Card Module along with an 8 ohm speaker. However, upon execution I encountered a couple of problems with that set up. Firstly, the volume at it’s maximum with an 8 ohm speaker was not good enough for a musical instrument. Also, the audio files playing through the speaker were not clear and happened to create a lot of disturbance before starting to play which would have obviously spoiled the effect of the musical notes. Hence I tried an alternate method of varying the f requency of the tone coming from the buzzer. For this I used the ‘tone()’ function. This happened to create a fairly good musical effect.
This project offered a number of learning opportunities -
TAKING IT FORWARD Taking this project forward I’d like to include a number of more tones and to experiment with the ‘melody()’ function. Also, I’d like to try and connect a bigger speaker to Arduino using perhaps a Music Shield, in order to play external audio files at a higher clarity and volumn. I’d also like to remake the project using a Touch Board.
PROBLEMS ENCOUNTERED Problems encountered were, as mentioned, were of not being able to attach an external speaker to Aduino.
1. Understanding and executing an IfStatementConditional code. 2. Working with a new component - SD Card Module 3. Attaching a speaker to arduino and generating an audio output from the same. 4. Working with LDRs 5. Generating various sounds from a buzzer by changing the frequency.
FINAL OUTCOME The final outcome for this project is displayed in two different videos, uploaded along with this documentation. There are also several videos, showcasing the process and the various stages involved.
REFERENCES http://www.instructables.com/id/Illumaphone-Light-based-Electronic-Musical-Instrum/step5/Calibrate-and-Play/ http://www.instructables.com/id/Playing-Wave-file-using-arduino/ https://www.arduino.cc/en/Tutorial/PlayMelody http://www.online-convert.com/result/e1f3bb26562568da0676846e73ecc13f https://diyhacking.com/arduino-audio-player/ https://programmingelectronics.com/an-easy-way-to-make-noise-with-arduino-using-tone/ https://www.arduino.cc/en/Tutorial/SimpleAudioPlayer https://www.freesound.org/people/juskiddink/packs/3838/
ACKNOWLEDGMENTS
I’d like to extend my deepest gratitude to Mr. Prem Sagar for his constant guidance and support throughout the module. Looking forward to learning from you again, Sir. Thank you!