Maker Pro
Arduino

How to Add Haptics to a Chair Using Arduino

April 05, 2017 by Arvind Sanjeev
Share
banner

Attach this to your chair to provide a haptic feedback response when you've been sitting continuously for 10 minutes.

The idea for this Arduino phototransistor project came to me based on an idea that was shared by one of my friends at the FabLab. He talked about how his lab only has stools for people to sit on. Being very uncomfortable, the person succumbs to the discomfort and stands up to move around. In our case, we had very comfortable rolling chairs for sitting and reclining, which can get you lazy and even sleepy real quick.

In this project, I wanted to solve that problem by creating a sleek gadget which when plugged into our chairs, will prompt the user to get up if they are sitting continuously for more than 10 mins. It does this by using a haptic feedback motor, and it will only notify the person sitting on the chair, instead of disturbing others around him (if I were to use other means like sounds/lights).

This Arduino phototransistor project consists of three stages:

  • Preparing the electronics with the help of Modella
  • Programming
  • Designing and printing it using the Ultimaker

The NPN phototransistor signals the ATtiny44 when there is no light (this is the case when a person is sitting on the chair). After which the controller starts a timer. If the timer exceeds 10 minutes, then it immediately activates the haptic motor, which prompts the user to get up.

Required Materials

  1. NPN plcc 2 phototransistor
  2. ATtiny44 controller (Arduino works too)
  3. 20MHz crystal
  4. 10K resistor
  5. 6 pin (3x2) header 2nos
  6. 1uF SMD capacitor
  7. 9V battery and clip
  8. Haptic motor

Electronics and Programming

I used this tutorial to learn about phototransistors. The NPN phototransistor will be used with a floating base and the emitter connected to ground. The collector needs to be pulled up to Vcc through a resistor (I am doing this with the internal pull-up resistor). When the phototransistor detects light (the collector and emitter are shorted) it outputs a logic LOW voltage and a logic HIGH voltage when there is no light. The configuration:

I started off by using my HelloWorld board milled from the Modella and de soldering the button from it. I then attached the phototransistor to ATtiny pin no: 7. I found out that the notch in the package of the phototransistor represents the collector terminal. I learned this from the VEMT3700F NPN Transistor datasheet (PDF). Another resource worth checking out is the TT Electronics Optek Technology resource guide. You can also just use an Arduino board and connect the phototransistor to the Arduino's digital pin 7 and use the same code shown below.

After soldering the NPN phototransistor, I checked it using Arduino. I used the following code to print serially: “No light” when the phototransistor was not exposed to light and “Light detected” when it was exposed:

#include 
int v;
SoftwareSerial mySerial(0,1); // RX, TX

void setup() {
// Open serial communications and wait for port to open:
// set the data rate for the SoftwareSerial port
mySerial.begin(4800);
pinMode(7,INPUT_PULLUP);
pinMode(8, OUTPUT);

}

void loop() { // run over and over
//mySerial.println(digitalRead(7));
//delay(200);
if(digitalRead(7)==0)
{
mySerial.println("Light detected");
delay(200);
}
else if(digitalRead(7)==1)
{
mySerial.println("No Light");
delay(200);
}
}

Next, I used a salvaged phone haptic motor to connect it to pin ATtiny pin no 5 (Arduino pin 8) and tested the motor by powering it up when there is no light and turning it off when there is.

A video of the LazyMax 100 in action!

The code used for the Arduino Phototransistor:

#include 
int v;
SoftwareSerial mySerial(0,1); // RX, TX

void setup() {
// Open serial communications and wait for port to open:
// set the data rate for the SoftwareSerial port
mySerial.begin(4800);
pinMode(7,INPUT_PULLUP);
pinMode(8, OUTPUT);//Motor
}

void loop() { // run over and over
//mySerial.println(digitalRead(7));
//delay(200);

if(digitalRead(7)==0)
{
mySerial.println("Light detected");
digitalWrite(8,LOW);
delay(200);
}
else if(digitalRead(7)==1)
{
mySerial.println("No Light");
digitalWrite(8,HIGH);
delay(200);
}
}

Next, I wrote the code to activate the motor if a person is sitting for too long. Ideally, the value should be 10 minutes, but for the ease of testing, I am using 10 seconds. Here, if the controller detects no light for more than 10 seconds, the motor starts vibrating and indicates that the user needs to get out of the chair. The code:

#include 
int v;
SoftwareSerial mySerial(0,1); // RX, TX
unsigned long time;
int i;

void setup() {
// Open serial communications and wait for port to open:
// set the data rate for the SoftwareSerial port
mySerial.begin(4800);
pinMode(7,INPUT_PULLUP);
pinMode(8, OUTPUT);//Motor
}

void loop() { // run over and over
//mySerial.println(digitalRead(7));
//delay(200);

if(digitalRead(7)==0)
{
mySerial.println("No one is using me");
digitalWrite(8,LOW);
delay(200);
i=0;
}
else if(digitalRead(7)==1)
{
while(i==0)
{time = millis();
i++;}

mySerial.println("You have been sitting for more than 10 mins! Get up and work!");
if((millis()-time)>10000)
digitalWrite(8,HIGH);
delay(200);
}
}

Next, I decided to add a 5V 1A voltage regulator to power the board using a 9V battery. For this, I used the ZLDO1117 regulator (PDF). Then, I added the clip for the 9V battery, it looks like this:

Another test video!

 

Then I removed the ISP and FTDI pins to make the board sleek:

Testing the Arduino phototransistor board on a temporary setup:

Designing and Printing the Case

After I sorted out the electronics and programming part, I then moved on to designing the casing for the board that could be clipped on to the chair. I used Rhino to design this.

I started off by measuring the diameter of the chair’s edge (14.15mm), then the dimensions of the board (33x23.5mm). Based on these, I started designing the case using polylines. Later, I converted the closed curves into a surface from 3,4 pts function and then extruded it to a height of 5mm.

Next, I designed the hook for the case. I drew it using the polylines and circle function and then joined it into a closed curve. Next, I used the “Surface from planar curves” function to convert it into a surface and then extruded it to 20mm. This is how it looks:

Next, I printing the exported .stl file using Cura on the Ultimaker.

Download files: LazyMax.3dm, LazyMax.stl

Author

Avatar
Arvind Sanjeev

An interaction designer and engineer. Yahoo-Accenture had also awarded him as the "Most Promising Innovator".

Related Content

Comments


You May Also Like