Wednesday, September 30, 2009

Lab 2 - Stepping back from the instrument and learning how to interface with LabVIEW

In parallel to all of the work that we were doing for the instrument, we were also getting acquainted with the basic functions of LabVIEW - namely, we were learning how to plot output from the circuit that we were playing with before putting together the instrument.

Below, you can see the plots that we obtained by playing with the force sensor and the photoresistor.

















Force sensor output


















Photoresistor output

Monday, September 28, 2009

Lab 2 - Our instrument in its last few development stages

For our instrument, we chose a speaker as our sound output, and replaced the LED that was previously in our circuit with that speaker. We used the potentiometer to change the tone of the note.





We tried to build our own electrical music instrument using analog sensors to tune the frequencies. We played with the force sensor, thinking that we could control the notes by pressing different areas or combinations of areas to get different resistances (and thus, frequencies). We even tried to concentrate forces on the sensor at different areas with a bolt. However, we did not get repeatable resistance readouts. Also, we could not get satisfying resistance range differences. We decided to turn to other sensors.

We decided to use the potentiometer due to its stable and linear performance. We divided the resistance into 8 parts, and then set 8 cases for different output frequencies (and thus different notes: Do, Re, Mi, etc.). See figure:














Then, we decided to use the force sensor to control volume.

We made a control panel with all of marks on it so that people could play music without having to sift through the circuit board to play what they wanted to play.


Time to sing a song!

Lab 2 - Making progress with our circuit

After gaining confidence in the operation of the Arduino, we experimented with using it to drive a resistor-transistor-LED circuit. In order to build this, we looked back to the circuit diagrams from Lab 1.

In the Lab 1 circuit diagrams, we had a button/switch, an LM555 timer, capacitors, resistors, a transistor, a speaker/LED, and a 5V power supply. This time, we took away the LM555 timer and replaced the 5V power supply with the Arduino microprocessor. We recalculated our optimal resistors with different values, and added a potentiometer to the circuit. See below for diagram:




















We designed the circuit to work successfully with the LED, keeping in mind that the light blinking frequency depended on the resistance from potentiometer. This success was a booster to the next step -- an electronic musical instrument.

Lab 2 - Getting started with the Arduino!

As mentioned in the previous article, the Arduino microprocessor played a key role in this project. It functioned as the power supply, and enabled us to manipulate digital and analog inputs with C code. We started by programming the Arduino to make the basic LED blink, and then added a potentiometer to control the blinking of the LED.

After becoming pseudo-experts on the LED, we challenged ourselves by integrating all different kinds of sensors into our circuit (photoresistor, FSR, photo-interrupter and Hall-effect sensor). We waved our hands to interrupt light coming to the sensors, used different magnets, and bent and twisted sensors to see how this varied the LED frequency. It was quite fun!












Blinking LED





















Serial output of sensor behavior


After familiarizing ourselves with each sensor's characteristic, we started to think about which sensors we should choose for our musical instrument. Following are three videos of how we checked/played with switches, photo-interrupters and potentiometers.












Lab 2 - Reading sensors/microprocessor & PC interfacing

In this project, we learned how to program the Arduino microprocessor to read data from both digital and analog sensors (including, but not limited to, potentiometers, switches, photoresistors, force resistors) to return analog outputs. After we had some basic understanding of the Arduino, we integrated it with the circuit that we built in Lab 1, and made a fantastic musical instrument that can play songs!

Team 2:
1. Lisa Perez
2. Huai-Ning Chang
3. Sandeep Chandru

Tuesday, September 22, 2009

Lab 1 - Music to our ears

The first time we integrated the speaker into our circuit, it produced a mild clicking sound. A few swapped resistors later we heard a tone, the pitch of which we could control with our potentiometer. After a few minutes of playing around with our newly found musical instrument, teammates with music backgrounds were excited to announce that we could get a range of a whole octave with our 0-10kOhm range pot. The performance of our device was just as designed - no faulty connections or loose wires interfered with the steady hum of our little speaker. As for the value of our circuit as an expressive musical instrument, well, who are we as four engineers to decide what good music is? In this modern day and age, where everything seems to be considered modern art and music, without a doubt our little device would fit in quite well in some abstract performance. After all, we could get a whole octave! Perhaps, along with other teams and their devices that produce slightly different pitches and notes, we could someday form an ensemble and travel the world performing to crowds and selling out huge venues in minutes. The interface we created was simple enough (the tone of the instrument was, after all, controlled by a potentiometer), which is something we considered a success since such an instrument can be easily used by anybody willing to perfect their music skills. As a result, knowing that we are improving the world one song at a time, the experience of building and tuning our own little music-maker was naturally rewarding.

Lab 1 - Speaker Circuit


The topmost picture is the actual circuit to implement the LM555 timer, while the one below is the schematic diagram for the same circuit. The following paragraphs describe how the resistance values were arrived at.



Given above is the part of our circuit where the transistor is placed. The aim was to produce a sound at a frequency which is decided by the parameters of the LM555 circuit. The signal from the LM555 circuit is received at the base of the transistor. The speaker volume depends on the current flowing through it and voltage drop across its terminals. Value R6 decides the current Ic while R5 will govern Ib.
  • From the parameters defined for the speaker: Power = 0.5 W, Resistance = 7.3 Ώ (measured value). Using the equation P=I^2*R, we found the maximum current which can be passed through the speaker. Imax = 260 mA.
  • Deciding upon a value of 100mA for current Ic, we calculated R6. R6 = (Vcc - Vce - 7.3*0.1 )/0.1 = 40 Ώ. Here Vcc = 5V, and Vce = 0.3V

  • For the value of R5 we decided a current Ib of 15 mA. Then R5 = (Vbb – Vbe)/0.015. For a 74LS02 chip the typical output high voltage is 3.4V which is nothing but Vbb = 3.4V, while Vbe = 0.6V. Thus we got R5 = 187 Ohms.

  • Selecting from the set of available resistances, we got R5 = 175 Ohms and R5 = 48 Ohms. The actual values of Ic and Ib were now 85 mA and 16 mA respectively.



  • The LM555 produces a continuous waveform when operated in the astable mode for which the external circuit is given. The values of Ra, Rb and C decide the frequency of the waveform as well as its duty cycle.
  • We were provided with a potentiometer of 10 k Ώ to be connected as Ra. As explained in class, it was necessary to include a fixed resistance in addition to the potentiometer. But we checked as to what happens without a fixed resistance, and found that the circuit did not work.
  • The formulae for calculating frequency and duty cycle are:

Duty Cycle, D = Rb/(Ra+ 2Rb)
Frequency, F = 1.44/C/(Ra + 2Rb)

Here, Ra = R(pot) + R1

R(pot) varies from (0 – 10) k Ώ .

To get a frequency of 1000Hz when the potentiometer slide is at its mid portion

C = 0.1µF, R1 = 505 Ώ, Rb = 4.7k Ώ.

  • Thus, when a potentiometer (Range = (0 – 10)k Ώ )was used in series with Rb, we got a range of frequencies from (723 – 1453)Hz, which corresponds approximately to an Octave.
  • In order to get an Octave, one can stick to the equation R1 + 2Rb = 10000. 10000 is the maximum resistance given by the potentiometer.