Toy Box Monitor

Made by Gaurav Asthana

Found in DioT 2019: Augmented Objects

The goal of this project is to monitor when a toy box is opened and to notify when a hand is placed inside to remove a toy.

0

Intention

The inspiration for this project came from my cousin sister's complains about her daughters taking toys out of the toy box and leaving them scattered all over the house. She needed a way to tell if a toy had been removed from the toy box and not placed back so that she knows how many toys are outside the box. That would make it easier for her to track the toys down and return them to the box. 

0

Goal

The goal of this stage one prototype to demonstrate when the toy box is opened and when a hand is placed in the box.  

0

Process

I began this project by understanding the user's problems and creating a schematic to outline the problem statement. Following that, I conducted research to learn about the sensors that I would need to accomplish the goal of this project. Based on my research, I learned that I needed to use a Hall effect sensor to check for the open and closed state of the toy box and an ultrasonic range finder to check for a hand being inserted into the box. I briefly considered using a photo-resistor to check for the box being opened but found that it could give false data for toys that light up and the hall effect sensor would be more accurate. I encountered challenges in the executing the code with the hall effect sensor. I fixed this issue with the help of Prof. Daragh who recommended the use of an 'interrupt' to measure the change of state for the hall effect sensor. 

0

Outcome

I built a circuit to include an ultrasonic sensor, a hall effect sensor, and two LEDs. I built the code in Particle to execute when the box is opened, a green LED lights up and when a hand is placed in the box, a red LED lights up.

0

Next Steps

As the next step, I would like to build in code that counts the number of times a hand was placed in the box. Further, I would use a sensor to measure the force to determine if all the toys that were taken out are placed back inside.

0

Reflection

he most challenging portion for me was configuring the Hall Effect sensor to work. It was challenging due to the different types of hall effect sensors that are available. My particular sensor was a 'latch' type which meant that it would store the value until the magnet was brought close to it again. Understanding this was key to building my code. 

0
int count_High = 0;
int count_Low = 0;
int hallPin = D3;
int ledPin = D8;
int trigPin = D6;
int echoPin = D5;
int led2 = D7;

bool state = true;

void setup() 
{
    Serial.begin( 9600 );
    
    pinMode(ledPin, OUTPUT);
    pinMode(hallPin, INPUT);
    
    pinMode(trigPin, OUTPUT);
    pinMode(echoPin, INPUT);
    pinMode(led2, OUTPUT);
    
    Particle.variable("hall sensor", state);
 
}


void loop() 
{
    delay (10);

    if ( digitalRead(hallPin)  == HIGH  )
    {
        state = true;
        Particle.publish("Box", "OPEN");
        
    }
    else
    {
        state = false;
        Particle.publish("Box", "CLOSED");
    }
    
    digitalWrite (ledPin, state);
    
    long duration, distance;
    
    digitalWrite(trigPin, HIGH); 
    
    delayMicroseconds(10); 
    
    digitalWrite(trigPin, LOW);
    
    duration = pulseIn(echoPin, HIGH);
    
    delayMicroseconds(10); 
    
    digitalWrite(trigPin, LOW);
    
    distance = (duration/2) / 29.1;
    
    if (distance < 10) 
    {  
        digitalWrite(led2,HIGH);
        Particle.publish("Hand", "YES");
    }
    else 
    {
        digitalWrite(led2,LOW);
        Particle.publish("Hand", "NO");
    }

    if (distance >= 200 || distance <= 0)
    {
        Serial.println("Out of range");
    }
    else 
    {
        Serial.print(distance);
        Serial.println(" cm");
    }
    delay( 500 );

}
Click to Expand
0
Lights Camera ACTION
Gaurav Asthana - https://youtu.be/keWMEWZ2EP0
x
Share this Project

Courses

49713 Designing for the Internet of Things

· 18 members

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


About

The goal of this project is to monitor when a toy box is opened and to notify when a hand is placed inside to remove a toy.

Created

January 31st, 2019