Basket Capacity

Made by Benjamin Fisher

Found in DIoT 2018 1- Home Hack

  • Video Demonstration (Click upper right corner to watch in full screen to avoid clipping)
    Benjamin Fisher
    Video Demonstration (Click upper right corner to watch in full screen to avoid clipping)

A laundry bin that makes noise and lights up when full! No more forgetting to bring it to the laundry room. Can even monitor remotely!

Problem Statement:
This project is designed for my mother, who usually does the laundry, and for my father (and myself, when I am home), because we often put clothing in the bin and occasionally must be reminded to bring the bin to the laundry room when full.  This will be useful for helping my mother plan a daily schedule knowing that a load or two of laundry will have to be done as well.  She will not have to be present to make sure that the basket doesn't become overloaded, since the buzzer will alert my father as soon as the bin is sufficiently full, and an event will be published to the cloud informing her that the switch has been activated. The sensor will be checked over time to prevent individual clothes from activating the event.


I am trying to create a simple sensing device that reminds someone who is used to throwing laundry in the bin and walking away that it is time to take the bin to the laundry room.  For added convenience, in case the buzzer eventually dies, an event is published to the cloud so that a user can stay informed as to the level of laundry in the bin.  The goal is to provide simple audio/visual feedback for non-tech-savvy users to prevent a recurring headache.

I started by making an LED blink when a proximity sensor was triggered.  The general wiring and setup came from, modified for my needs.  Next, I added a delay to check if clothes were falling or if the bin was full enough that the sensor was constantly reading low values.  This is similar to "Hot Shot Hoops" by "Team IOT Basketball" (Carlos Roca and Michael Gurdak, originally published at, although they used a PIR sensor.

Then, I added a buzzer (see and published an event when the sensor registered as having been below a threshold for a given time, inspired by code provided by Daragh Byrne in the intro workshop for his Carnegie Mellon class Designing for the Internet of Things.  Finally, I added a reset button for the user to press to silence the alarm, as the alarm was only intended to serve as a quick reminder.  For a progression of the circuity, see the pictures at the bottom of this page; earlier milestones of code are below in the documentation on this page.

The final code, diagram, and bill of parts are below in this "Documentation" section.  For the video of the completed project, see the featured video.  Eventually, I would fine-tune the analog inputs to thresholds that work with various types of clothing as they pile up in the bin but may not necessarily be within a fraction of an inch from the sensor.  A longer-range sensor would be necessary, or even multiple sensors to ensure accuracy.  I would also need to make the hardware for mounting the components on a plastic bin or an adhesive for soft mesh laundry bags, with the entire thing working wirelessly.


I learned that despite the intimidating challenge of "hacking one's home" using the Internet of Things, it is not very difficult to do. A big challenge is in thinking of applications that are useful, usable, and desirable. In retrospect, I would have liked to get a bigger proximity sensor and mount it elsewhere (similar to the button), as well as choosing much smaller wires, since they can obscure the sensor. The large wiring simply gets in the way of the sensor. I thought about using light instead of proximity but because some clothing has reflective elements, I'd need it pointed at a light source on the opposite side of the bin to measure when that value was broken, which is battery-intensive. Since my parents are not exceptionally tech-savvy, it would probably be more familiar to them to have a text sent to their phone or an email to their computer instead of monitoring events in the cloud.

Bill of Parts



Particle Photon


Proximity Sensor QRD1114


LED, standard


220Ω Resistor


10K Resistor




Push Button


Wiring diagram below
Inspired by "Hot Shot Hoops" by Team IOT Basketball (Carlos Roca and Michael Gurdak). Original code available at
 * Project homehack
 * Description: Laundry basket that determines when it is full and publishes event
 * Author: Ben Fisher
 * Date: 1/29/18

 int ledPin = D0;                // Establish pin for the LED
 int proxPin = A0;               // Establish input pin for proximity sensor
 int buzzPin = D2;               // Establish input pin for piezo buzzer
 int buttonPin= D3;              // Establish input pin for reset button
 int val = 0;                    // Variable for reading the pin status
 int this_sensor=0;              // Used for delay between sensor occurrences
 int proxTriggerFlag=0;
 int binIsFullTimeDelay=3000;    // how many milliseconds the sensor stays active before reporting that the bag is full
                                 // this must be longer than the wait to update the sensor info
 bool isLoading = false;
 // Track if it's on or off
 bool appState = true;
 int alarmLength = 3000;         // max length of alarm if button is not pressed in time

// setup() runs once, when the device is first turned on.
void setup() {
  // Put initialization like pinMode and begin functions here.
  pinMode(ledPin, OUTPUT);      // declare LED as output
  pinMode(buzzPin, OUTPUT);     // declare sensor as input
  pinMode(proxPin, INPUT);     // declare sensor as input
  pinMode( buttonPin, INPUT_PULLUP); // sets pin as input

void checkIfButtonIsOff() {
  int alarmStart = millis();
checkAgain: // can we do this without goto or recursion?
  int buttonState = digitalRead( buttonPin );

  appState = buttonState;
  if( !appState ){
    digitalWrite(buzzPin, LOW); // button is correct; turn alarm off
    if (millis()-alarmStart>=alarmLength){
      digitalWrite(buzzPin, LOW);
      delay(500); //check again in 1/2 second
      goto checkAgain;

// loop() runs over and over again, as quickly as it can execute.
void loop() {
  // The core of your code will likely live here.
  val = analogRead(proxPin);  // read input value

  // blink new LED for 100 ms to indicate that sensor data was published
  if (val <= 2000) {            // check if the input is HIGH
    digitalWrite(ledPin, HIGH);  // turn LED ON
    delay(100); //led test only, remove later
    digitalWrite(ledPin, LOW);  // turn LED ON
    delay(100); //led test only, remove later

    // implement a wait to ensure that any falling clothes don't trigger "full"
    // just because they pass the sensor

    // Is this the first time that this_sensor was triggered?
    if (this_sensor==0){
      this_sensor = millis(); //now we know when it is first active.

    if (abs(millis()-this_sensor)>=binIsFullTimeDelay && proxTriggerFlag==1){
      //then the trigger has been active for the binIsFullTimeDelay
      // sound the alarm!
      digitalWrite(buzzPin, HIGH);
      delay(500); // useful in case button is faulty
      // The alarm is going off; it's up to the user to push the reset button
      // or wait for alarmLength to expire

      // Whether the button is pushed or the timer expires, publish an event
      Particle.publish("Laundry is Full!", PRIVATE); //Publish event (console)
      this_sensor=0;  // Used to reset timer for next proximity sensor trigger
    digitalWrite(ledPin, LOW); // keep LED OFF
    proxTriggerFlag=1; // record flag that proximity sensor was triggered
    proxTriggerFlag=0; // prevents two completely separate occurrences from
                       // triggering the "laundry is full" loop
                       // (only continuous triggering will keep the flag = 1)
  // wait 1s before retrieving data again (per assignment)
Benjamin Fisher Click to Expand
LED and Proximity Sensor Circuitry
Img 0492 Benjamin Fisher
Adding a buzzer
Close up of components
Reset button included, to be mounted on bin
Img 0496
Complete circuit
Completed board
Share this Project


49713 Designing for the Internet of Things

· 25 members

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


A laundry bin that makes noise and lights up when full! No more forgetting to bring it to the laundry room. Can even monitor remotely!


January 25th, 2018