pcomp w4 hw

For this week’s homework, I thought it would be cool to make a theremin. Since the only appropriate sensor I had for this endeavor was a photoresistor, it would have to be a light theremin. Here was the game plan:

Readings from the photoresistor would feed into the Arduino as an analog input, which would then map to digital output via PWM, causing the piezo to emit varying tones.

Well, it worked, but the theremin sounded god-awful and insufferably loud to boot, so I decided to add a potentiometer next to the piezo in order to adjust the voltage (ie, the volume).

Somewhat better, but the sound was still so grating that I also wanted to be able to turn it off. Lacking a slide switch, I added a button, which obviously is not the same thing.

Not a great solution, and I’m quickly growing tired of this theremin. I like the button though, so I’ll probably try to make some sort of keyboard instead.

pcomp help session notes

Pulse Width Modulation:

  • Digital microcontrollers can’t produce a varying (analog) voltage; can only produce high or low
    • PWM is a “fake” analog voltage produced by a series of voltage pulses at regular intervals
    • switch flips on and off (arduino does it 250x a second)
      • width of pulses is “on”: called pulse width
    • not actually lowering the voltage; it is pseudo-analog output
  • duty (output) 0 – 255; arduino voltage is 0-5
    • maps duty to voltage; every change of one point changes the output voltage by 5/255 (because 255 duty corresponds to 5 volts)
    • 50% duty cycle when on and off is the same; effective voltage is half the total voltage
      • pwm_50_percent
    • if duty cycle is less than 50% (ie, pulses for a shorter amount of time than it pauses), the effective voltage is lower
      • pwm_33_percent

Transistors are switches


Analog Output

pcomp office hours w/ chino

pulldown resistor

pulldown resistor

  • switch is after power supply; input pin goes HIGH when pressed because voltage from power source is able to flow through to input pin
    • digital input is path of least resistance after a switch > goes HIGH
  • “pulls” random inputs from digital/analog input to ground
  • stabilizes the input signal


pullup resistor with LED and code (reads a digital input and turns on an LED when input goes HIGH)

pull up resistor

  • pull up resistor equalizes voltage between digital input and power source
  • switch is before ground; when button is pressed, input pin goes LOW because current can then flow to ground

pcomp w4 class notes

Pulse width modulation:

  • voltage turns on and off, etc
  • pulse width: time that it’s on
  • duty cycle: proportion of time that it’s on or off
  • looks at duty cycle (amount that it’s on vs amount that it’s off over the length of the wave) and uses variation to communicate to some other device


Potentiometer: different values as it turns
Servo: uses the pulse width to determine the position; microchip looks at pulse width that comes in from arduino, changes the direction

Servo connected to a potentiometer 

When you have one frequency of sound, it’s one sound; if you’re able to change the frequency with pulse width modulation, you can make music

Pcomp W3 HW

Pick a piece of interactive technology in public, used by multiple people. Write down your assumptions as to how it’s used, and describe the context in which it’s being used. Watch people use it, preferably without them knowing they’re being observed. Take notes on how they use it, what they do differently, what appear to be the difficulties, what appear to be the easiest parts. Record what takes the longest, what takes the least amount of time, and how long the whole transaction takes. Consider how the readings from Norman and Crawford reflect on what you see.

Elevators are a piece of “interactive technology” used in our Tisch building. Gathering from my past experiences with elevators, I would assume that once you press either the up or down button, the elevator will pick you up once it’s ready to go the direction you choose. Once in the elevator, you press the button that corresponds with your destination floor. The context for our Tisch elevators is that students use them to get to class, usually in a rush.

Some students will press a button multiple times, as if to hasten the elevator’s arrival. Some will look up at the progress bar to see where the elevator is, and leave if they discern a long wait. Some will press a button without looking at the bar, and leave after their patience runs out. Some will simply look at the size of the crowd that’s accumulated in front of the elevator bank to decide whether to wait for the elevator.

A difficulty of these elevators is that sometimes you will be picked up seemingly regardless of whether the elevator is going in your desired direction. The bemused users then must choose their floor once again, lest their destination is skipped entirely. This happens most often at the ground floor, when the crowd boards, chooses their destination, only to be brought to the basement and forced to press their floor’s number again. Another difficulty is the wait itself, which causes users to reevaluate their decision to take the elevator. Unless you’re lucky, this part will take the longest of the entire transaction.

The easiest part is pressing your floor’s button once you’ve boarded. The time it takes to travel to your destination is usually the part of the process that takes the least amount of time, unless there’s a big crowd that wants to go to every floor before yours. Another part which is quite easy is the initial pressing of the up/down buttons in the lobby.


Transtech: W3 class notes

  • can capture motor signals in brain to control an avatar: guy in fMRI machine in Israel sees through a robot’s eyes in France, moves toward beckoning person
  • brain can incorporate prosthetics, iphone as if it were part of your body
  • brain jelly grows connections like a human brain…

synthetic telepathy: brain reacts the same way to a real sound and an imagined sound (the latter is weaker)

Transcranial Direct Current Stimulation (tDCS):

  • direct current, can induce specific things based on placement on head
    • anode on right temple and cathode on left shoulder > facilitates learning; much less anxiety/self-judgement/negative thoughts > able to perform better
  • electrodes can send signal to brain
    • top of head, bottom of back of head, can control stress


Binaural beats

  • Use wave interference principle to create a third wave: two waves (one through each ear) combine, creates third wave that entrains brain
    • doesn’t go far past primary auditory areas



  • sound at a high frequency (above what we can hear, >20,000 hertz)
  • 2 million hertz; mechanically vibrates cells to increase/decrease activity
  • https://www.youtube.com/watch?v=BFyh-4nx134
    • Noninvaisve neuromodulation:
      • TMS: strong magnetic coils
      • tDCS (consumer grade available)
        • Foc.us, Thync
      • transcranial ultrasound
        • mood enhancement:
          • frontal cortex involved in mood
          • focused ultrasound device targets right frontal cortex, makes subjects feel better
          • depressed people have more DMN, especially negative emotion circuits; decreased activity in cognitive control centers
            • frontal cortex stimulation produces opposite effect

Loving compassion meditation: improves mood, changes baseline level of emotional state

Meditation is like auto-hypnosis, but is active: internal wakefulness