Project tutorial
Ergonomic Chair Using Arduino

Ergonomic Chair Using Arduino

Transforming an ordinary chair to a chair that warns you when you are having unhealthy sitting.

  • 1,574 views
  • 0 comments
  • 3 respects

Components and supplies

Apps and online services

About this project

Most of us spend hours infront of laptops sitting on ordinary chairs and we don't care how we are sitting. Are we sitting in a good way? I think the answer is no, because after all theses hours of working while we are sitting, we feel the pain, backache, neck-ache and etc. What if we transformed our ordinary chair to a chair that gives us alerts when we are sitting in a wrong way? Let's jump to the steps to see how we will do this.

Step 1: Components needed

Step 2: Connecting all things together

White LED is for detecting that the upper piezoelectric sensor (which will be mounted on chair's seat) is sending data to Arduino - Yellow LED is for detecting that the lower piezoelectric sensor (which will be mounted on chair's back) is sending data to Arduino - the upper piezoelectric sensor detects that you sat on the chair. While the lower one detects that you are leaning your back on the chair (having healthy sitting).

Step 3: Arduino code

What the project actually does, it detects if you are leaning your back or not, if you are not leaning your back Buzzer shield on your Mobile goes ON. When you lean back the Buzzer goes OFF and data logger shield saves how many unhealthy sittings you had and at which time in a CSV file. As you can see in the pictures, this is the same CSV but I took three screenshots for it just to show you the time saved, you can notice that they differ in seconds as I sat 6 successive unhealthy sittings. Illustrated Arduino code in the attached file.

/* Hi, My Name is Mona, I'm going to illustrate the code  
and here is my e-mail: monamohamed816@gmail.com  
feel free to contact if you have any  
question */ 
#define CUSTOM_SETTINGS // to activate only the libraries that we want to use 
#define INCLUDE_DATA_LOGGER_SHIELD  // includes data logger shield 
#define INCLUDE_BUZZER_SHIELD // includes Buzzer shield 
#include <OneSheeld.h> //includes 1sheeld library   
int LEDY=8; // Name of yellow LED connected to pin 8 
int LEDW=9; // Name of white LED connected to pin 9 
int P1=A0; // first piezoelectric sensor  
int P2=A1; // second piezoelectric sensor  
int counter =1; //Counter that counts how many unhealthy sittings you had 
bool flag = false ; //when this flag is true this means that you are not leaning your back on the back of the chair (unhealthy sitting) 
// when it is false then you are leaning your back ( healthy sitting)  
String keyname = "No. of Unhealthy sittings" ; //name of column in the CSV file in which the no. of unhealthy sitting is saved  
String fileName = "unHealthy sitting" ; // Name of the created file ( this file is created on your mobile in google sheets app.) 
void setup()  
{ OneSheeld.begin(); // starts communication 
 pinMode(LEDY , OUTPUT ) ; //set LEDY as output 
 pinMode(LEDW , OUTPUT ) ; // set LEDW as output 
 pinMode(P1, INPUT) ; // set first piezoelectric sensor as input 
 pinMode(P2 , INPUT) ; // set second piezoelectric sensor as input 
  Logger.stop(); // stops logging and saves last data logged 
} 
void loop() { 
 digitalWrite(LEDW,LOW); //white LED is LOW at the beginning of the program 
 digitalWrite(LEDY ,LOW); //yellow LED is LOW at the beginning of the program 
P1= analogRead(A0) ; // saves the readings coming from pin A0 in P1  
delay(5); 
P2= analogRead (A1) ; // saves the readings coming from pin A1 in P2 
delay (5); 
if (P1<100 &&P2 <100) // 2 piezoelectronic sensors are not sending readings(nothing touched them) 
{ digitalWrite( LEDY,LOW); 
  digitalWrite(LEDW,LOW); 
Buzzer.buzzOff(); // Buzzer is off 
} 
else if ( P1 > 100 && P2 < 100 ) /* sensor on the seat detected that you sat down,while sensor on the back did't send reading ( which means  
 that you are not leaning your back) */ 
{   Logger.stop();  
   delay(500); 
   Logger.start ("Unhealthy sitting" ); // starts logging in a new CSV file called unhealthy sitting 
   digitalWrite ( LEDW ,HIGH); // when P1 is sending readings white LED is HIGH 
   digitalWrite (LEDY ,LOW); // When P2 is not sending readings yellow LED is LOW 
  Buzzer.buzzOn(); //Buzzer is ON 
 flag = true ; 
 } 
 if(flag) 
 { 
   Logger.add ( "No. of unhealthy sittings" , counter ); // add values in the column in the CSV file 
   Logger.log (); // log the row in the file  
   delay(500); 
 counter++; //add 1 to the counter value 
 } 
else if ( P1>100 && P2 > 100) // both piezoelectric sensors are sending readings ( which means you are sitting and leaning your back) 
{ digitalWrite (LEDW ,HIGH ); 
 digitalWrite (LEDY ,HIGH ); 
 Buzzer.buzzOff() ; 
 } 
 else if (P1<100 && P2 > 100) // first piezoelectric is not sending readings but you are leaning your back on the chair 
 //as second piezoelectric sensor is sending readings 
 { digitalWrite (LEDY,HIGH ) ; 
   digitalWrite (LEDW,LOW ) ; 
   Buzzer.buzzOff () ; 
   } 
  else if (P1<100 && P2 <100 ) // both of them are not reading, which means you are not sitting on the chair 
   { 
     digitalWrite (LEDY,LOW ) ; 
   digitalWrite (LEDW,LOW ) ; 
   Buzzer.buzzOff () ; 
     } 
else if (P2>100) // the sensor on the back of the chair is reading 
{   digitalWrite (LEDY,HIGH ) ; 
   digitalWrite (LEDW,LOW ) ; 
   Buzzer.buzzOff () ; 
} 
} 

Code

Ergonomic chairArduino
/* Hi, My Name is Mona, I'm going to illustrate the code 
and here is my e-mail: monamohamed816@gmail.com 
feel free to contact if you have any 
question */

#define CUSTOM_SETTINGS // to activate only the libraries that we want to use

#define INCLUDE_DATA_LOGGER_SHIELD  // includes data logger shield
#define INCLUDE_BUZZER_SHIELD // includes Buzzer shield


#include <OneSheeld.h> //includes 1sheeld library  
  
int LEDY=8; // Name of yellow LED connected to pin 8
int LEDW=9; // Name of white LED connected to pin 9
int P1=A0; // first piezoelectric sensor 
int P2=A1; // second piezoelectric sensor 
int counter =1; //Counter that counts how many unhealthy sittings you had
bool flag = false ; //when this flag is true this means that you are not leaning your back on the back of the chair (unhealthy sitting)
// when it is false then you are leaning your back ( healthy sitting) 
String keyname = "No. of Unhealthy sittings" ; //name of column in the CSV file in which the no. of unhealthy sitting is saved 
String fileName = "unHealthy sitting" ; // Name of the created file ( this file is created on your mobile in google sheets app.)

void setup() 
{ OneSheeld.begin(); // starts communication
  pinMode(LEDY , OUTPUT ) ; //set LEDY as output
  pinMode(LEDW , OUTPUT ) ; // set LEDW as output
  pinMode(P1, INPUT) ; // set first piezoelectric sensor as input
  pinMode(P2 , INPUT) ; // set second piezoelectric sensor as input
   Logger.stop(); // stops logging and saves last data logged
}


void loop() {

  digitalWrite(LEDW,LOW); //white LED is LOW at the beginning of the program
  digitalWrite(LEDY ,LOW); //yellow LED is LOW at the beginning of the program
P1= analogRead(A0) ; // saves the readings coming from pin A0 in P1 
delay(5);
P2= analogRead (A1) ; // saves the readings coming from pin A1 in P2
delay (5);


 if (P1<100 &&P2 <100) // 2 piezoelectronic sensors are not sending readings(nothing touched them)
 { digitalWrite( LEDY,LOW);
   digitalWrite(LEDW,LOW);
 Buzzer.buzzOff(); // Buzzer is off
 }

 else if ( P1 > 100 && P2 < 100 ) /* sensor on the seat detected that you sat down,while sensor on the back did't send reading ( which means 
  that you are not leaning your back) */
 
 {   Logger.stop(); 
    delay(500);
    Logger.start ("Unhealthy sitting" ); // starts logging in a new CSV file called unhealthy sitting
    digitalWrite ( LEDW ,HIGH); // when P1 is sending readings white LED is HIGH
    digitalWrite (LEDY ,LOW); // When P2 is not sending readings yellow LED is LOW
   Buzzer.buzzOn(); //Buzzer is ON
  
  flag = true ;
  }
  
  if(flag)
  {
    Logger.add ( "No. of unhealthy sittings" , counter ); // add values in the column in the CSV file
    Logger.log (); // log the row in the file 
    delay(500);
  counter++; //add 1 to the counter value
  }


 else if ( P1>100 && P2 > 100) // both piezoelectric sensors are sending readings ( which means you are sitting and leaning your back)
{ digitalWrite (LEDW ,HIGH );
  digitalWrite (LEDY ,HIGH );
  
  Buzzer.buzzOff() ;
  
  }

  else if (P1<100 && P2 > 100) // first piezoelectric is not sending readings but you are leaning your back on the chair
  //as second piezoelectric sensor is sending readings
   
  { digitalWrite (LEDY,HIGH ) ;
    digitalWrite (LEDW,LOW ) ;
    
    Buzzer.buzzOff () ;
    
    }

   else if (P1<100 && P2 <100 ) // both of them are not reading, which means you are not sitting on the chair
    {
      digitalWrite (LEDY,LOW ) ;
    digitalWrite (LEDW,LOW ) ;
    
    Buzzer.buzzOff () ;
        
      }
      
 else if (P2>100) // the sensor on the back of the chair is reading

{   digitalWrite (LEDY,HIGH ) ;
    digitalWrite (LEDW,LOW ) ;
    
    Buzzer.buzzOff () ;
  
  
}


}

Schematics

Ergonomic chair Circuit
Ergonomic%20chair.fzz

Comments

Similar projects you might like

Arduinomated Car Parking with Voice Assistance in Smartphone

Project tutorial by Techmirtz

  • 8,920 views
  • 3 comments
  • 32 respects

Girlfriend Call and Message

Project tutorial by Khloud Mohamed

  • 1,457 views
  • 1 comment
  • 4 respects

Arduino can hear and understand your voice with 1Sheeld !

Project tutorial by Alessandro Didonna

  • 3,925 views
  • 1 comment
  • 10 respects

Arduino Digital Clock Using 1Sheeld

Project tutorial by amrmostaafaa

  • 2,342 views
  • 0 comments
  • 5 respects

How can you Report Thief with a Photo on Twitter by Arduino

Project tutorial by ahmed ismail

  • 1,816 views
  • 0 comments
  • 8 respects

Simple Door Prank with Arduino 1Sheeld

Project tutorial by Zowail

  • 1,394 views
  • 0 comments
  • 7 respects
Add projectSign up / Login