Are my kids home yet?

Made by Rebecca Radparvar

Found in Home Hack

The 'Are my kids home yet?' system will use two pressure sensors (one per child/bed) to assess if I child is at home and sleeping. The system will report out if each child is home by lighting up their LED to confirm they are at home in bed.

0

Project

Whenever my sister and I are staying at home in New York with our parents, our mother doesn't like waking up in the middle of the night and not knowing if we've returned after being out late. The 'Are my kids home yet?' system was developed to solve that problem by providing an easy indication if we've returned and are at home in bed.

This problem was chosen because I know my mom worries when she wakes up in the middle of the night and can't tell if we've returned or not.

0

Goal

The 'Are my kids home yet?' system will use two pressure sensors (one per child/bed) to assess if I child is at home and sleeping. The system will report out if each child is home by lighting up their LED to confirm they are at home in bed. This enables the primary user to see which child is home with a kick glance at the LEDs. An on and off switch will also be included so the system can be turned off during the day, when neither child is home, or for when items are piled on the bed.

0

Process

Show a record of your work as it progressed. This should include: components used, photos and videos of the circuits assembled, code (and versions of your code), reflections and challenges encountered, how you solved problems, iterated etc. Be able to tell the story of your work.  

Overall, I worked fairly iteratively to build my circuit. I first began with creating a simple circuit with one pressure sensor. I used to the embedded LED in the particle to read if the pressure on the sensor was above a certain threshold and used a cloud variable to output the overall pressure in order to give a better indication of what the threshold should be.

One the first pressure sensor was working, another was added and LEDs were added to the system. At this point, I hit two major roadblocks: 'if'/'while' statments and LED usage.

When I originally implemented 'if' statements, the LEDs would turn on as soon as pressure was applied but would not turn off once it was used. I tried to remedy this problem by using while statements. Unfortunately, the while statements kept crashing my particle and had to be removed. Daragh helped me work around this problem by adding a function that would constantly update the LEDs  - allowing me to return to nested 'if' statements to carry out the desired functionality. 

The other major roadblock was my usage of LEDs. Originally, I wanted to use four LEDs to indicate the four combinations of scenarios (both kids home, neither kids home, sara home, raha home) but this became difficult in coding and was to determined to be a redundant feature - just adding complexity and confusion. For that reason, it was eliminated.

Once all of this was cleared up, a button was finally added to enable the system to be turned on and off and it was all systems go! 

0

Outcome

In order to complete the prototype, the pressure sensors would have to be soldered to longer wires to allow them to be placed under each bed without causing any damage to the circuitry. The threshold of the sensors and their location would also have to be experimented with in order to ensure the proper information was being sensed and outputted.

Additionally, it would be desirable to have three separate particle systems that conversed with each other over the cloud so the entire system would not have to be hardwired together.


0

Parts Required

The 'Are my kids home yet?' system will required a number of components to properly function. Beyond the standard breadboard and Particle board, the following parts will be required:

  • 2 LEDs (Different colors)
  • 2 Pressure Sensors (FSR Square Sensors)
  • 1 On/Off Switch
0

Code

0
Are My Kids Home Yet? Code
int sara = A0;
int raha = A1;
int saraLED = D0;
int rahaLED = D1;
int button = D4;

int saraState = 0;
int rahaState = 0;

int threshold = 3000;

void setup()
{
  pinMode(saraLED, OUTPUT);
  pinMode(sara, INPUT);
  pinMode(rahaLED, OUTPUT);
  pinMode(raha, INPUT);
  pinMode (button, INPUT_PULLUP);

  Particle.variable( "sara", &saraState, INT );
  Particle.variable( "raha", &rahaState, INT );
  Serial.begin (9600);
}

void loop()
{
  saraState = analogRead(sara);
  rahaState = analogRead(raha);
  int buttonState = digitalRead (button);

if (buttonState == LOW) {
  systemOn ();
}

else {
  systemOff ();
}
}

void LEDupdates (bool state1, bool state2){
  digitalWrite (saraLED, state1);
  digitalWrite (rahaLED, state2);
}

void systemOn () {
  if (saraState > threshold) {
    if (rahaState > threshold) {
      LEDupdates (true, true);
    }
    else {
      LEDupdates (true, false);
    }
  }

  else if (saraState < threshold) {
    if (rahaState > threshold){
      LEDupdates (false, true);
    }
    else {
      LEDupdates (false, false);
    }
  }

}

void systemOff (){
  LEDupdates (false, false);
}
Rebecca Radparvar Click to Expand
0

Video

0
Creative Project 1
Rebecca Raha Radparvar - https://youtu.be/gtoWkvXwOKU
0

Circuit Diagram & Schematic

0

Reflection

Through this project I learned how to implement a lot of my Embedded Control and Electronic Instrumentation education and knowledge to the the Particle platform.  

If I were to do this project again, I would definitely be better about documenting each stage. I documented when the circuit was finally assembled and working but unfortunately was not as cognizant of recording each software and hardware step.

For the most part, I'm completely satisfied with the outcome of this project. While I had some difficulties coding, I was able to look at the code I worked with Daragh on and completely understand it. I think I'd have difficulty getting there on my own again but I would be able to parse it together based on other internet resources. 

Overall - I had a lot of fun and can't wait for the next one! 

x
Share this Project

Found In
Courses

49-713 Designing for the Internet of Things

· 26 members

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


Focused on
About

The 'Are my kids home yet?' system will use two pressure sensors (one per child/bed) to assess if I child is at home and sleeping. The system will report out if each child is home by lighting up their LED to confirm they are at home in bed.

Created

January 25th, 2017