Mom I Am Fine... IoT Texting Chair

by Anil Bhaskar in Circuits > Electronics

4118 Views, 44 Favorites, 0 Comments

Mom I Am Fine... IoT Texting Chair

output_JuFypp.gif
584082a265d221229a000d46.jpeg
5840814a8ae43b94da000df8.jpeg

Since the last couple of months, I was thinking about the best Christmas gift I can give to my parents. I live around 7000 miles away from my family and my mother texts me around 10-15 times a day. Most of those texts contain only one message, Was thinking about you, hope you are doing fine. While working sometimes I don't get a chance to check my phone and reply her back.

If I don't reply after 10-15 minute she will send another text and by any chance, if I still don't get a chance to reply she will start worrying.

I thought this Christmas I should make something which will keep her notifying that I am doing fine, without sending so many texts all the time.

So this is what this project will do

We will tie an accelerometer with my chair and this accelerometer will be used to detect any chair movement. If it detects a movement, it will send a command to the other wifi relay board and the relay board will turn on the relay and the relay will turn on the LED panel. The ON light panel indicates that I am in my chair and I am doing fine :). The light panel will be OFF if it doesn't detect any movement.

Hardware You Will Need to Make IoT Chair

1.JPG
584081779bad4bf83e0002fe.jpeg
2.JPG

Hardware Setup for IoT Chair

So in this project, we will be using following hardware.

1. An Accelerometer Sensor

2. Particle Photon

3. Particle Photon Shield

4. Relay Shield For Particle Photon

5. Led Light Panel

6. A good chair

We will connect the accelerometer from Atmel with the chair and the accelerometer will be connected to the particle photon. this is quite easy to setup all you need to do is connect the particle photon and sensor using an i2c connecting the cable. the sensor and the particle photon will get the power through a USB cable.

on the other end, we will connect the relay board with the light panel.

Setup and Working

4.JPG
5.JPG

Part one - on the Transmitter side we have an Accelerometer and Particle photon. So whenever the chair moves it will detect the movement and will send a command to the receiver particle photon.

The accelerometer is real sensitive , to remove false detection we will compare the old and new movement and if the difference between new and old movement is more than 20% then it will register it as a movement and send a signal to the other particle photon.

On the other side, we have a LED panel connected to the relay and the relay is controlled by the particle photon. We are using Controleverything.com relay controller.

So whenever the relay controller particle photon receives a command it will turn on the led panel for new few minutes. You can change the relay on the timer in the code.

You can find the IoT Chair Code over here.

You can find the particle photon wifi Relay Lib over here.

// This #include statement was automatically added by the Particle IDE.

#include "Accelerometer.h"

Accel accelerometer;

int previousX;

int previousY;

int previousZ;

unsigned long lastPublish;

unsigned long publishTimeout = 10000;
int maxRange = 500;

int minRange = -500;
void setup()

 {  

  if(accelerometer.setAddress(0))

{    

    Serial.println("Sensor Ready");  

      if(accelerometer.update())

{       

     previousX = accelerometer.xAccel;   

         previousY = accelerometer.yAccel; 

           previousZ = accelerometer.zAccel; 

       } 

   }

else

{    

    Serial.println("Sensor Offline");   

 }

}
void loop()

 {  

  if(accelerometer.update())

{    

    // Serial.printf("X: %i \n", accelerometer.xAccel); 

       // Serial.printf("Y: %i \n", accelerometer.yAccel); 

       // Serial.printf("Z: %i \n", accelerometer.zAccel);   

             int difX = previousX - accelerometer.xAccel;  

      int difY = previousY - accelerometer.yAccel;  

      int difZ = previousZ - accelerometer.zAccel;  

              if(difX > maxRange || difX < minRange || difY > maxRange || difY < minRange ||difZ > maxRange || difZ < minRange)

{      

      Serial.println("Movement detected");    

        if(millis() > lastPublish+publishTimeout)

{            

    Particle.publish("Movement", "Moved");  

              lastPublish = millis();  

          }    

                     

       }       

 previousX = accelerometer.xAccel;   

     previousY = accelerometer.yAccel; 

       previousZ = accelerometer.zAccel; 

           }

else

{  

      Serial.println("Sensor Did not respond"); 

   } 

   delay(300);

}

Finalizing the Best Gift

6.JPG

the accelerometer is really sensitive so to avoid the false trigger we will compare the motion, so it will compare the acceleration between last detection and the new detection. If the change is more than 20%, then it will be considered as a true event. You can also change it according to your hardware and other factors.

You will need to take care of few things like where you mount the accelerometer at a place where it can detect the chair movements also make sure it is mounted properly and cables are neatly tied.

This is a fun project, you can do lot more with this project like trigger an alarm if something moves or trigger an alarm if something does not move over an extended time period.

You can also make this best Christmas gift.