Donnerstag, 12. Februar 2015

Lab 2 - Microcontrollers

Blinking LED with Arduino




Switch and LED circuit with Arduino

How would you modify the circuit (without altering the code) so that the LED was turned on by default, and only went off when someone pressed the switch?



Potentiometer and LED Circuit with Arduino


  1. The reading is 1023. To convert to voltage we have to multiply this sensor value by 5/1023. This equals 5V.
  2. The reading is 0. Doing the above math, we geth 0V.
  3. To find the reading we have to solve for X in this equation. 2.5 = (5/1023) * X. 2.5/(5/1023) = 592. 
  4. The analogRead ranges from 0 to 1023. The LED output value, however, only ranges from 0-255 because it is digital. Thus, you need to convert the analog reading to a digital reading. This is done by multiplying by 0.25 or dividing by 4.

Potentiometer and Speaker Circuit with Arduino


  1. No, because the speaker is dropping some voltage
  2. The volume of the speaker is dictated by the current running through it. So, in order to have the volume be higher, you'd need a high current to reach the speaker, i.e. amplify it.
  3. YES!

Photoresistor and Speaker Circuit with Arduino


  1. You need to change the 10kΩ resistor with the photoresistor. That is because as there is light shining on the photoresistor its resistance of it is low. Hence, more current flows into ground directly. However, when the light source is low, the resistance of the photosensor is high and less current flows into ground and rather through the 10kΩ resistor to the Arduino. 
 

Instrument


 
  • Crawford defines interactivity as "a cyclic process in which two actors alternately listen, think, and speak". In this case, the two actors are the instrument and I. First, let's break the listening, thinking, and speking down for each actor.
    • instrument: the instrument has two ways of listening: the photosensor and the pressure sensor. The thinking is done by the arduino. The photosensor and pressuresensor are programmed to give input. This input is calculated from analog to digital for the output of the speaker (which obviously does the speaking of the instrument).  The spoons, however, do not give input; they merely complete the second circuit.
    • I: I do the listening with my ears, the thinking with my brain, and the speaking with my hand movements
  • In the video, I first listen, then think what I can do to change the sound, and decide to move my hand. As soon as I move my hand, the insturment listens, thinks, and speaks. (Almost) instantly I listen again, think, and then speak. Then it's the instrument's turn again. This process keeps on going until I decide to no longer use the instrument and turn it off. 
  • For improvements I could do the following:
    • in the video I am using a row of coins as conductors between the spoons. I could have set up different conductors to manipulate the sound more with the spoons. Further, it is difficult to both slide the top of the box and activate the pressure sensor simulateously. Next time I should fix the pressure sensor under the box, so I can slide the top of the box and press down on the sensor at the same time.