Tuesday, February 23, 2016

Instrument

My musical instrument is a simple 3 note button presser. It's body has a white foam core base with a white box housing and three colored buttons. Each button corresponds to a different note. It's pretty close to on key, so simple songs like "Mary Had a Little Lamb" sound pretty good.

I think my design could definitely be improved. Two things in particular stand out:

1. I would like to design buttons external to the breadboard. I like the colorful buttons, but I think the play-ability of the instrument would be improved if the buttons were more incorporated into the housing

2. I would like to improve on the housing in general. At this point the base and the body are two separate parts, however if I could find/build the perfect box to house it all then my instrument could become portable. On that note I would like to wire up a battery power source so I don't have to deal with the computer cord.

3. Maybe I could throw in a few more buttons/notes

Here is the circuit I built with the three buttons and the speaker.



With its housing on my completed instrument kind of looks like a little piano!



Here's my code





Following Crawford's model of interaction:

Human:

Listen - Observes buttons
Think - Decides to play a song
Speak - Presses buttons

Input - Hears tone
Processing - Decides to stop playing song
Output - Stops pressing button

Result - Tone stops


Computer:

Input - Button press
Processing - Completed circuit!
     Determines which button is pressed
     Sets the Val of the button to HIGH
     If button 1, 2, or 3 the notes 260, 290, or 320 respectively get sent to the speaker
Output - Speaker tone

Listen - No button pressed
Think - Open circuit
Output - Not tone




And the grand finale!


Tuesday, February 16, 2016

Arduino Labs 1 - partner Ignacio

1. Blinking LED Circuit with Arduino

2.Switch and LED circuit with Arduino

  1. 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?
    1. By reversing the ground and power connection to the switch, creating a closed circuit with the LED until the switch is pressed. 

3.Potentiometer and LED circuit with Arduino

  1. When the potentiometer is turned all the way down (offering minimum resistance), what voltage is read at Arduino pin A0?
    1. The full 5 Volts
    2. or 1023 -- 255 as read through the Arduino serial monitor
  2. When the potentiometer is turned all the way up (offering maximum resistance), what voltage is read at Arduino pin A0?
    1. 0 volts
  3. How much resistance must the potentiometer offer in order for the voltage at Arduino pin A0 be 2.5V?
    1. Vout = Vin(R2/(R1+R2))
    2.  Vout/Vin = R2/(R1+R2)
    3. 1/2 = R2/(560+R2)
    4. R2 = 560 ohms
  4. Why have I multiplied the potentiometer value (potVal in the code) by 0.25 in order to set the brightness of the LED (ledVal in the code)? In other words, why couldn't I just set the LED output value to be exactly the same value as the potentiometer input value?
    1. Because then when the potentiometer was turned all the way down (least resistance) the LED would have too much current and would blow.

4.Potentiometer and speaker circuit with Arduino

(Poor video quality I apologize, but if you turn the volume way up you can hear the tone change)

  1. The speaker is connected directly to power and ground... Isn't that a short circuit and therefore dangerous?
    1. It isn't only because we are regulating the amount of current running from pin 5, therefore using the arduino, like a variable resistor
  2. The sound produced by this circuit is not very loud. What would you have to do to get the sound louder?
    1. Get a bigger speaker and run much more current through it!
  3. Are we having fun yet?
    1. HA yes..


5.Photoresistor and speaker circuit with Arduino


  1. How would you change the circuit (without altering the code), so that the behavior of the sound in relation to the light falling on the photoresistor was reversed?
    1. Switch the ground and power leads to the photoresistor, so that at full light it would register the most resistance and at lower light it would register less resistance. 

Tuesday, February 9, 2016

Electricity Labs

1. Setting up the breadboard



2. Simple LED Circuit


  1. What is the purpose of the resistor?
    • To limit the current in the circuit (so that the LED doesn't blow)
  2. Using Ohm's Law (V=IR), what is the current running through this circuit?
    • 5V = I * 560 ohms
    • I = 8.93 mA
  3. Using Ohm's Law again, calculate the resistor value you would have to use in order to have only 15mA of current in this circuit?
    • 5V / 15mA = ohms
    • = 333.3 ohms
  4. Assuming the LED drops 2.2V of voltage, how much voltage is dropped by the resistor?
    • 5V - 2.2V
    • = 2.8V

3. Simple LED Circuit With Switch




  1. Looking at the schematic diagram, if you moved the switch so that it was connected between the resistor and the LED, how would the circuit's behavior change?
    • The behavior does not change the switch still effects the circuit in the same way.
  2. Looking at the schematic diagram, if you moved the switch so that it was connected between the LED and ground, , how would the circuit's behavior change?
    • The behavior of the circuit would not change. No matter where the switch is it either allows current to flow through the circuit or not. 

4. Simple LED circuit with potentiometer



  1. Why is the 560Ω resistor necessary?
    • Because without it, when the potentiometer was turned to least resistance there would be too much current for the LED and it would blow.
  2. How much current is flowing through the circuit when the 10kΩ potentiometer is turned all the way up (offering the maximum resistance)?
    • 5V = I * 10560 ohm
    • 5V / 10560 ohm = .47 mA
  3. What other types of variable resistors do you know about (name at least 4)?
    • photoresistor, thermistor, carbon film resistors, wire-wound resistor

5. Dueling LEDs circuit with potentiometer

  1. Give a quick (1-2 sentences) explanation of why this circuit behaves the way it does. Include an explanation for how the current going through each LED is affected by a single turn of the potentiometer.
    • When the potentiometer is turned it increases the resistance to one LED while decreasing the resistance to the other. As the potentiometer is turned back current more current is allowed to flow through one LED or the other causing it to light.

6. Capacitor charging circuit


  1. How does adding a 2.2kΩ resistor between the pushbutton and the capacitor affect the capacitor's charging behavior?
    • It will charge more slowly because it receives less current

7. Capacitor discharging circuit with LED decay


  1. Looking at the circuit schematic diagam, why does the capacitor discharge up through the LED part of the circuit, and not directly from the capacitor down to ground?
    • When the capacitor is fully charged it acts like a very high resistor, allowing no current to pass through it directly into ground, instead it discharges through the LED.