Peter Ma
Published © GPL3+

Smart Chair

When you sit for too long, it will vibrate to remind you to get off.

BeginnerFull instructions provided4 hours375
Smart Chair

Things used in this project

Hardware components

MAX32630FTHR
Maxim Integrated MAX32630FTHR
×1
Power MOSFET N-Channel
Power MOSFET N-Channel
×1
pressure sensor
×1
Adafruit vibration motor
×1
LEGO
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Schematic for button and vibration motor

Schematic for button and vibration motor

Code

Smart Chair code

Arduino
the code that make this work
/*
 * Smart Chair
 *
 * Peter Ma
 */

int val = 0;
int timer = 0;
void setup() {
 pinMode(20, OUTPUT);
 pinMode(21, OUTPUT);
 pinMode(22, OUTPUT);
 pinMode(24, INPUT_PULLUP);
 pinMode(25, OUTPUT);
   pinMode(18, OUTPUT); //for battery
}
// the loop function runs over and over again forever
void loop() {
  digitalWrite(21, LOW); //green led to show that this is working

 val = digitalRead(24);     // read the input pin
 if(val == LOW)
 {
     timer++;
}
else
{
     timer = 0;
     digitalWrite(20, HIGH); 
     digitalWrite(22, HIGH); 
     digitalWrite(25, LOW);  
}
if(timer >= 30)
{
       digitalWrite(20, LOW);   
     digitalWrite(22, LOW);   
     digitalWrite(25, HIGH);  
}
 delay(100);
}

Credits

Peter Ma

Peter Ma

49 projects • 393 followers
Prototype Hacker, Hackathon Goer, World Traveler, Ecological balancer, integrationist, technologist, futurist.

Comments