Description
We continue our exploration of input devices with force sensitive resistors and photocells. Using these new devices requires implementation of trivial circuits involving the analog pin of the Arduino in parallel with a 10k ohm resistor connected to either the FSR or photocell. In this lab, we were tasked with two goals:
1) Use the Processing programming language to retrieve data from the Arduino via serial communication and create some visualization from the data created from the input devices.
2) With number one in mind, create a mechanical means of focusing or distributing force on the FSR so that its small pad could interface with some real-world object.
I decided that I wanted to create a visualization that tracks a user's history of proper posture during periods of active and inactive computer use. In other words, as a user interacts with a computer through typing or mousing, is she maintaining proper posture? How does the user's posture change when she no longer interacts with the machine as when reading a lengthy email or article? To achieve this, I wanted to minimally use two sensing devices: first, the FSR under a laptop to detect the change in force as the user typed on the keyboard or used the trackpad. Second, the photocell attached to the back of a chair to detect when a user is leaning back against it or sitting upright. I also wanted to use a potentiometer as a third input device that could detect the angle of the chair's recline, as I thought this might help inform the visualization when the user was hunched forward rather than simply sitting up. However, the limited time for this assignment prevented me from figuring out a reliable mechanical linkage between the pot and my chair.
To focus the weight of my laptop onto the FSR, I built a force focuser by cutting the handle off a plastic spoon and sanding the result. This left the equivalent of a spherical cap that I then hot glued to the concave portion of a cardboard tube end. This left one flat side with a point on the other side, surrounded by a ring of plastic for balance (see photos, below). I then affixed the FSR to the tip of the sphere and place the laptop over the entire mechanism. This works quite well; the FSR withstands the force of the laptop and is still sensitive enough to detect changes in the force as I type.
I affixed the arduino board to the armrest of the chair (so that all of the requisite wires would reach), and affixed a photocell to the back of my chair with clear tape. This also worked surprisingly well; I reached a minimum value when totally resting against the back of the chair, and reached a maximum value with sitting upright in the chair.
I programmed the Arduino to return two values. The first is a value "1" when it detects active changes in the force on the FSR, indicating active computer use, or a "0" when the force remains constant. The force fluctuates consistently as the user types or mouses, so this is effective at determining use. The second value is the raw photocell value divided by 4, to smooth out normal fluctuations in its readings.
The Processing visualization takes these values and creates a circular visualization over time. It operates essentially in polar coordinates: in the span of a second, the radius from the origin increases as a dot rotates about it. The dot's color is affected by the inputs: a green color indicates good posture by sitting up, red is poor by leaning against the back of the chair. These colors' saturation are affected by computer use; heavy saturation indicates active use, diminished saturation indicates passive use.
Components Used
1- Arduino Uno
2- LEDs (red, green)
2- 220 ohm resistors
2- 10k ohm resistors
1- FSR
1- photocell
1- plastic spoon
1- cardboard tube cap
Code
Arduino code: download here.
Processing code: download here.
Photos
Photos are included of the visualization (a screenshot), the arduino on the armest, the force focuser (top and bottom view), and the photocell embedded in the chair.
- Login to post comments