Recitation 3: Sensors

Partners: Jessica Chon and Cassie Ulvick

We intended to assemble a system such that when the moisture sensor received an input beyond a certain threshold, the motor would turn on, thus spinning the fan attached to the motor. We chose the moisture sensor because we were intrigued by it and curious as to what kinds of moisture would surpass the threshold (e.g. sweaty palms? Water poured onto Jessica’s hand?)

Materials:

Jumper cables

Arduino

Breadboard

Capacitor

Transistor

Motor

Diode

Attachable fan

10k resistor moisture sensor

For reference, we used class 6 notes. The Arduino example Knock was helpful– Cassie used that to follow the threshold idea and apply that to the sketch for our circuit. We used the website given ( https://www.seeedstudio.com/Grove-Moisture-Sensor-p-955.html ) and also ( https://learn.sparkfun.com/tutorials/soil-moisture-sensor-hookup-guide) and in hindsight, the second website did not apply as much to our final product but it helped to confirm how to connect the moisture sensor to the Arduino which was helpful.

In terms of steps taken to make our little device friendo work properly: We changed the resistor from 220 to 10k. We realized that the fan was not turning because it was on the table and didn’t have enough power to turn itself and overcome the resisting force it was facing from the table. Other than that, we did not have to make modifications to the circuitry in order for it to work.

What did we learn? Well, for starters, palm sweat has more moisture than breath, and honestly, I didn’t expect that. Also, this would probably work best for sensing moisture in plants. Further, having 3 people working together served as yet another reminder of how beneficial collaboration is to this process.

I don’t use anything I’m aware of in my daily life that specifically senses moisture. I wish that the machines at the gym would turn on the fans automatically once sensing sweat on them. I assume a dehumidifier operates with a similar but probably more expensive kind of moisture sensor, though this is a relatively less interactive device since its appeal for being purchased and used is in the lack of need to interact with it in order for it to work.

If continued, I would like to try adjusting the threshold to better understand which levels of moisture correspond to which threshold values, thus getting a better sense for where some limits are. I would also *love* to build a device for the gym such that when my hand surpassed a certain amount of moisture, indicating that I was sweaty (and probably going h.a.m. on some cardio), the sensor act on the input and turn on a motor output which would thus power a fan. I’m attaching the code below in case any person in the future ever cares to design the treadmill/ stair stepper of my dreams as just described.

 

Part B

With code and dumplings, I see the curly brackets as comparable to the dough of the dumpling, in the sense that all of the code is enclosed within the brackets similar to how all the tofu and su cai (or whatever dumpling filling you so choose). Like a dumpling, the options for filling that outside shell of curly brackets are seemingly endless. Still, the way you go about filling the dumpling has to be within reason. And with the establishment of reliable recipes, you can mass produce dumplings (thank God for that) without having to figure out the basic components of the recipe from scratch every time.

Computer influence on human behavior: In terms of results, the computer is able to retrieve massive amounts of information instantly. As such, we have become accustomed to this speed of retrieval and have started to demand the same of the material goods we acquire in everyday life. The rapidly developing same-day delivery industry is a prime example of this. In order to remain relevant in the retail industry, big brands are offering same-day delivery service in order to satisfy people’s desire to have what they want as quickly as possible. Time remains one of, if not the most, invaluable forms of wealth, so it follows that eliminating the time necessary to complete something (like Google how to program a moisture sensor or order xiaolongbao on eleme) would be rapidly welcomed into people’s lives.

const int moistureSensor = A0; //analog input is A0
const int fanOutput = 10; //analog output is 10
const int threshold = 300; //this is the level of moisture it takes to turn the fan on

int sensorReading = 0; //stores the value
int fanState = LOW; //stores the status of fan


void setup() {
  pinMode(fanOutput, OUTPUT); //fan is an output
  Serial.begin(9600);

}

void loop() {
  //reads the sensor
  sensorReading = analogRead(moistureSensor);

  //if the sensor reading is greater than the threshold, the fan will turn on
  if (sensorReading >= threshold) {
    digitalWrite(fanOutput, HIGH);
  }

}

Ix Lab Recitation 2: Arduino Basics

Exercise 1

Part A:

Step 1

I misread the provided schematic diagram and missed that the resistor needed to go to ground. As such, I was confused why my little LED friend was not responding to my button-pressing. I sought out help and once made aware of my error, I corrected it and was pleased to find that the LED blinked when the button was pressed. Yay circuits.

 

Step 2

Since I ran out of time during recitation, I had to take apart my circuit. Later that afternoon, I went to 826 to continue working.

I started over on the circuit (obviously, since I took it apart before), and saw how much of it I could assemble from “memory” i.e. without needing to refer back to the pictures I took of my circuit before, and instead tried to intuitively understand how components are communicating with the Arduino. This was a good use of time because I thought more carefully about what I was doing.

When writing the code to make the LED blink continuously, it wasn’t clicking for me at first. I did not realize that I was supposed to make the LED blink while the button is being pressed by coding it all after the “else”.

At first, I was thinking you just needed to put a delay for ledPin(HIGH) and ledPin (LOW), respectively. At this point, I forget which instructor helped me, but one of them helped me see my mistake and correct my code. Then the little LED friend blinked just as I hoped he would. Success.

 

Step 3

I was quite confused at first about the fade function. I understood conceptually what was going on, and that the fading needed to happen after “else”, but I was struggling with the syntax and putting everything together.

Luckily, my partner for the part B pair work (Jessica Chon) helped me understand how to combine the button code from the previous step and the fade code in order to make the light fade when the pushbutton switch was pressed. Yay for collaboration.

 

Step 4

Many toils met while making this little friendo. My original thought was to insert delays into the void loop such that the three lights (red, green, red) would send the Morse code signal for SOS when the button was pressed, as a kind of homage to holiday-induced stress. I figured I would do my best with delays at first and then upload the code, see what happened, and tweak the timing as needed.

I kept changing the delays and seeing what would happen. All the while, there was also the issue that my button pressing was not actually affecting what was happening with the LEDs. They were turning on and off without me touching the button.

I kept searching for a code error. I asked a fellow and we tried commenting out all of the delays and re-uploading the sketch to Arduino. Still, it wasn’t working. So we summoned the help of another fellow who spotted the error, which was in fact not in my sketch, but in the circuit itself. The button was not being the obedient sensor I wanted it to be because I mistakenly placed the resistor such that it was connected to ground instead of the digital pin.

Note: In hindsight, I give this approach zero stars. With three LEDs, maybe trial and error would not be horribly time-consuming, but with, say, 100000 LEDs, this would definitely not be the way to go.

In talking out the process of how timing the blinking would work with a fellow, I learned that it’s not a good practice to put a ton of delays into code, and that the distress signal I wanted to create would be better achieved with millis and timing. After having spent so much time trying to correct the code error that was actually a circuit error, in the interest of time, I opted to just mess around a little with delays. The result was, quite honestly, something that is reflective of the kind of “in progress” stage in which I left my LED-sos idea. The circuit functioned, communicated nicely with Arduino, and all the lights lit in sequence when I pressed the button, but I went back to edit the sketch so frequently that I am really no longer sure which stage of it my photo represents.

 

Part B: Partner work

Partner: Jessica Chon

Step 1:

My homegirl Jessica made the circuit while I was busy overlooking a simple circuit error for a half hour (Welp. Thanks to fellows David and Nick for your help). Jessica explained the building of the circuit to me once I joined her, and it all looked perfect. The LED fading with the potentiometer was successful!

 

Step 2:

This little fella didn’t work at first but only because the cable connecting the led3 potentiometer to its resistor was accidentally placed incorrectly. With so many components coming into play with this Arduino circuit, in the future we might try to space things out a little more on the breadboard just to make it easier to see, and easier to operate the potentiometers. Aside from that, this step of the exercise really got me excited about all the possibilities in this course.

 

Exercise 2

  1. For inputs, there are all of the automatic doors that open when you get close to them, and I imagine some part of these is using an analog sensor in order to discriminate between a small bird and a comparatively less small human. As for outputs, there are the stop lights, the jingle that plays when you enter quan-jia, and the loud alarm that sounds at a store when the sensors by the door receive an input indicating that some product is being taken out of the store that hasn’t been paid for.
  2. 100000 is an intimidating quantity to have of anything. First I would thank the deity-reincarnate who gifted me this many light-emitting-diodes. Then I would arrange the LEDs such that 20000 were somehow connected to a sensor of my heart rate, another 20000 to a sensor of my dog’s heart rate, and another 20000 to a sensor of each of my parents’ heart rate. The 20000 connected to my heart rate would stay at my parents’ house, while the other 60000 I would find a place for in my dorm room (shhh, don’t tell my roommate– I think there’s probably something in our roommate agreement against it). I would then arrange them such that with the press of some button, the LEDs would light up like a beating heart and show my parents’ /dog’s pulse in real time. Since an unexpected loss of a young family member when I was younger, I have always found being able to know someone else’s heart is beating to be such an understated reassurance that all is well. I would give the remaining 20000 LEDs to a Makerspace with lack of access to resources so that they could hack them into something totally awesome.
  3. With regards to the uncanny eyeball-finger-ear creature and the nature of interaction, I’m made to reflect on how despite the seemingly infinite array of ways that humans can express themselves, the computer can intuitively understand extremely few of these expressions (i.e. inputs), and as such, we need to use physical computing to facilitate interaction between us and the computer and translate our multitudinous ways of expression into language the computer can receive, understand, and act upon in order to reciprocate in the interaction.

Ix Lab Recitation 1: Electronics!

Partner: Jessica Chon
First Circuit
  • Breadboard allows us to connect various components of the circuit and test them without having to solder them together.
  • Jumper cables provide a means of connection between the components of the circuit. Without them, the current would not be able to move through the components of the circuit.
  • 100 nF capacitor’s function is to hold onto electricity while the current is flowing into it, and then release energy when said current is removed. Because they hold onto electricity, capacitors also maintain a power supply even when a device is unplugged. A capacitor was included in our circuit in order to smooth the flow of electricity.
  • A voltage regulator produces a steady output of voltage regardless of a change in input voltage. The voltage regulator was included in this circuit in order to regulate the amount of voltage sent to the speaker component.
  • The speaker served as the load in our circuit, providing a destination for the electrical energy in the circuit. If our circuit did not have a load, the energy would run back into the jumper cables.
  • The 12-volt power supply in our circuit is the source of energy and provided the electrical energy necessary for the circuit to function.
  • The barrel jack connects power to the circuit, and in our case, it was used to connect the 12-volt power supply to the breadboard.
  • The push button switch serves to interrupt (and also complete) the flow of a current through a circuit. The switch was in our circuit so that once being plugged in, the speaker would not continuously emit noise.

Our first circuit functioned when we hit the switch, making noise as we expected. In retrospect, we learned that we made the same mistake with the first circuit as we did with the second circuit, which is that we placed the voltage regulator in a single row of the breadboard instead of having it span across three rows.

Functional, but wrong :/

We didn’t notice our mistake at first because we did not kill the speaker; as a component, it was able to withstand a larger power input than the LED (which died immediately). Additionally, our capacitor was placed incorrectly. After finishing the second and third circuit, we went back to this first circuit and corrected our mistake. We noticed that when we fixed the placement of the voltage regulator, the sound that the speaker emitted was less loud, thus indicating that the speaker was receiving less power than it did in our original attempt.

Functional, and right! 🙂

The interaction with this circuit is relatively simple. Applying sufficient pressure to the switch button closes the circuit so that current can flow and allow the energy to reach the speaker and be converted to sound. Releasing pressure from the switch renders it open, thus the speaker stops receiving energy and ceases to emit noise.

Second Circuit
  • Breadboard allows us to connect various components of the circuit and test them without having to solder them together.
  • Jumper cables provide a means of connection between the components of the circuit. Without them, the current would not be able to move through the components of the circuit.
  • 100 nF capacitor’s function is to hold onto electricity while the current is flowing into it, and then release energy when said current is removed. A capacitor was included in our circuit in order to smooth the flow of electricity.
  • A voltage regulator produces a steady output of voltage regardless of a change in input voltage. The voltage regulator was included in this circuit in order to regulate the amount of voltage sent to the LED.
  • The resistor serves to resist a certain amount of the flow of the current since the 12 Volts of power coming from the power source exceeds the amount of electrical energy that the LED bulb can handle.
  • The LED served as the load in our circuit, providing a destination for the electrical energy in the circuit. If our circuit did not have a load, the energy would run back into the jumper cables and short circuit.
  • The 12-volt power supply in our circuit is the source of energy and provided the electrical energy necessary for the circuit to function.
  • The barrel jack connects power to the circuit, and in our case, it was used to connect the 12-volt power supply to the breadboard.
  • The push-button switch serves to interrupt (and also complete) the flow of a current through a circuit. The switch was in our circuit so that once being plugged in, the light would not remain on.

For this circuit, at first, we put in too large of a resistor. This ended up being of no consequence because as a result of incorrectly placed components, we ran 12V of power directly to the LED light and immediately killed it. Our capacitor was also placed incorrectly. We did not see our own mistakes at first, but Antonius pointed them out to us. Our voltage regulator was placed incorrectly. As current flows through the path of least resistance, our current was bypassing the voltage regulator which is why the LED received the maximum amount of power.

Lesson learned at the expense of one LED casualty. 

We fixed the circuit by correcting the placement of voltage regulator and swapping out the variable resistor for the 220-ohm resistor. After doing this, our circuit worked and since the LED was no longer receiving the full 12V from the power source, it was able to stay lit as long as we held the switch down.

It’s [successfully and with the help of proper regulator placement] lit!

The interaction with this circuit is very similar to the first– pressing the push-button switch closes the circuit, allows the current to flow through, and thus the electrical energy reaches the load (LED) and is converted into light. Releasing the switch button opens the circuit and light stops being emitted from the LED.

Third Circuit

The components of the third circuit and their respective functions are exactly the same as the second, with the exception of the addition of a variable resistor. The variable resistor we used had a maximum resistance of 10k ohms. With the addition of this resistor placed in series with the 220-ohm resistor, the resistance placed on the flow of the current was increased. Additionally, with the ability to change the resistance using the dial on the variable resistor, we were also able to change the intensity of the light being emitted from the LED. We did not run into any problems when building the third circuit.

With the variable resistor turned down, the LED is relatively dimmer

Resistor knob turned, ergo our little LED friend is more lit (and still alive!)

 

 

 

 

 

 

 

 

 

 

The interaction with this circuit also includes pressing a switch to close the circuit. Additionally, the intensity of the light can be adjusted by changing the resistance of the variable resistor by rotating the knob on it.

Question 1

The three circuits do all include interactivity. As discussed in the reading, interactivity can be understood to mean something different for each circuit by considering the term as a continuous variable. As such, the first circuit and second circuit had relatively similar levels of interactivity. They both required the press of a switch in order to complete the circuit and produce some visible manifestation of the flow of current from power to ground (i.e. the speaker emitting a tone or the LED turning on). In line with this approach to the definition of interactivity, the third circuit was the most interactive. Along with including a switch, this circuit could be further interacted with by changing the resistance and thus changing the brightness of the light.

 

Question 2
The push-button switch was a sensor, along with the variable resistor. The speaker and LED were actuators.

 

Question 3
In its most simple application, interaction design can be used to create circuits like we did in the recitation. As seen in Zack Lieberman’s video, these things can also be used to create interactive art that is literally life-changing. Through the use of eye-tracking technology, Lieberman and his team were able to allow a graffiti artist who was paralyzed to tag a building along an L.A. highway and show him a live stream video of that tagging in his hospital room. By tinkering and prototyping and, most importantly, through collaboration, new ways can be devised for interacting with computers that go far beyond keyboard and mouse. The open-sourcing of so much code and software increases access and therefore also increases the number of creative minds that can get their hands on components to tinker and make new, exciting things. If one starts to view everything in their physical surroundings as a possible interface for interacting with a computer, many quotidian interactions can become potential sites for interactive computing.