Project 2 – Intro to Physical Computing: Student Work Spring 2022 https://courses.ideate.cmu.edu/60-223/s2022/work Intro to Physical Computing: Student Work Tue, 15 Mar 2022 23:23:07 +0000 en-US hourly 1 https://wordpress.org/?v=5.8.9 Project 2 A Water Hourglass https://courses.ideate.cmu.edu/60-223/s2022/work/project-2-a-water-hourglass/ Sat, 12 Mar 2022 00:18:46 +0000 https://courses.ideate.cmu.edu/60-223/s2022/work/?p=15244 Design Concept

This is a water hourglass that helps users to achieve daily water drinking goal, using water as a dripping timer and also the consuming product itself.

Overall photo

Front view of the device

 

Side view of the overall structure

Detail Images

bottom arrangement of the Arduino, breadboard, led light, water level encoder and ir sensor

detail view of the middle gear system

The placement of the ir sensor beneath the 3d print water container

Functioning Video

The 4 videos represents four stages during the use: initiation, streaming water, trigger speaker and bottle restoration and final goal archival.

 

Processing Images

  • First decision point: the cancellation of the rotating bottle

In the initial brainstorm idea, I wanted to make the entire 2L water container rotatable

Then I realized the water itself can be for consuming and also a timer, so there is not need to rotate, which is a significant change to the design

  •  The second decision point: buying the adjustable water control to replace the idea of making mechanics that changes the diameter of the water channel. This is very important for me in regards of the latter gear system design and fabrication

the water controller, stepper motor and the gear system that connects them together

  • Process Highlight
  • The design of the 250ml volume box in rhino

    The testing of multiple iteration of the gear system for the stepper motor and the water controller, due to the difficulty that the water controller did not provide size information, many details has to eyeball and measure

    The sideview of how the gears successfully interacts with each other

     

Retrospection(discussion)

  • Response

I received many encouraging and useful feedback, many of them regarding the container, the lid and the workflow. The comment “I think it may be troublesome that the water detector(?) needs to be fully dry to stop the sound” is great because it is a issue that slightly interferes with the workflow of drinking, the intention was to have the detector laid aside and it would stops beeping naturally, but sometimes it prolonged due to the residual water lingering on the surface. Maybe putting cotton or desiccant inside the placeholder would be a good idea. “I would suggest that the box is a little further away motor area so that you don’t have try to go underneath. ” is definitely a good point. the Arduino and breadboard exposing beneath the water container is quite dangerous, something I would definitely change in the future.

  • Self Critique

I am quite happy with the result because it worked smoothly in terms of design as what I intended, there are some details in product-human interaction that I would like to improve to makes the design more appealing to new users. It was difficult in solving the mechanism, but on the other hand I paid less attention to interactive design ( such as removing the cap) and the aesthetics(the beaker holder makes the product look like a chemistry lab instead of a drinking reminder) I would pay more attention on these aspects after the mechanism is settled for the next project.

  • What I Learned

I have experienced some frustrations in debugging the physical circuits of the stepper motor because it was not rotating in two directions. I’ve checked all the wires, codes but failed to anticipate that the stepper motor driver might be broken, and it was the reason for all the frustrations. This is an extremely important lesson to me that the hardware could be partially down. In addition, I found self-designed mechanisms and systems a very interesting topic to explore further, and my choice of starting fabrication test early was one of the best decisions I made that didn’t push me in the last minute. I hope I can continue to play with self-fabricated system that integrate with electronics in the next project.

  • Next Steps

I would definitely apply a lot of changes and improvements in the second round of design(if there is such chance). The following points would be addressed:

  1. design a new shell to replace the beaker holder that contains  the dripping control system, the larger water storage and drinking bottle.
  2. adjust the hierarchy of the electronics and water storage, separate them to protect the electronics from the potential of getting wet.
  3. an individual slot for the water level encoder so that it doesn’t get in touch with the drinking water directly, but maybe measure from a technique of water level pressure equivalence.
  4. use a LCD screen to replace the LED light to address the amount of water drunk and other information.
  5. make a new cap and make the 3d printed bottle more friendly for people to drink

Technical

  • Block diagram
  • Schematic diagram

 

  • Code
// THE WATER HOURGLASS
//By Jiaying Wei jwei3
//Description: This code first defines the speed of the motor that controls the water dripping rate, sets the
//boolean status of the water bottle position and dripping position.
//and do the following:
////1.Measure the input of water level encoder and the ir reflective sensor
////2.If the bottle is removed, toggle bottle position and make sure the dripping rate is 0, if the bottle 
//////was restored to its position, toggle again
////3.Turn the dripping rate up if there is not enough water in the bottle, and turn it down and also release
//////beeping sound if the bottle is filled.
////4.Track the number of times that the bottle is removed to determine if daily drinking goal is reached and 
//////the led light would light up
//Pin Mapping instruction: 
////waterPin is the waterlevel encoder input pin, beeperPin refers to beeper, lightPin
////refers to ledlight, Photoresistorpin refers to ir reflective sensor, and step_Pin , DIR_PIN refers to the 
////the stepper motor connection
//Credits:
////1. https://lastminuteengineers.com/water-level-sensor-arduino-tutorial/, which I refered to the basic usage of
////water encoder
////2. course tutorial https://courses.ideate.cmu.edu/60-223/s2022/tutorials/IR-proximity-sensor
////3. course tutorial https://courses.ideate.cmu.edu/60-223/s2022/tutorials/stepper


#include <NewPing.h>
#include <Stepper.h>
#define STEPS 200

const int waterPin = A0;
const int beeperPin = 5;
const int lightPin = 9;
//const int distancePin = A1;
const int PHOTORESISTORPIN = A1;
const int STEP_PIN = 2; 
const int DIR_PIN = 3;
Stepper stepper(STEPS,DIR_PIN,STEP_PIN);


int currentDist;
unsigned long timecount = 0;

int waterVal = 0;
unsigned long check = 0;
bool pos = true;
bool drip = false;
int count = 0;


void setup() {
  pinMode(PHOTORESISTORPIN, INPUT);
  stepper.setSpeed(30);
  Serial.begin(9600);

}

void loop() {
  waterVal = analogRead(waterPin); 
  currentDist = analogRead(PHOTORESISTORPIN);
  Serial.print("currentDist:");
  Serial.println(currentDist);
  delay(500);

  Serial.print("waterlevel:");
  Serial.println(waterVal);
  
  // check every 10 secs
    // when the bottle was removed, beeping stops, driping stops, count+=1
  if ((millis()- timecount) > 10000){
    timecount = millis();
    //measure whether the bottle is in place
    if (currentDist < 100 and pos == true) {
      digitalWrite(beeperPin,0);
      // to avoid dripping if box is away
      if (drip == true){
        drip = false;
        stepper.step(680);
        Serial.print("rotate to off");
      }
      pos = false; // turn position off
      count+=1;
      Serial.print("count:");
      Serial.println(count);
      Serial.print("pos:");
      Serial.println(pos);
    }
    // when the bottle was restored, pos restored to true
    if (currentDist >= 100 and pos == false){
      pos = true; // turn position on
      Serial.print("pos:");
      Serial.println(pos);
    }
    // checking water level and move the stepper motor to change dripping rate accordingly
    if (waterVal >= 200) {
      analogWrite(beeperPin, waterVal/2);
      if (drip == true){
        //turn stepper motor off
        drip = false;
        stepper.step(680); // this is a mock line for motor turning, motor rotates backwards
        Serial.print("rotate to off");
      }
      //stops water from dripping
      // runs util executing all the steps
    }
    if (waterVal < 150) {
      digitalWrite(beeperPin,LOW);
      // if the motor is not dripping and the waterlevel encoder is placed inside the bottle and the bottle is in placed
      if (pos == true){
        if (drip == false) {
          //turn stepper motor on
          Serial.print("pos:");
          Serial.println(pos);
          drip = true;
          Serial.print("drip:");
          Serial.println(drip);
          Serial.print("rotate to on");
          stepper.step(-680);// this is a mock line for motor turning, motor rotates forward
        }
      }
      //runs util executing all the steps
    }


  }

  // when the count reaches 8, led light turns on
  if (count >= 8) {
    analogWrite(lightPin, 255);
    }
  
  // at the end of the day, everything restores back to original settings
  if (millis()>86400000){
  count = 0;
  }

}

 

]]>