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?)


Jumper cables







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 ( ) and also ( 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


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);


Leave a Reply