The Milk Box

Made by mshie, Eileen Wang and Shreyas Sridar

Found in DIoT - Augmented Objects

The milk box

0

Viha, our stakeholder

Viha is a current graduate student at Carnegie Mellon, studying information security. She lives with 2 roommates in a Squirrel Hill apartment. One of the benefits of having roommates is that even if she forgets to buy milk, her roommates would help replenish. However, she doesn't want to always rely on her roommates. 

0

Viha never wants to be out of milk

Unfortunately, even when Viha does go grocery shopping, she often realizes that she forgot to buy milk only after coming back from the grocery store.

When visiting her home, we discovered that one of her favorite objects is her collection of fridge magnets. Her fridge magnets hold up important information and papers with sentimental value for her. We thought communicating how much milk is left could be a useful capability for a fridge magnet, as it lives in a very visible place at home. We also chose to create a fridge magnet because we want to add to her collection, instead of introducing an item that may feel unfamiliar to her.

Our goal: Functionally, we want to create a device that can proactively remind Viha when her milk is running low, so she will remember to buy milk. Visually, the device should look like it is part of her home environment, and not like a foreign object. 

0

Initial Concept

A magical magnet that can tell Viha how much milk left.

We want to use the LED signal to present a different status of the milk volume. The fridge magnet will flash different colors depending on the amount of milk left.

0

Storyboard

0

Schematic Diagram

Setting for 100% milk volume - 1 gallon, 1/2 gallon, or 1 quart 

Sensor for showing current milk volume - green, yellow, red

Request for current milk volume- Milk level is XX%

Message - receive a notification when the milk volume < 25%

0

Approach

Design approach

Magnet size: We decided that the device needed to be big enough for Viha to see the neopixel color feedback clearly, but small enough to still feel like a magnet. 

Size of neopixel: It should be big enough so that Viha can see the colors clearly close up as well as when she is 80'' away (glancing at the fridge on her way out the door). 

Visual design of the milk carton: From observing the items Viha has in her room, she likes objects that are cute and animated-looking. This inspired us to take on a cartoon-y aesthetic for the visual design of the milk carton. 

Engineering approach

To enable the fridge magnet to detect the milk, we used a bar type load sensor. The load sensor with a maximum rated capacity of 5 kgs was chosen as a typical one gallon milk carton weighs at around 4.3 kgs. To detect the level of milk in the fridge, the sensor reads the instantaneous value every second and publishes that to the cloud. The fridge magnet subscribes to the event and sends signal to the neopixel to display different colors as mentioned in the schematic diagram as shown above. A 1200 mAh LiPo battery is connected to the neopixel circuit. 

0

Component

  1. Argon
  2. Neopixel
  3. Bar type of load sensor
  4. Load Cell Amplifier HX711
  5. Magnet
  6. Li-Po Battery
0

Source Code for Load Sensor

0
// This #include statement was automatically added by the Particle IDE.
#include <HX711ADC.h>


HX711ADC scale(A1, A0);		// parameter "gain" is ommited; the default value 128 is used by the library
float milk_level=0.0f;
void setup() {
 
    Serial.begin(38400);
    Serial.println("HX711 Demo");
    scale.begin();
 
    
    Serial.println("Before setting up the scale:");
      Serial.print("read: \t\t");
      Serial.println(scale.read());			// print a raw reading from the ADC
    
      Serial.print("read average: \t\t");
      Serial.println(scale.read_average(20));  	// print the average of 20 readings from the ADC
    
      Serial.print("get value: \t\t");
      Serial.println(scale.get_value(5));		// print the average of 5 readings from the ADC minus the tare weight (not set yet)
    
      Serial.print("get units: \t\t");
      Serial.println(scale.get_units(5), 1);	// print the average of 5 readings from the ADC minus tare weight (not set) divided 
    						// by the SCALE parameter (not set yet)  
    
      scale.set_scale(456.f);                      // this value is obtained by calibrating the scale with known weights; see the README for details
      scale.tare(10);				        // reset the scale to 0
    
      Serial.println("After setting up the scale:");
    
      Serial.print("read: \t\t");
      Serial.println(scale.read());                 // print a raw reading from the ADC
    
      Serial.print("read average: \t\t");
      Serial.println(scale.read_average(20));       // print the average of 20 readings from the ADC
    
      Serial.print("get value: \t\t");
      Serial.println(scale.get_value(5));		// print the average of 5 readings from the ADC minus the tare weight, set with tare()
    
      Serial.print("get units: \t\t");
      Serial.println(scale.get_units(5), 1);        // print the average of 5 readings from the ADC minus tare weight, divided 
    						// by the SCALE parameter set with set_scale
    
      Serial.println("Readings:");
}

void loop() {
  milk_level=scale.get_units();
  Serial.print("one reading:\t");
  Serial.print(milk_level, 1);
  Serial.print("\n");
//   Serial.println(scale.get_units(10), 1);
   
    
    Particle.publish("DIOT/CP2/Milkbox/Weight",String(milk_level));

  scale.power_down();			        // put the ADC in sleep mode
  delay(1500);
  scale.power_up();
}
Click to Expand
0

Source Code for the Fridge Magnet

0
// This #include statement was automatically added by the Particle IDE.
#include <neopixel.h>


#define PIXEL_PIN D2
#define PIXEL_COUNT 8
#define PIXEL_TYPE WS2812
Adafruit_NeoPixel stick = Adafruit_NeoPixel( PIXEL_COUNT, PIXEL_PIN, PIXEL_TYPE );
uint32_t color = stick.Color( 255, 255, 255 );//white
uint32_t colorOff = stick.Color( 0, 0, 0 );//LED off
uint32_t red = stick.Color( 255, 0,0);
uint32_t green = stick.Color( 0, 255, 0 );
uint32_t yellow = stick.Color( 255, 255, 0 );
float quart=856.0f;
float milk_size=856.0f;
double milk_level=0.0f;
int toggle=0;
void setup() {
 
    stick.begin();
    stick.show();
    Particle.subscribe("DIOT/CP2/Milkbox/Weight",getmilk);
    Particle.function("Milkcartonsize:",milksize);
    Particle.function("Get_Milk_Level",getmilklevel);
    for(int j=0;j<3;j++)//for 3 times, lights on and off one by one for each LED in sequence
    {
        for(int i=0;i<stick.numPixels();i++)
        {
            stick.setPixelColor(i,color);
            stick.show();
            delay(50);
            stick.setPixelColor(i,colorOff);
            stick.show();
        }
    }
}

void loop() {
 
  if(milk_level>0.75*milk_size)
  {
        // double factor=scale.get_units()/milk_level*stick.numPixels();
        // int pixel=ceil(factor);
        for(int i=0; i< stick.numPixels();i++)
        {
            stick.setPixelColor(i,green);
            stick.show();
        }
        toggle=1;
        // for(int i=pixel;i<stick.numPixels();i++)
        // {
        //     stick.setPixelColor(i,colorOff);
        //     stick.show();
        // }
  }
  else if(milk_level>=0.25*milk_size && milk_level<=0.75*milk_size)
  {
        // double factor=scale.get_units()/milk_level*stick.numPixels();
        // int pixel=ceil(factor);
        for(int i=0; i< stick.numPixels();i++)
        {
            stick.setPixelColor(i,yellow);
            stick.show();
        }
        toggle=1;
        // for(int i=pixel;i<stick.numPixels();i++)
        // {
        //     stick.setPixelColor(i,colorOff);
        //     stick.show();
        // }
  }
  else if(milk_level>30 && milk_level<0.25*milk_size)
  {
        // double factor=scale.get_units()/milk_level*stick.numPixels();
        // int pixel=ceil(factor);
        for(int i=0; i<stick.numPixels();i++)
        {
            stick.setPixelColor(i,red);
            stick.show();
        }
        if(toggle==1)
        {
            Particle.publish("milk_is_low");
            toggle=0;
        }
        // for(int i=pixel;i<stick.numPixels();i++)
        // {
        //     stick.setPixelColor(i,colorOff);
        //     stick.show();
        // }
  }
  else
  {
    for(int i=0;i<stick.numPixels();i++)
        {
            stick.setPixelColor(i,colorOff);
            stick.show();
        }
        toggle=1;
  }
}

int milksize(String command)
{
    if(command.toInt()==100)
    milk_size=quart*4;
    else if(command.toInt()==50)
    milk_size=quart*2;
    else if(command.toInt()==25)
    milk_size=quart;
    
    return 1;
}
void getmilk(const char *event, const char *data)
{
    milk_level=atof(data);
}
int getmilklevel(String command)
{
    int level=(milk_level/milk_size)*100;
    Particle.publish("Milk_level",String(level));
    return 1;
}
Click to Expand
0
When our neopixel lit up as expected for the first time
Shreyas2
0
We got the neopixel working but the color was incorrect.
Milkbox
0

Visiting Viha to gather feedback & Iterating Milk box

We learned that Viha frequently buys 1 gallon of milk, but sometimes there are times when she has to settle for smaller volumes if the gallon milk runs out at the grocery store. This made us realize that we need to calibrate the scale to address low, medium, and high volume for each of the carton size she could buy. The 2nd feedback was she always places her milk on the bottom shelf. The wiring between the fridge magnet and load sensor stretched across the fridge shelves, making it inconvenient for her to reach items. In our next iteration, we will try to make the load sensor wireless. Lastly, Viha doubted whether the load sensor is sturdy enough to sustain the weight of a gallon’s milk. From a function perspective, the load sensor works well with a gallon, but we might make it look wider visually to help Viha feel at ease.

0
The Milk Box
Eileen Wang - https://youtu.be/P4NS6Be9mSY
x
Share this Project

Courses

49713 Designing for the Internet of Things

· 16 members

A hands-on introductory course exploring the Internet of Things and connected product experiences.


Focused on
About

The milk box

Created

November 21st, 2019